a @UtilityLimb fortune
Wait What #
I love @UtilityLimb so much, as should anyone who likes funny things happening on Twitter. The collected tweets of the u-limb account are so great, and it's fun to browse through the collection. But I was thinking how nice it would be to just have a random one pop up. Almost every one of them is gold, so any one of them would do. Thankfully, the Unix environment has had the fortune
software for 30+ years, and as for finding a good time to show me a random @UtilityLimb tweet, why not every time I open a terminal window?
How #
If you wanted to do this too, you'd need some software:
brew install recode csv-fix fortune
recode
gives you the ability to translate HTML entities back into text. The wonderful csv-fix
performs all kinds of operations on CSV files. fortune
is, well, the software we'll use to display a (pseudo)random tweet.
The first thing I had to do, though, was get ahold of all of the u-limb tweets. Thankfully I knew that @bug_deal had an archive of them on his website Cool Tweets, so I got in touch with him and he was nice enough to deliver a CSV within the span of half a day or so.
With CSV in hand I set to work extracting the information I wanted from that file. I pretty much just needed the third field, which you'll see in my call to csvfix order
. Here's the command I'm currently using, although I probably need to tweak my recode
parameters to make it come out 100% correct:
mkdir -p ~/txt/fortune
mv ulimb.csv ~/txt/fortune
cd ~/txt/fortune
cat ulimb.csv | csvfix rmnew | csvfix order -f 3 | sed -e 's/^"//' -e 's/"$//' -e 's/""/"/g' | awk '{print $0,"\n-@UtilityLimb\n%"}' | recode h4..utf-8 | fold -s -w 80 > ulimb
strfile ulimb
At this point I have a ~/txt/fortune/ulimb
and a ~/text/fortune/ulimb.dat
, the two files needed by the fortune
command! All I have to do is add something like the following to my .profile so that it runs every time I log in:
echo
fortune ~/txt/fortune/ulimb
echo
And that's it! HUGE thanks to @bug_deal for the quick turnaround on the tweet archive. If you want these tweets, you can download my ulimb fortune file— you'll just need to run strfile
to make the ulimb.dat
index file, put both files in a directory of your choice, and point fortune
at it.
Of course, cowsay
is always good too: I'd love if someone made a cowsay format file that featured ASCII art of @UtilityLimb's userpic, but Stimpy will do for now:
fortune ~/txt/fortune/ulimb | cowsay -f stimpy
- Previous: Rock Music
- Next: Codex - a short playlist