Last week Dan and I were sitting down at lunch and we somehow got onto the topic of creating a website that just printed dots to the screen. As usual we got a bit carried away with the idea and decided that each dot could be an object and could be stored in a database and accessed through an API so that all created dots were stored for the future.
What began as a silly idea at the lunch table soon turned into a quick fun little project. Dan wrote most of the front-end code, I wrote most of the back-end API stuff, created the database, and registered a domain pointing to my VPS. We posted about it a fair bit over the weekend and it turned out to be quite popular among a couple of hundred people.
We hit our target of a million dots in a little over 2 days, and were both amazed it happened so quickly. Especially when you consider there is little-to-no reason for anyone to visit the site at all.
Anyway, we’re making changes to bits and bobs all the time at the moment. You can see the stats for your browser as well as the total on a new page, and there might be other little bits of analysis coming up in the future if we don’t get completely bored and do something else instead.
Create some dots.
I was getting bored of finding that several people I know (mostly you, 0lly :P) only bother tweeting if they stand a tiny little chance of winning a MacBook or whatever by sticking #moonfruit everywhere.
I decided to write a little command chain to show me how many of the most recent 200 tweets in my “friends timeline” contained the ubiquitous hashtag.
Turned out to be 9.5% of tweets. That’s damn near to 1 in 10 tweets being of absolutely no interest to me. Booooring! Here’s the command chain I wrote. I’m sure it can be refined plenty. I only use the XML API interface for Twitter because the JSON format doesn’t bother splitting results onto separate lines.
curl -s -u YOUR_TWITTER_USERNAME http://twitter.com/statuses/friends_timeline.xml?count=200 > /tmp/twitterlog.txt && echo -n 'scale=2; 100/200*' >/tmp/twittercount.txt && grep '#moonfruit' /tmp/twitterlog.txt | wc -l >>/tmp/twittercount.txt && cat /tmp/twittercount.txt && cat /tmp/twittercount.txt | bc
Obviously you’ll have to substitute YOUR_TWITTER_USERNAME for your actual username. You can also change the bit that says #moonfruit to anything else you want to search for. Oh yeah, this will prompt you for your Twitter password, but all communication is directly with Twitter, so you’ll be just about as safe as if you’d gone to the website. You’ll encounter a lot of problems if you try to run this in Windows, too. 🙂