Skip to content

Instantly share code, notes, and snippets.

@apuppy
Last active June 28, 2021 02:52
Show Gist options
  • Save apuppy/9b86bc96684dae1f3ea8ee266fa813ae to your computer and use it in GitHub Desktop.
Save apuppy/9b86bc96684dae1f3ea8ee266fa813ae to your computer and use it in GitHub Desktop.
#!/bin/bash
#### print local ip address ####
alias ipaddr="echo $(ifconfig | grep broadcast | awk '{ print $2 }')"
#### print external ip address
alias external_ipv4="echo $(curl -s https://api.ipify.org)"
alias external_ipv6="echo $(curl -s https://api64.ipify.org)"
#### proxy settings ####
# normal proxy
PROXY="http://127.0.0.1:7890"
alias proxy-on="export HTTP_PROXY=$PROXY; export HTTPS_PROXY=$PROXY; export ALL_PROXY=$PROXY; export http_proxy=$PROXY; export https_proxy=$PROXY;"
# debug proxy
DEBUG_PROXY="http://127.0.0.1:8080"
alias debug-proxy-on="export HTTP_PROXY=$DEBUG_PROXY; export HTTPS_PROXY=$DEBUG_PROXY; export ALL_PROXY=$DEBUG_PROXY; export http_proxy=$DEBUG_PROXY; export https_proxy=$DEBUG_PROXY;"
# unset proxy settings
alias proxy-off="unset HTTP_PROXY; unset http_proxy; unset HTTPS_PROXY; unset https_proxy; unset ALL_PROXY"
# no proxy settings
export NO_PROXY=localhost,172.17.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment