WildBill's Blogdom

Mongo only pawn, in game of life.

How I Did My #FollowFriday Flood on Twitter

| Comments

I’ve had a few people ask me how I did the #FollowFriday flood on Twitter the other day. I was continually spitting out #FF recommendations on people to follow at the rate of 4 per hour, for nearly 24 hours. Obviously, I wasn’t at my computer keyboard grinding these things out. I’d had the list pre-prepared, and I replaced myself with a small shell script and a rather large Perl program to get this done.

Now, I’ve got to preface this by saying there’s a lot of services out there on the web that can automatically schedule tweets via a webform for you. I didn’t necessarily want to do that – not only did manually scheduling a time for each tweet sound tedious, but I didn’t want to give OAuth rights to yet another entity on the internet.

Enter the Linux command line here, and the Perl program known as TTYtter. I’ve been using TTYtter for a while now as a Twitter client when I don’t want to context-switch to a GUI (I’ve been head-down in a bash shell for weeks now), and I knew that TTYtter could be called via a one-shot command line.

So, what I did was write a very tiny shell script wrapper around TTYtter that simply calls TTYtter in a loop every so often, reading in one line from a file as a tweet each time it runs. This let me prepare a text file that had a tweet per line, and that was rather easy to put together when I sat down and knocked it out.

Then all I had to do was a little after midnight on Friday was fire up a screen session, run my shell script, and detach. I ran this from an Amazon cloud VM so I didn’t have to worry about it not finishing. I also put the whole thing in my Dropbox directory so I could edit it or work on it from anywhere.

It worked great. :)

Here’s the shell script around TTYtter, in the event one of you wants to do the same thing.


# Let’s set a sleep time between tweets (in seconds)


# Set our OAuth Key


# Set our path to TTYtter


# Set our FollowFriday tweet file


# Now do some stuffs!

while read line; do $TTY_BIN -ssl -keyf=$OAUTH -status=”$line”; sleep $SLEEP_TIME; done < $FF_FILE

Remember to use your powers for good, not evil, kiddos.