Skip to content

Instantly share code, notes, and snippets.

View e11s's full-sized avatar

Edgar Ivaskevicius e11s

View GitHub Profile
@e11s
e11s / amphetamine-on
Created January 9, 2019 23:45
Amphetamine Control AppleScript
on alfred_script(q)
tell application "Amphetamine"
set sessionActiveTest to session is active
if sessionActiveTest is false then
if (q is not in {"", null}) then
@e11s
e11s / anyconnect_cli.scpt
Last active September 18, 2019 21:12
Cisco AnyConnect VPN CLI client connection automation (with Keychain)
global vpn_url, keychain_key, app_title, connection_state_polling_interval
set app_title to "My AnyConnect VPN"
set vpn_url to "https://some.ssl.vpnserver"
set keychain_key to "My_AnyConnect_VPN"
set connection_state_polling_interval to 10
(* Custom handlers *************************************************************)
on is_connected()
set command_output to do shell script "/opt/cisco/anyconnect/bin/vpn status"
log command_output
@e11s
e11s / anyconnect_gui.scpt
Last active March 6, 2020 10:12
Cisco AnyConnect VPN GUI client connection automation (with Keychain)
-- 1. Create a new generic password entry in Keychain Access called "WHATEVER_AnyConnect_VPN" (the name in Keychain access must match that in line 39 below) with your password for the Cisco AnyConnect VPN server.
-- 2. Modify values of vpnUrl and keychainKey variables
-- 3. Open this script in Script Editor (both this and the above are in the Applications->Utilities folder) and "Save as.." an Application (.app) with desired name.
-- 4. Open Security & Privacy System Preferences, go to Privacy, Accessibility.
-- 5. Enable the above .app so it can access Accessibility
-- 6. Copy and paste a nice icon on the generic Applescript icon (I used a copy of the default AnyConnect one)
-- 7. Add the new .app to /Users/[yourshortname]/Applications with a shortcut to your Dock
-- 8. Enjoy the fast connection with no need to enter password and increased security of not having a sensitive password stored as plain text
-- 9. Run script again to close connection
@e11s
e11s / hack.sh
Created July 25, 2012 19:35 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/3178087/hack.sh | sh
#