Skip to content

Instantly share code, notes, and snippets.

@dyoung522
Last active July 17, 2017 19:27
Show Gist options
  • Save dyoung522/d89f606c280b22acdf28ef39fd432aa9 to your computer and use it in GitHub Desktop.
Save dyoung522/d89f606c280b22acdf28ef39fd432aa9 to your computer and use it in GitHub Desktop.
Proxy ON/OFF scripts
  1. create a file named ~/.env-proxy-on with the following:
### PROXY STUFF
export NO_PROXY=127.0.0.1,localhost,192.168.99.100
export PROXY_HOST=192.168.50.100
export PROXY_PORT=3128
export PROXY=$PROXY_HOST:$PROXY_PORT
export PROXY_URL=http://$PROXY
export ALL_PROXY=$PROXY_URL
export HTTP_PROXY=$PROXY_URL
export HTTPS_PROXY=$PROXY_URL
export http_proxy=$HTTP_PROXY
export https_proxy=$HTTPS_PROXY
### E_O_PROXY
  1. create a file named ~/.env-proxy-off with the following:
### PROXY STUFF
unset NO_PROXY
unset PROXY_HOST
unset PROXY_PORT
unset PROXY
unset PROXY_URL
unset ALL_PROXY
unset HTTP_PROXY
unset HTTPS_PROXY
unset http_proxy
unset https_proxy
### E_O_PROXY
  1. create a script named proxyon with the following:
#!/bin/bash
[[ -e ~/.env-proxy-on ]] && source ~/.env-proxy-on
  1. create a script named proxyoff with the following:
#!/bin/bash
[[ -e ~/.env-proxy-off ]] && source ~/.env-proxy-off

Then, to enable terminal proxy run proxyon to disable them, run proxyoff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment