* * * * * Stupid Twitter Tricks An off-site meeting was canceled, although I didn't find out about it until I got off-site. Afterwards, I slacked off a bit. Okay, quite a bit. I came across this post [1] on one of the blogs I follow, and I was mesmerized. Not by the the actual post but by the often times totally irrellevent picture John Wiseman adds to his posts. And in this case, it's a portion of a screen capture of a Twitter-based site [2], and John's comment about said picture: “Jenny Holzer is the only person who should be allowed to use Twitter.” Jenny's site [3] reads like surreal fortune cookies, much like the monster quote file I have (over 2,600 quotes). I've seen Twitter once or twice; enough to get the point of it—it's LiveJournal [4] on crank [5], but something about Jenny's site reminding me of my own monster quote file inspired me to do a “Stupid Twitter Trick™”— sending out my quote file via Twitter [6]. Two aspects of this little hack (and that's what it is, a gross hack if you ask me) were time consuming. First, cleaning up my monster quote file. Twitter limits you to 160-character messages (with a preference of 140 characters). Three custom programs for this—one to pull out quotes 160 characters or less (and to mark the 140^th character). The second one to trim unwanted spaces. And the third to go through converting the quote character from the unappealing " to the much more typographically nice “” pair. Extensive use of sed to make some other typographical substitutions (such as converting “--” (two dashes) into “—” (a proper em-dash)) and a visual once- over to make sure I didn't muck things up, and an hour or so later, I have almost 2,000 quotes ready for Twitter. The second time-consuming bit was writing this bit of code, which took about an hour: > #!/usr/bin/perl > use strict; > use Net::Twitter; > > my $later = `./later`; > my $message = `./quote -n`; > my $twit = Net::Twitter->new( > username => 'siwisdom' , > password => 'XXXXXXXXXXXX'); > my $result = $twit->update($message); > > `at -f ./at-jobs $later`; > > exit 0; > And no, it didn't take an hour because I'm a slow typist. It took an hour because to install Net::Twitter [7] I needed to install JSON::Any [8], and in the process of installing that I apparently activated the CPAN [9] module that wanted to install and update itself, and that took an hour (I swear, it seemed to download the entire CPAN archive—sigh). The later program picks a random amount of time between three and nine hours, which is given to the at command. at is like cron, in that you can schedule a program to run at a particular time, but unlike cron, which runs the program on a set schedule, at is a one-shot deal. I use at because I don't want a set schedule to post quotes to Twitter—I want it randomized a bit. quote is a program I wrote ages ago to pull quotes out of a quote file sequentially. Like I said, a quick hack for a stupid Twitter trick. Oh, and the name? “siwisdom”? It's short for “silicon wisdom,” as a pun on Jorn Barger's Robot Wisdom [10], if you will. [1] http://lemonodor.com/archives/2007/07/powerset_antihype.html [2] http://twitter.com/ [3] http://twitter.com/jennyholzer [4] http://www.livejournal.com/ [5] http://www.secondchanceinc.com/CRANKTHEWORKINGMAN'SDRUG.html [6] http://twitter.com/siwisdom [7] http://search.cpan.org/~cthom/Net-Twitter-1.04/lib/Net/Twitter.pm [8] http://search.cpan.org/~perigrin/JSON-Any-1.08/lib/JSON/Any.pm [9] http://www.cpan.org/ [10] http://www.robotwisdom.com/ Email Sean Conner at sean@conman.org .