handy features for zsh on larry
authorAndrew Lorimer <andrew@lorimer.id.au>
Thu, 16 Aug 2018 11:52:13 +0000 (21:52 +1000)
committerAndrew Lorimer <andrew@lorimer.id.au>
Thu, 16 Aug 2018 11:52:13 +0000 (21:52 +1000)
autocifs.sh [new file with mode: 0755]
macopen.sh [new file with mode: 0755]
diff --git a/autocifs.sh b/autocifs.sh
new file mode 100755 (executable)
index 0000000..cccbc71
--- /dev/null
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+#
+# Automatically mount samba share on charles.cortex when connected to cortex-lab
+#
+
+ssid=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | sed -e "s/^  *SSID: //p" -e d)
+
+if [[ $ssid == cortex-lab ]]; then
+       osascript -e 'mount volume "smb://andrew@charles/andrew"'
+fi
diff --git a/macopen.sh b/macopen.sh
new file mode 100755 (executable)
index 0000000..51d2746
--- /dev/null
@@ -0,0 +1,21 @@
+#! /bin/bash
+
+#include <sys/param.h>
+#include <stdlib.h>
+
+exe=$1
+files=${@:2}
+path=''
+
+resolve() {
+       path=$(realpath $1)
+       echo $1
+}
+
+#$(open -a $1 
+
+for f in $files
+do
+       open -a $exe $(resolve $f)
+       echo $(resolve $f)
+done