How (and Why) I Wrote My First Twitterbot

This week, I wrote my first twitterbot.

For a while, I’ve been interested in Twitter robots – not spambots that auto-follow everyone who mentions Justin Bieber, but those that do something interesting with language or online data, such as Metaphor-a-minute, which uses the Wordnik API to generate random metaphors, or Library of Aleph, which tweets captions (without the photos) from the Library of Congress’s photo collection.

I’ve wanted to create a twitterbot, but didn’t think of an idea until this week while listening to one of my favorite songs, Elvis Costello’s “(What’s So Funny ’Bout) Peace, Love, and Understanding?”, and about to tweet (for the 2nd time) my favorite lines:

So where are the strong?
And who are the trusted?

It struck me that questions found in song lyrics could make a good Twitter account. Questions in song alternate between the profound:

– and the ridiculous:

A single line from a song can also be rich in memories and connotations. I now had my idea for my twitterbot.

How I Wrote It

There are a ton of “how to” options online. Because I want to learn more about Node.js, I chose this tutorial from Christian Paulsen to create the basic structure and functionality of the twitterbot.

Next, I needed questions. I put out a call on Facebook for my friends’ favorite questions from songs and ended up receiving more than 150 suggestions. I put all these into a text file and created a script that selects a random line and posts it on Twitter. If you’re interested in this sort of thing, I put the script on Github.

To automate posting the questions to Twitter, I downloaded LaunchControl, a small utility that lets you create and edit automated tasks on a Mac. Technically, LaunchControl just provides a GUI for Mac’s launchd process – see more here – but it makes launchd’s fairly confusing format much more readable. I have the script scheduled to run every three hours at the moment.

This process isn’t perfect – it runs whenever our computer is being used, but not if it’s asleep or off. So one of my next steps is to convert an old Mac into an always-on home server that can (among other things) run the Twitterbot 24–7. I’d also like to make the posting a bit less random by avoiding repeated questions too frequently or grouping some multiline questions together.

Overall, the project was very fast (started on Thursday night, finished by Saturday morning) and tremendous fun, and I’m collecting ideas for other bots. I’d like to try pulling texts from an API or a public domain source (Book of Common Prayer, perhaps?) for my next one.

Oh, and be sure to follow Lyrical Questions on Twitter.

Save Time in Your Job Search with TextExpander

TextExpander from Smile Software

TextExpander from Smile Software

When you’re applying for jobs, you find yourself entering the same information into online forms over and over again: work history, contact information, names, etc. A few forms allow you to import information from an uploaded resume or from your LinkedIn profile, but even these don’t always get all of your details correct. It isn’t easy to stay motivated during the job search, and entering the name and phone number of your supervisor from seven years ago for the 50th time doesn’t help any.

This is where I use TextExpander to save time and stay focused.

What is TextExpander?

TextExpander does what its name says: expands text. At the simplest level, the program allows you to create custom shortcuts — called snippets — for text that you have to type repeatedly. For example, I have a snippet for my cell phone number. I can type:

ccell

anywhere I need to type my cell phone number, and TextExpander changes the string into my number. Not only is “ccell” shorter than my 10-digit number, but it also takes less time to type on my non-number pad-equipped Macbook.

There are more advanced features — I’ll cover one of them below — but you can read more at the TextExpander website.

Note: TextExpander is a Mac-only program, though there is an iOS version for iPhone and iPad. There are similar programs for Windows, and if you use one that you recommend, tell me about in the comments.

Basic Examples: Work History

How does this work in practice? Let me share a couple of actual examples that I use for entering my work history. Perhaps this is more helpful to me than to other people, because I have a history of long job titles at organizations with long names. Let’s take one of my former positions as an example: Director of Foundation Services at the Cincinnati Better Business Bureau.

When I type:

.cbbb

TextExpander expands it to “Cincinnati Better Business Bureau.” (The period at the beginning is a trigger that distinguishes the Snippet from the initialism CBBB.)

A couple more common snippets related to my CBBB position. The following two:

.cbtitle
.cbphone

expand to “Director of Foundation Services” and the CBBB’s main phone number, respectively. You get the picture. Snippets can expand to much longer text, too, so I could create Snippets for the CBBB’s address, my job description there, or even my full resume.

Advanced TextExpander: Cover Letter Templates

Now for a more advanced example. One of my deep dark shames is that I hate writing cover letters. Actually, that’s not quite accurate. I really don’t mind writing one cover letter, but by the third or fourth or twentieth, I’m a bit weary of the procedure. So I’ve created a cover letter snippet that saves me a great deal of time and mental energy. All I have to do is type:

.coverletter

and a small pop-up window appears.

TextExpander Window

Click for a clearer image.

Notice the blanks in the text. This is a generic cover letter, with spaces for the address, salutation, and some custom language about my experience and expertise. (Today’s date is automatically generated by TextExpander.) When I’ve filled in the blanks, I click “OK,” and the new text is inserted into whatever program I’m using.

I’m still not done with the cover letter, as this is only a template to help get me started. But the hard work of getting to a first draft is done. Now I can revise, reword, and craft the cover letter to fit the specific position, much faster and much more easily that if I were starting from scratch each time.

TextExpander is one of the three apps I immediately install on a new Mac. It syncs with Dropbox, too, so that my snippets travel with me from computer to computer. TextExpander offers several pre-defined snippets (e.g. special characters, HTML coding), and smart people like Brett Terpstra and David Sparks have created bundles of TextExpander snippets that are much better than anything I could come up with. TextExpander also allows scripting within snippets, enabling even more powerful shortcuts. One of my current favorites is a script snippet from Brett Terpstra that pastes in the current URL from Safari.

Do you have any tips for speeding up job applications? If you use TextExpander, do you have any favorite tricks?

Scrivener

I have just started reading Andy Crouch’s new book Culture Making, and, for some unknown reason, I decided to start at the back, in the acknowledgments. Among the people thanked:

Keith Blount, an unapologetic English atheist, [who] created the marvelous cultural artifact call Scrivener, a program which justifies the existence of the Macintosh computer all by itself and which made completing this project an unexpected joy.

Amen, brother. Amen.