Posted on Tue 24 September 2013

Counting registrations for

GeoBeerCH is an effort by Ralph Straumann and yours truly to foster the networking inside and outside the geo-community in Switzerland. You can read more about GeoBeerCH in our manifesto. When we announce our events, we offer a Twitter-based registration on and by e-mail for the Non-Twitterers among us.

Obviously, it's nice to know how many people actually registered. In the past, we've looked at and went through our mails to add it up. But with dozens of registrations, this becomes tedious. In a midnight hack, I came up with the following naïve solution:

  1. Forwarding registration mails to an automated task at Zapier, which adds a row to a Google Spreadsheet. Then, with the Python library gspread, it's a matter of three lines to access the number of rows in the spreadsheet (seemed easier to me than using the admittedly cool sheetsee.js)
  2. Getting the number of Twitterers from with a simple webscrape (using BeautifulSoup).

The numbers will be updated every 10 minutes and are stored as a json object on our server. The front page picks it up and renders the current numbers. As a distraction bonus, I push new registrations to my mobile device using Pushover.

Here is the resulting Python code:

This is an example of one of my quick midnight hacks, that I just couldn't resist. Looking at my bad code and huge pile of much more important tasks, I'm actually glad my family is usually succesful in minimizing the number of my hacking sessions.

Category: misc

Comments: toggle

© Stephan. Built using Pelican. Theme by Giulio Fidente on github. .