I'm a command line junkie. Whether that's a good or bad thing I'll leave up to the reader. But since the reader is here, I'll assume (s)he finds command line utilities helpful!
Lately, I've found myself generating short URLs for things often enough that I thought it would be nice to have a little script that generates them for me. Then I found python-bitly, an elegant little Python module that wraps the bit.ly API.
Over the next couple minutes, I unceremoniously hacked that module into a script that you can kick off whenever you want a bit.ly URL: bitly.py.
Prerequisites: python-bitly requires simplejson (or json), which you
can install with:
pip install simplejson. After this,
register an account at bit.ly, grab your username and API key from
the account page, and paste them
into the script (
(crono:~)$ bitly.py 'http://github.com/' Short URL: http://bit.ly/k7lifz
Get in the habit of quoting the URL, because a URL that contains ampersands (&) or semicolons (;) will cause problems with bash. Grab the script!