Skip to content

Instantly share code, notes, and snippets.

@terryoy
Last active December 21, 2015 22:19
Show Gist options
  • Save terryoy/6374725 to your computer and use it in GitHub Desktop.
Save terryoy/6374725 to your computer and use it in GitHub Desktop.
Useful Alias
# open a browser and view raw html (e.g. "cat some.html | viewhtml")
alias viewhtml='firefox "data:text/html;charset=utf-8;base64,$(base64 -w 0 <&0)"'
# url encode / decode
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
# url shortener
alias shortenurl="python -c \"import sys, urllib as ul; print ul.urlopen('http://tinyurl.com/api-create.php?url=%s' % ul.quote_plus(sys.argv[1])).readline()\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment