So here's the scene: you've just completed that awesome new feature and you can't wait to get it out into the wild. You go to push to source control, but wait, you're not connected to the VPN. So what do you do?
Option 1: Use the mouse to click that little icon in the OSX menu bar.
Heck no, you're a software engineer, you don't need a mouse!
Option 2: Type
vpn in your shell prompt!
But how do I do that?
save this applescript (with the vpn name) somewhere useful, maybe your user directory:
tell application "System Events" tell current location of network preferences set VPNservice to service "NAME_OF_VPN" if exists VPNservice then connect VPNservice end tell end tell
vpn to execute that applescript
alias vpn='osascript ~/openvpn.applescript'
And you're done! Now just type
vpn in your shell prompt and you'll be able to type in your vpn password without having to use the mouse!
courtesy of https://github.com/webandy