Last active
March 15, 2017 17:03
-
-
Save lujiajing1126/7a1b171ab45761864eaf32be46fb243c to your computer and use it in GitHub Desktop.
Revisions
-
lujiajing1126 revised this gist
Mar 15, 2017 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,6 @@ #!/bin/bash # you can set alias p="use-proxy" in your .bashrc or .zshrc # then you can type: p curl https://google.com set -e usage () { @@ -27,4 +26,8 @@ while getopts ":u" opt; do esac done if [ -z $(which $1) ]; then zsh -c "source ~/.zshrc; https_proxy=127.0.0.1:1235 http_proxy=127.0.0.1:1235 $1" else exec "$@" fi -
lujiajing1126 revised this gist
Nov 26, 2016 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ #!/bin/bash # you can set alias p="use-proxy" in your .bashrc or .zshrc # then you can type: p curl https://google.com # also use with sudo: p -u echo 1 set -e usage () { -
lujiajing1126 revised this gist
Nov 26, 2016 . 1 changed file with 19 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,27 @@ # then you can type: p curl https://google.com set -e usage () { echo "use-proxy [-u] <command>" exit 127 } [ $# -eq 0 ] && usage echo "will run $@" export https_proxy=127.0.0.1:1235 export http_proxy=127.0.0.1:1235 while getopts ":u" opt; do case $opt in u) shift exec sudo "$@" exit 1 ;; \?) usage ;; esac done exec "$@" -
lujiajing1126 created this gist
Nov 25, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ #!/bin/bash # you can set alias p="use-proxy" in your .bashrc or .zshrc # then you can type: p curl https://google.com set -e echo "will run $@" export https_proxy=127.0.0.1:1235 export http_proxy=127.0.0.1:1235 exec "$@"