Busy, busy worker bee

You might have noticed that most of the work I’ve put into the blog lately has been to the end of promoting Geek Girl Con. This post is no different, save for a bit of complaining.

Honestly, I haven’t had much time for blogospherics lately, as work has had a series of disasters that I’ve had to mitigate, so I’ve been working my ass off. I’ve been venting my frustrations about current real-world events on Twitter in short form, because that seems easier to handle in the midst of jumping from one crisis to another with work, but the blog has lain fallow for too long, so I decided to cross-purpose a bit of work I did today. Why use something you’ve done once, when you can use it twice?

At Geek Girl Con, I’m going to be working in the DIY Science Zone, teaching a thing or two about randomness, especially as pertains to dice. I’ll be performing a few demonstrations of how humans don’t really grok randomness, including one where I’ll get people to draw fifty random dots on a piece of paper. I’ll then compare them to a better (though still not perfect) pseudo-random generator, a computer.

Then I’ll go on to talk about how this universe is deterministic and randomness really isn’t all that random no matter what we do to generate it, and pretend to be all smart and stuff. We’ll see how that works out.

I’ve written a little Python script to help with the first demonstration I mentioned above. Here it is. It uses the fairly standard Pygame init > run > terminate main loop you might see in other examples.
Continue reading “Busy, busy worker bee”

Busy, busy worker bee

Pentametron creates sonnets out of users’ tweets

This is certainly a lot better use of a Twitter bot than most. It’s just the sort of high-concept bot I would love to do, if only I had a decent idea for one. And I bet it’ll irritate real poets, like Cuttlefish, for its (present) flaws.

Creator Ranjit Bhatnagar built, in PHP, a script that searches Twitter’s millions of tweets an hour for any and all tweets that match iambic pentameter scansion, finds rhyming couplets, and compiles them together into a sonnet. And considering the source, there’s some amazingly deep stuff! For instance:

still haven’t eaten anything today…
Have had a lotta nicknames growing up
BOO Chelsea !! Liverpool deserve the cup !!
Blue is the Color, Football is the game…

Fame of the money, Money of the fame.
Do not appreciate the referee.
So many babies at the outlet mall

Abundant Life Assembly welcomes all! 😀
Its fucking hailing! Hail! In fucking May!
im shirted up… and ready for the day!
Tomorrow Baby Steps and Twinkle. O/

I was invited to the city tho :)))))
i Hit the mall and spend a G today .

See!? Civilization has totally achieved its purpose, the world can end now.

Continue reading “Pentametron creates sonnets out of users’ tweets”

Pentametron creates sonnets out of users’ tweets

Python Twitter-bot Framework

I’m working on a Twitter bot to be used for the upcoming episode of Mock The Movie this Thursday, and I have every intention of participating as often as humanly possible, if not the least way by running this bot when necessary.

If you’re a Python developer and are interested in building a Twitter bot, go get Tweepy and feel free to start with this framework. You’ll need to register your application with Twitter first, of course. Read the Twitter OAuth FAQ for more details.

The code for authenticating against Twitter was originally borrowed from Nessy’s Blog, but the site design that Nessy was regex’ing against to try to scrape the auth tokens out of has since changed. I’ve updated it, and included caching these tokens in plaintext files in the program folder. Nessy’s code will only run the first time.

Additionally, my bot will work in daemon mode, performing work every so many seconds according to the configuration of the iterationtime variable. You end it by hitting Ctrl-C.

To get started, enter your application consumer_key and consumer_secret, as well as the username/password for the account you’d like to connect it with. Put all the actual work you’d like to perform at the bottom, where marked with a comment. The Tweepy API specifications are very well documented, but if you’re having specific problems, I might be able to help. By the time anyone reads this and gets to that point, I’m sure I’ll have my own bot done. Good luck! Code below the fold.
Continue reading “Python Twitter-bot Framework”

Python Twitter-bot Framework