May 2011 Archives

Get Short

Inspired by this helpful post about Alfred, I thought I'd share a quick and easy way to shorten a URL with X.CO using Alfred.

First thing you'll need is your API key, which can be found on the Settings page.

Once you have that, you just need to fill in the Terminal Shortcut like so:

Alfred Settings for the X.CO integration

That "Command" field reads (replace KEY with the API key you copied previously): curl -s http://api.x.co/Squeeze.svc/text/KEY?url={query} | pbcopy

Hit "Save," make it "Silent" by checking that box, and you're ready to shorten. To use it, invoke Alfred, type "x http://your-url-to-shorten.com/", and press Return. Your clipboard will contain the shortened URL.

Another option that works really well is to create a Terminal Shortcut mapped to "xc" that runs the Command "curl -s http://api.x.co/Squeeze.svc/text/KEY?url=$(pbpaste) | pbcopy". This version will pull the source URL from your clipboard, shorten it, and replace it on the clipboard with the shortened form. That is very handy.

[The views expressed on this website/weblog are mine alone and do not necessarily reflect the views of Go Daddy Software, Inc.]

Log Your Work to a Text File

I read about the virtues of logging what you do all day long ago, but a recent article re-kindled my interest. (Sadly, I can't locate that blog entry and it was a very good one.)

On Quicksilver, it was rather easy to accomplish a digital work journal. But I don't use Quicksilver any longer—I've converted wholly to Alfred. It's almost as perfect as Quicksilver; I miss the large-type view and some of the gratuitous animations, but it has the benefit of being usable.

My first order of business was to figure out how to append a message containing an automatically generated timestamp to the end of a text file. This was surprisingly harder than I thought. There really wasn't any decent shell scripts I could find via Google and the searches yielded a lot of ways to time stamp a log file.

Here's what I ended up cobbling together:

#!/bin/bash
echo "$(date +%Y-%m-%d/%T): $@" >> ~/Dropbox/PlainText/Work/Work\ Log.txt

This produces a line like "2011-05-30/13:13:00: Testing script" when you enter "./work.sh Testing script" on a Terminal prompt. That's exactly what I want to log and putting it in that location syncs it automatically with Dropbox and makes it available to PlainText on the iPad and iPhone.

Now I just needed to make it easy to use from Alfred. I originally created a bash alias called "work" so I could just type "> work Test script" into Alfred. Then I discovered a helpful tip about a new Alfred feature: Terminal Shortcuts.

Settings for Alfred integration

It works like a charm!

[UPDATE (5/31/2011): This isn't the article I read, but it's good nonetheless.]

About this Archive

This page is an archive of entries from May 2011 listed from newest to oldest.

February 2011 is the previous archive.

August 2011 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Feedback to