Proxyrc
A short hand-made shell configuration to easily switch proxy settings between my home & home away from home (KGP).
Install / Use
/learn @athityakumar/ProxyrcREADME
proxyrc
A proxy configuration file that solves the purpose of switching the proxies while travelling to KGP (proxy) and Home (without proxy), with a SINGLE COMMAND.
What all does it do?
- Set
http_proxyandhttps_proxyvariables - Set
git config --globalhttp.proxyandhttps.proxyvariables - Change
~/.ssh/configto include Corkscrew
Setup
-
Be sure to setup your
~/.ssh/config.kgpand~/.ssh/config.homefiles with the same names (config.kgpandconfig.home). For example, my files look like ssh_config_home and ssh_config_kgp. -
No need to clone the entire repository. Just get the
proxy.shfile by typing this in your terminal -
$ curl -o ~/.proxyrc https://raw.githubusercontent.com/athityakumar/proxyrc/master/proxy.sh
- Add this to your shell configuration file (
~/.bashrc,.zshrc) -
proxy() { sh ~/.proxyrc $1; }
If you use fish, you can get the function proxy.fish file by a simple curl command:
$ curl -o ~/.config/fish/functions/proxy.fish https://raw.githubusercontent.com/athityakumar/proxyrc/master/proxy.fish
Usage
- Switch to KGP environment -
$ proxy kgp
Switching to KGP Proxy setting, http://172.16.2.30:8080/
- Switch to home envrionment (default) -
$ proxy
Home, sweet home! No proxy settings.
$ proxy home
Home, sweet home! No proxy settings.
Tweaking
The proxy.sh file is quite straight forward. In case of more proxies, add more if-else cases. If there's a change that applies to KGP population, feel free to send a Pull Request here.
License
MIT LICENSE 2017 - Athitya Kumar
