Tag Archives: tinyurl

using Quicksilver to get TinyURL

If you use Twitter you probably use TinyURL to shorten your URLs pretty often, I looked into doing this with Quicksilver, there are a couple of blog posts that show you how to do it, but none of them I really liked. One even said it was crap himself in the beginning of the post.

What I really want is this:

  • I would copy the URL I want to shorten to my OS X clipboard
  • I run something in Quicksilver
  • The clipboard will be updated with the shortened URL

This turned out to be extremely easy to do. Here’s a Ruby script that does exactly that. If you make the script executable, Quicksilver should include it in its catalog. So just copy a long URL into your clipboard (?-C), invoke Quicksilver, type the filename (I just type “tiny”), and wola, your clipboard will have the TinyURL so you can paste (?-V) it into wherever.

#!/usr/bin/env ruby
require 'net/http'
require 'uri'

def shorten(url)

IO.popen('pbcopy', 'w').puts "#{shorten(IO.popen('pbpaste', 'r+').read)}"