Skip to content

Instantly share code, notes, and snippets.

@yocontra
Last active December 10, 2015 19:08
Show Gist options
  • Save yocontra/4479244 to your computer and use it in GitHub Desktop.
Save yocontra/4479244 to your computer and use it in GitHub Desktop.
prox
sudo sh -c 'echo "proxyserver=\"chisproxy.amers.ibechtel.com\"
proxyport=\"8080\"
git config --global url.https://github.com/.insteadOf git://github.com/
function proxy(){
echo -n \"Bechtel Username: \"
read -e username
echo -n \"Bechtel Password: \"
read -es password
export http_proxy=\"http://\$username:\$password@\$proxyserver:\$proxyport\"
export https_proxy=\$http_proxy
export ftp_proxy=\"ftp://\$username:\$password@\$proxyserver:\$proxyport\"
export no_proxy=\"localhost,127.0.0.1,localaddress,.localdomain.com,.local\"
alias sudo=\"sudo \"
alias sudop=\"sudo http_proxy=\$http_proxy https_proxy=\$https_proxy ftp_proxy=\$ftp_proxy no_proxy=\$no_proxy\"
alias fixnpm=\"npm config set proxy \$http_proxy && npm config set https-proxy \$https_proxy && npm config set strict-ssl false\"
echo -e \"\nBechtel environment set.\"
echo -n \"Github Username: \"
read -e ghusername
echo -n \"Github Password: \"
read -es ghpassword
git config --global url.https://\$ghusername:\[email protected]/.insteadOf https://github.com/
echo -e \"\nGithub environment set.\"
echo -e \"\nRun proxyoff before exiting to clear your details from the system\"
}
function proxyoff(){
unset HTTP_PROXY
unset http_proxy
unset HTTPS_PROXY
unset https_proxy
unset FTP_PROXY
unset ftp_proxy
unalias sudop
unalias fixnpm
echo -e \"\nBechtel environment removed.\"
rm -rf ~/.gitconfig
echo -e \"\nGithub environment removed.\"
}" > /etc/profile.d/proxy.sh'
source /etc/profile.d/proxy.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment