Skip to content

Instantly share code, notes, and snippets.

@happypeter
Created October 27, 2014 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save happypeter/c2a2b4969bbfe92ffb82 to your computer and use it in GitHub Desktop.
Save happypeter/c2a2b4969bbfe92ffb82 to your computer and use it in GitHub Desktop.
byebye GFW
cleanup()
# example cleanup function
{
networksetup -setsocksfirewallproxystate wi-fi off
}
control_c()
# run if user hits control-c
{
echo -en "\n*** Ouch! Closing proxy ***\n"
cleanup
exit $?
}
# trap keyboard interrupt (control-c)
trap control_c SIGINT
echo "Turning on proxy"
networksetup -setsocksfirewallproxystate wi-fi on
# main() loop
ssh -N -D 7070 106.186.22.51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment