Skip to content

Instantly share code, notes, and snippets.

@bacher09
Last active February 5, 2017 13:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bacher09/ae63a1c00cda3226670e to your computer and use it in GitHub Desktop.
Save bacher09/ae63a1c00cda3226670e to your computer and use it in GitHub Desktop.
Useful aliases
myip() {
curl -4 "http://icanhazip.com/"
}
myip6() {
curl -6 "http://icanhazip.com/"
}
reverse_ipv4() {
local ip="$1"
echo "$ip" | awk -F. '{print $4 "." $3 "." $2 "." $1}'
}
dig_asn() {
local rev_ip=$(reverse_ipv4 $1)
dig -t TXT +short "$rev_ip.origin.asn.cymru.com"
}
whois_asn() {
whois -h whois.cymru.com " -v $1"
}
case $(uname -s) in
Darwin)
pdfman() {
man -t $@ | open -f -a /Applications/Preview.app
}
;;
*)
evince_stdin() {
local temp_file=$(mktemp -t evince-$USER.XXXXXX || exit 1)
cat > "$temp_file"
evince "$temp_file"
sleep 2
rm -f "$temp_file"
}
pdfman() {
man -Tpdf $@ | evince_stdin &
}
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment