added scripts from desktop
authorMatthew Owens <matthew@owens.tech>
Sat, 11 Dec 2021 15:12:12 +0000 (15:12 +0000)
committerMatthew Owens <matthew@owens.tech>
Sat, 11 Dec 2021 15:12:12 +0000 (15:12 +0000)
abyss-module [new file with mode: 0755]
fvps [new file with mode: 0755]
gvps [new file with mode: 0755]
proj [new file with mode: 0755]
vps [new file with mode: 0755]

diff --git a/abyss-module b/abyss-module
new file mode 100755 (executable)
index 0000000..f23a428
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+[ -z $GIT_DIR ] && GIT_DIR=~/git
+ORG=AbyssalThistle
+MODULE_NAME=$1
+ME=${0##*/}
+
+function usage
+{
+       echo "usage: $ME <module_name>"
+}
+
+function sanity_check
+{
+       prereqs=(gh git)
+       which ${prereqs[*]} > /dev/null 2>&1
+
+       if [ $? -ne 0 ]; then
+               echo "error: env is insane, ensure the following are installed: ${prereqs[*]}"
+               exit 1
+       fi
+
+       if [ -z $MODULE_NAME ]; then
+               echo "error: no module name"
+               usage
+               exit 1
+       fi
+
+       gh repo view $ORG/module-template > /dev/null 2>&1
+       if [ $? -ne 0 ]; then
+               echo "error: no access to $ORG/module-template on github!"
+               exit 1
+       fi
+
+       gh repo view $ORG/test-template > /dev/null 2>&1
+       if [ $? -ne 0 ]; then
+               echo "error: no access to $ORG/test-template on github!"
+               exit 1
+       fi
+}
+
+sanity_check
+
+ABYSS_DIR=$GIT_DIR/$ORG
+cd $ABYSS_DIR
+
+gh repo create $ORG/$MODULE_NAME --template $ORG/module-template --private -y
+gh repo create $ORG/$MODULE_NAME-test --template $ORG/test-template --private -y
+# removing the local test dir, since we'll add it as a submodule later
+rm -rf $MODULE_NAME-test
+
+cd $MODULE_NAME
+./init_module.sh $MODULE_NAME
+git submodule add git@github.com:$ORG/$MODULE_NAME-test
+cd $MODULE_NAME-test
+./init_tests.sh $MODULE_NAME
+cd ..
+git commit -am "added $MODULE_NAME-test submodule"
+git push
diff --git a/fvps b/fvps
new file mode 100755 (executable)
index 0000000..6c34994
--- /dev/null
+++ b/fvps
@@ -0,0 +1 @@
+ssh ec2-user@moradinsfoundry.co.uk
diff --git a/gvps b/gvps
new file mode 100755 (executable)
index 0000000..9420b3c
--- /dev/null
+++ b/gvps
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+mosh git@owens.tech
diff --git a/proj b/proj
new file mode 100755 (executable)
index 0000000..a935215
--- /dev/null
+++ b/proj
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+Usage()
+{
+       echo "Usage: $0 [project name]"
+}
+
+if [ $# -ne 1 ]; then
+       Usage
+fi
+
+folderPath=$(find $HOME/git/ -maxdepth 3 -type d -name $1)
+folderCount=$(find $HOME/git/ -maxdepth 3 -type d -name $1 | wc -l)
+
+if [ $folderCount -gt 1 ]; then
+       echo "err: multiple possible projects found for '$1'"
+       echo $folderPath
+       exit
+elif [ $folderCount -eq 0 ]; then
+       echo "err: no possible projects found for '$1'"
+       exit
+fi
+# is the session already running?
+if [ $(tmux ls | grep $1 | wc  -l) -eq 1 ]; then
+       tmux new-session -A -s $1
+       exit
+else
+       cd $folderPath
+       tmux new-session -d -s $1
+       tmux rename-window src
+       tmux send-keys "cd src;clear" ENTER
+       tmux new-window -n build -c $folderPath
+       tmux select-window -t src
+       tmux -2 attach-session -d
+fi
diff --git a/vps b/vps
new file mode 100755 (executable)
index 0000000..1b06640
--- /dev/null
+++ b/vps
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+mosh matthew@owens.tech