Skip to content

Instantly share code, notes, and snippets.

View SamRothCA's full-sized avatar

Sam Rothenberg SamRothCA

  • San Francisco, CA
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key><string>local.tor</string>
<key>ProgramArguments</key><array>
<string>/usr/bin/open</string>
<string>-a</string>
<string>Tor</string>
</array>
set serverNames to {"Server 1", "Server 2"}
choose from list serverNames with title "Mount Drive via SSH" with prompt "Which system would you like to mount a drive to?"
set serverName to the result
if serverName is false then
-- Abort if the user cancelled
error number -128
else if serverName is {"Server 1"} then
set serverIP to "192.168.1.146"
-- Repeat for each server
activate application "Cisco AnyConnect Secure Mobility Client"
tell application "System Events" to tell process "Cisco AnyConnect Secure Mobility Client"
click menu item "Show AnyConnect Window" of menu "Cisco AnyConnect Secure Mobility Client" of menu bar 1
click button "Connect" of window 1
set secondsLeft to 5
repeat until window "Cisco AnyConnect | vpn.mobile.unibas.ch" exists
if secondsLeft is 0 then
@SamRothCA
SamRothCA / -
Last active August 29, 2015 14:23
Number Start (sector) End (sector) Size Code Name
1 34 409634 200.0 MiB EF00 EFI
2 409640 488965176 233.0 GiB AF00 Macintosh HD
3 488965176 490234712 1.0 GiB AB00 Recovery HD
CheckForGroup=`id -Gn $1`
if [[ "$CheckForGroup" == *macstaff* ]]; then
curl -o --url macserver.cfsd16.org/test_profile.mobileconfig --output /Library/Management/test_profile.mobileconfig
sudo profiles -I -F /Library/Management/test_profile.mobileconfig
echo "You are a macstaff" >> /var/log/login.log
exit 0
fi
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
<key>Label</key><string>local.killblued</string>
<key>ProgramArguments</key><array>
<string>/usr/bin/killall</string>
<string>blued</string>
</array>
<key>RunAtLoad</key> <true/>
<key>LaunchOnlyOnce</key> <true/>
@SamRothCA
SamRothCA / calendar.sh
Created November 28, 2014 17:05
Calendar for current month
cal | grep --before-context 6 --after-context 6 --color -e " $(date +%e)" -e "^$(date +%e)"
Sat Nov 1 18:16:14 2014
*** Panic Report ***
panic(cpu 2 caller 0xffffff8010c1e80a): Kernel trap at 0xffffff7f928f586f, type 13=general protection, registers:
CR0: 0x000000008001003b, CR2: 0x0000000005562000, CR3: 0x000000001361d000, CR4: 0x00000000001626e0
RAX: 0x00000000e00002d8, RBX: 0x00000000414c5631, RCX: 0xffffff811c213dd8, RDX: 0x0000000000000006
RSP: 0xffffff811c213db0, RBP: 0xffffff811c213dc0, RSI: 0x00000000414c5631, RDI: 0xadbeefdeadbeefde
R8: 0x0000000000000002, R9: 0xffffff80112d5020, R10: 0x0000000000000018, R11: 0xffffff802403d900
R12: 0xffffff811c213dd8, R13: 0xffffff8024059c00, R14: 0xffffff802405c913, R15: 0x00000000414c5631
RFL: 0x0000000000010286, RIP: 0xffffff7f928f586f, CS: 0x0000000000000008, SS: 0x0000000000000000
@SamRothCA
SamRothCA / rssfeed.sh
Created October 30, 2014 21:09
Last 5 items from RSS feed
curl "RSS_URL_HERE" 2>/dev/null |
grep -o "<title>[^<]*</title>" |
grep -v "<title>FIRST_TITLE_REMOVER</title>" |
sed -e "s/.*\<title\>\(.*\)\<\/title\>.*/\1/g" |
nl -n rz -s " » " -w 2 |
fold -s -w 80 |
awk '!/^[0-9]+\ » / {$0=" "$0}1' |
awk '/^[0-9]+\ » / {$0="\n"$0}1' |
head -10
@SamRothCA
SamRothCA / dailyquote.sh
Created October 30, 2014 21:06
Quote Of The Day
curl --silent www.brainyquote.com/quotes_of_the_day.html |
egrep '(span class=\"bqQuoteLink\")|(div class=\"bq-aut\")' |
sed -n '1p; 2p; ' |
sed -e 's/<[^>]*>//g'