Created
October 6, 2014 19:08
-
-
Save kvnneff/b6e6e03904654dc1f61f to your computer and use it in GitHub Desktop.
Bash function to toggle work proxy on or off on Mac OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# "Wi-Fi" is the name of your internet service. View your OS X | |
# network settings to see a list of your services. | |
# | |
work-proxy () { | |
if [ "$1" == 'off' ]; then | |
networksetup -setsocksfirewallproxystate "Wi-Fi" off | |
kill $(ps aux | grep '[s]sh -Nf -D 7070 [email protected]' | awk '{print $2}') | |
else | |
ssh -Nf -D 7070 [email protected] | |
networksetup -setsocksfirewallproxy "Wi-Fi" 127.0.0.1 7070 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment