Date Category tech

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 API.

Over the next couple minutes, I unceremoniously hacked that module into a script that you can kick off whenever you want a URL:

Prerequisites: python-bitly requires simplejson (or json), which you can install with: pip install simplejson. After this, register an account at, grab your username and API key from the account page, and paste them into the script (API_USERNAME and API_KEY respectively).

Example session:

(crono:~)$ ''

Short URL:

Get in the habit of quoting the URL, because a URL that contains ampersands (&) or semicolons (;) will cause problems with bash. Grab the script!