Where’s the server? It’s under the table next to the couch!
The Raspberry Pi can be used for lots of cool projects, but because it’s cheap, small, and consumes far less power than a regular laptop or desktop, it’s perfect for applications where a computer needs to be running constantly, such as a server for running Twitter bots!
I have seven bots running at the moment, tweeting things like art assignments, “would you rather?” questions, and links from a 1995 “internet directory” book. Most of them post once an hour at varying times during the hour, meaning I need to run them from a computer that is always on, 24/7. I had previously used a Mac Mini, but it felt wasteful to have such a powerful computer that consumed so much energy, just to post 140 characters to Twitter.
By way of comparison, here is the energy use of a 2012 Mac Mini and a Raspberry Pi Model B:
| ||RASPBERRY PI (MODEL B)||MAC MINI (2012)
The Mac Mini also creates a lot of heat, even when not really doing anything. It’s average heat dissipation is 126 BTUs per hour, or the equivalent of 1/3 of a human!
Update: turning off video output (via RCA/HDMI) can save power consumption even more, especially for battery operation. Turn it off using the following command:
/opt/vc/bin/tvservice -off, though it may not work on your device.
That’s enough convincing: let’s run some bots!
Continue reading “Setting Up Raspberry Pi To Run Bots”
A very long list of tags at the end of a spam email. Preview below, full list after the break.
Continue reading “Spam Tags”
UPDATE 9/14: A few things have changed for setting up a Twitter application since this tutorial was written. The main change is you will need a phone number to register your app. Most of this guide should be fairly close to the current system, though the screenshots may look a bit different.
Creating Twitter bots, automated text-generators that spew spam, poetry, and other things, can be a bit of a confusing process. This tutorial will hopefully get you through the tough bits and make bot-building possible!
For this tutorial I will be using Python, a language whose simplicity and natural syntax is great for working with text. However, this tutorial should be easily portable to your language of choice. I assume you know at least enough programming to write your own algorithmic text; if you need some help, I would suggest one of the myriad resources including Learn X in Y Minutes. Finally, this post is written from a Mac user’s perspective – if you use another OS and have suggestions or required different steps, my apologies and let me know so I can add them.
If your programming is not up to snuff, you might consider using IFTTT to trigger a Tweet. While the range of possible text is much more limited, you can easily do things like post a Tweet when tomorrow’s weather is forecasted to be nice or you like a video on Vimeo! (You can also use this as a backup for storing your bot’s awesome Tweets.)
You can view the source files used here, screenshots, and other miscellany for this tutorial on GitHub.
Continue reading “Tutorial: Twitter Bots”
Another bot, released into the world today: @TweetRedactor takes a random Tweet from Twitter’s live “firehose” stream* and randomly redacts portions of the text.
* The “public stream” is a real-time snapshot of Tweets happening in real-time. While a tiny portion of the overall traffic on the site, the snapshot essentially gives a live random Tweet.
Yesterday I released three Twitter bots into the world:
- @wouldratherbot posts randomized “would you rather” questions, such as “Would you rather etch a hat or edit an acceptance?” and “Would you rather standardize an appellate or reject a counter?” – code for the bot here
- @randomchordbot generates all 40,920 chords in the first 5 frets of the guitar, one per hour (see an example at the top) – code for the bot here
- @artassignbot creates randomized art assignments and due dates anywhere between 10 seconds and 10 years from today, for example “Create a flipbook examining your relationship to food, due on Sat, Nov 22, 2014” and “Construct an etching examining the history of memory, due in 36 seconds” – code for the bot here