Skip to content

Instantly share code, notes, and snippets.

@bGZo
Last active July 2, 2024 12:46
Show Gist options
  • Save bGZo/82a76ecbebf81b556a1d20a91a6bd21a to your computer and use it in GitHub Desktop.
Save bGZo/82a76ecbebf81b556a1d20a91a6bd21a to your computer and use it in GitHub Desktop.
docs: proxy command references
# ____
# __ _|___ \ _ __ _ __ _____ ___ _
# \ \ / / __) | '_ \| '__/ _ \ \/ / | | |
# \ V / / __/| |_) | | | (_) > <| |_| |
# (_)_/ |_____| .__/|_| \___/_/\_\\__, |
# |_| |___/
# +---------------+---------------------------------------+
# | updated | 20230210 |
# | author | bGZo |
# | test command | curl www.google.com |
# | software | clash / proxifier |
# | all_proxy | https://askubuntu.com/questions/24116 |
# +---------------+---------------------------------------+
# +-----------------+---------------------+
# | system | wsl1 / *nix |
# | check command | env | grep -i proxy |
# +-----------------+---------------------+
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
export all_proxy=http://127.0.0.1:7890
# +---------+---------------------------+
# | system | wsl2 |
# | mark | we need to set every time |
# | | because the dynamtic IP |
# +---------+---------------------------+
host_ip=$(cat /etc/resolv.conf | grep "nameserver" |cut -f 2 -d " ")
export http_proxy="http://$host_ip:7890"
export https_proxy="http://$host_ip:7890"
export all_proxy="http://$host_ip:7890"
# +---------+---------------------+
# | system | windows cmd |
# | mark | use unset to cancel |
# +---------+---------------------+
set http_proxy=http://127.0.0.1:7890
set https_proxy=http://127.0.0.1:7890
set proxy_all=http://127.0.0.1:7890
# +---------+---------------------+
# | system | windows powershell |
# +---------+---------------------+
$env:http_proxy="http://127.0.0.1:7890"
$env:https_proxy="http://127.0.0.1:7890"
$env:all_proxy="http://127.0.0.1:7890"
# Other ways could be like
# $ sudo netsh winhttp set proxy 127.0.0.1:7890
# $ netsh winhttp show proxy
# $ sudo netsh winhttp reset proxy
# Note: sudo command is the package under scoop/chocolatey
# More powerful via: https://gist.github.com/famousgarkin/c5138b1e13ac41920d22
# +-------------+-------+
# | environment | pip3 |
# +-------------+-------+
pip3 install --trusted-host pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple <package>
# +-------------+-----------+
# | environment | npm/yarn |
# +-------------+-----------+
npm install --registry=http://registry.npm.taobao.org
# +-------------+----------------------------------------------------------------------------+
# | environment | git |
# | reference | https://git-scm.com/docs/git-config#Documentation/git-config.txt-httpproxy |
# | mark | https://stackoverflow.com/questions/783811 |
# | download | https://ghproxy.com |
# +-------------+----------------------------------------------------------------------------+
git config --global http.proxy http://127.0.0.1:7890
git config --global --unset http.proxy
git config --global --get http.proxy
# +-------------+--------------------------------------------------+
# | environment | electron |
# | reference | https://code.visualstudio.com/docs/setup/network |
# +-------------+--------------------------------------------------+
--proxy-server=http://127.0.0.1:7890
--no-proxy-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment