@czyczk
2020-09-17T07:02:31.000000Z
字数 2285
阅读 491
Linux Shell
# User-defined aliases# Show your IP on the Internetalias show_ip="curl http://ipinfo.io/json"# Apply proxies (Setting `ALL_PROXY` only is not enough since some applications like `go get` follows `HTTP_PROXY` and `HTTPS_PROXY` only.)export GLOBAL_PROXY_URL="socks5://127.0.0.1:12080"alias auto_set_proxy='export ALL_PROXY="$GLOBAL_PROXY_URL" && export HTTP_PROXY="$GLOBAL_PROXY_URL" && export HTTPS_PROXY="$GLOBAL_PROXY_URL"'alias auto_unset_proxy="unset ALL_PROXY && unset HTTP_PROXY && unset HTTPS_PROXY"alias auto_set_git_proxy='git config --global http.https://github.com.proxy "$GLOBAL_PROXY_URL" && git config --global https.https://github.com.proxy "$GLOBAL_PROXY_URL"'alias auto_unset_git_proxy="git config --global --unset http.https://github.com.proxy && git config --global --unset https.https://github.com.proxy"# ShadowsocksR related (only work after SSR is configured)alias start_ssr="sudo python /opt/shadowsocksr/shadowsocks/local.py -c /etc/shadowsocksr/user-config.json -d start"alias check_ssr="sudo tail /var/log/shadowsocksr.log"# User-defined environment variables# Golangexport GOPATH=$HOME/goexport PATH=$PATH:$GOPATH/binexport GOPROXY=https://goproxy.cn# NVM (defer init + Zsh ver.)# (for Bash version, use `type -t` instead of `whence -w`)# Defer initialization of nvm until nvm, node or a node-dependent command is# run. Ensure this block is only run once if .bashrc gets sourced multiple times# by checking whether __init_nvm is a function.if [ -s "$HOME/.nvm/nvm.sh" ] && [ ! "$(whence -w __init_nvm)" = function ]; thenexport NVM_DIR="$HOME/.nvm"[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion"declare -a __node_commands=('nvm' 'node' 'npm' 'yarn' 'gulp' 'grunt' 'webpack')function __init_nvm() {for i in "${__node_commands[@]}"; do unalias $i; done. "$NVM_DIR"/nvm.shunset __node_commandsunset -f __init_nvm}for i in "${__node_commands[@]}"; do alias $i='__init_nvm && '$i; donefi# Pyenvexport PATH="/home/zenas/.pyenv/bin:$PATH"eval "$(pyenv init -)"eval "$(pyenv virtualenv-init -)"# Pip installed binsexport PATH=~/.local/bin:$PATH# RUSTUPexport RUSTUP_DIST_SERVER=https://mirrors.tuna.tsinghua.edu.cn/rustup# Enable proxy when starting shell# auto_set_proxy