How to Tweet Automatically With a PHP-OAuth Twitter Bot


UPDATE: I did this better in Python here

One day I tweeted “Treme & Engineering – Fight Club & Anti-Consumerism,“ and was immediately answered by a Twitter account IAmJacksBot whose user was “Tyler Durden.” After looking at this Twitter account, I realized it was run by a computer program that searched recent tweets for the words “fight club” and simply responded to them with a random quote from the movie. Needless to say, this is pretty awesome and inspired me to do the same with some of my favorite television characters.

I’ve set up a Jimmy McNulty Twitter bot. For those of you who haven’t seen The Wire, which is only the best television series ever, McNulty is an insubordinate Baltimore police detective who gets on everyone’s nerves. He’s an alcoholic, adulterer, womanizer, irresponsible father, and an all around asshole, but you gotta love how he pursues tough criminals so tenaciously.

My McNulty bot tweets an arbitrary quotation from the show every three hours. So how can you set one up?

Economist Python Web Scraper


Here’s a Python web scraper that gives you the full print edition of The Economist for free. Or you could go to their print edition that’s online and reject their cookies.

Public Speaking: Get Noticed at Your Workplace


If you’re at your first job after college, I have important advice for you. If you get a chance to speak or present to a large audience at work, take it. I cannot overstate the significance of skills like public speaking, rapport-building, and simply getting noticed.

When I stand in front of a group of more than five people, I become nervous. My voice shakes, I talk too fast, I don’t maintain eye contact. But if I prepare just a little bit beforehand, my performance improves dramatically. Here are some simple but often overlooked points for delivering effective and coherent public speeches.

How to Convert HTML Character Codes Into Unicode


I’ve improved my Python New York Times web scraper that extracts the global home page’s top articles. The latest version doesn’t clumsily replace HTML character codes like “é” with “é”. I wondered if there was a way for Python to convert it. It turns out there is.

Here’s the trick:

Why I Like Python More Than Perl


Update: After programming more and reading this post again, I realize I was still a noob when I wrote this and titled it “Why Python Is Better Than Perl.” Languages are tools. Tools are not objectively better or worse than others. It depends on the task.

A month ago, I began learning Perl. Two days ago, I began learning Python. I’m already a convert.

Python makes programming fun. It’s more readable, doesn’t have funky $, @, % symbols everywhere, and whitespace like tab and return handle program logic so that I can stop worrying about semicolons and curly braces. In addition, Python seems to be more widely favored by natural language processing researchers. There are quite a few at my workplace, and as a Perl user, I couldn’t communicate with them at all. They’d speak Python while I’d be blathering in Perl. In order to tap into the NLP community and all the NLP goodies (like this), I switched to Python to the dismay of a systems administrator (click here if you have no idea what that is) and Perl-loyalist who sits near me at work.

Despite the similarities between Perl and Python regular expressions, a way of matching text, I still favor Perl’s. But my Python translation of my Perl script that web scrapes the New York Times is only half the length and more understandable for humans. The Perl script runs twice as fast, but that’s something I can live with.

Now I can relate to this xkcd comic.

Amazon Kindle 3 Pros and Cons


I bought Amazon’s Kindle 3 a week ago and have read a mix of plain text files and PDFs (Edgar Allen Poe short stories and math textbooks). Last time, I wrote about my initial satisfaction, and a week later I’m still happy with the reading experience. The electronic ink doesn’t strain my eyes, page turning is fast, and the choice of fonts and page orientation is suitable. The Kindle renders PDF files well if you orient the page layout to landscape instead of portrait. You can see the page in close to normal size this way.

Why You Should Learn Perl and How to Install Modules Without Headaches


I’ve become a fan of the computer programming language Perl after my friend who majored in computer science recommended learning Perl over Python a month ago. For the longest time, however, I was getting pissed off trying to use it on my Mac.


Perl is a high-level computer language nicknamed the “Swiss Army chainsaw of programming languages” for its flexibility and adaptability. It can collect Edgar Allen Poe short stories from the Internet, calculate the similarities between them, and store that information in a database. Perl is free and is supported by tons of how-to books and online tutorials (e.g. here, here, and here). You don’t have to be a computer geek to learn Perl. You’d probably think of new applications for Perl by approaching it from a non-technical standpoint.

Now that I’ve convinced you to learn Perl, how do you get started?

I’m Sticking With WordPress’ Thematic Theme


I’m going to keep my Thematic WordPress theme. Nothing beats its simplicity and minimalism. It’s so crisp and clean. I don’t put up many photos or non-textual media, and Thematic lets readers focus on the writing. I just can’t find anything I like better.

I’d like to thank Ian Stewart for Thematic, which you can download here. I’ve modified Thematic on both my blog and my homepage by setting up a child theme that inherits properties of its parent.

Child themes allow you to tweak the design and look of your WordPress blog by overriding the properties the parent theme sets up. So why would you want to do this instead of directly altering the parent? If your theme is updated and you download that update, all your modifications will be erased. But if you have a child theme, they’ll be preserved since they’re in a separate file.

Here are some good places to learn about creating your own WordPress child theme.