Loading .bashrc +1 −1 Original line number Diff line number Diff line Loading @@ -231,7 +231,7 @@ gen_csr () { jt () { if command -v pygmentize > /dev/null then python3 -m json.tool "$@" | pygmentize -l javascript python3 -m json.tool "$@" | pygmentize -l json else python3 -m json.tool "$@" fi Loading Documents/bin/ipinfo 0 → 100755 +36 −0 Original line number Diff line number Diff line #!/bin/sh set -eu is_ip () { echo "$1" | grep --extended-regexp --quiet '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' } usage () { echo "USAGE: $(basename "$0") [-h] [hostname or IP address]" >&2 echo "If no address is passed, the internet IP address is used instead." >&2 } if [ "$#" -eq 0 ] then address="$(curl --silent --fail --show-error https://myip.shore.co.il/)" elif [ "$#" -gt 1 ] then usage exit 1 elif [ "$1" = "-h" ] then usage elif is_ip "$1" then address="$1" else address="$(dig +short "$1")" fi if command -v pygmentize > /dev/null then curl --silent --fail --show-error --header "Accept: application/json" "https://ipinfo.io/${address}" | pygmentize -l json else curl --fail --show-error --header "Accept: application/json" "https://ipinfo.io/${address}" fi Loading
.bashrc +1 −1 Original line number Diff line number Diff line Loading @@ -231,7 +231,7 @@ gen_csr () { jt () { if command -v pygmentize > /dev/null then python3 -m json.tool "$@" | pygmentize -l javascript python3 -m json.tool "$@" | pygmentize -l json else python3 -m json.tool "$@" fi Loading
Documents/bin/ipinfo 0 → 100755 +36 −0 Original line number Diff line number Diff line #!/bin/sh set -eu is_ip () { echo "$1" | grep --extended-regexp --quiet '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' } usage () { echo "USAGE: $(basename "$0") [-h] [hostname or IP address]" >&2 echo "If no address is passed, the internet IP address is used instead." >&2 } if [ "$#" -eq 0 ] then address="$(curl --silent --fail --show-error https://myip.shore.co.il/)" elif [ "$#" -gt 1 ] then usage exit 1 elif [ "$1" = "-h" ] then usage elif is_ip "$1" then address="$1" else address="$(dig +short "$1")" fi if command -v pygmentize > /dev/null then curl --silent --fail --show-error --header "Accept: application/json" "https://ipinfo.io/${address}" | pygmentize -l json else curl --fail --show-error --header "Accept: application/json" "https://ipinfo.io/${address}" fi