Skip to content

Instantly share code, notes, and snippets.

@KhasMek
Created November 19, 2018 16:57
Show Gist options
  • Save KhasMek/748d04b3a7398fefc8771d054fd28d68 to your computer and use it in GitHub Desktop.
Save KhasMek/748d04b3a7398fefc8771d054fd28d68 to your computer and use it in GitHub Desktop.
quick plugin for omz to (un)set shell proxies. Pretty rough atm.
#!/bin/zsh
#
# Sets and unsets a proxy address/port for the local shell
#
function enable_shell_proxy() {
if [[ -n "$1" ]]; then
proxy="$1"
else;
proxy="127.0.0.1:8080"
fi
echo "Proxy Server: $proxy"
export http_proxy="http://$proxy"
export https_proxy="https://$proxy"
echo " [*] Proxy servers set!"
echo " [*] HTTP Proxy: $http_proxy"
echo " [*] HTTP Proxy: $https_proxy"
}
function disable_shell_proxy {
unset http_proxy
unset https_proxy
echo " [*] Proxy servers unset!"
echo " [*] HTTP Proxy: $http_proxy"
echo " [*] HTTP Proxy: $https_proxy"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment