measuring email inbox sizes

By , November 28, 2010 6:35 pm

Like many people, for a long time I have been drowning in email. I am perhaps bit unusual in that whilst my personal google inboxes are permanently overflowing, my work inboxes are generally very close to empty. This is because as a (bad) practitioner of GTD and sometime reader of Inbox Zero and similar sites, I do actually know how to get grips with email, and through professional pride apply the techniques fairly religiously when I’m working. In contrast, when it comes to dealing with personal mail, I’ll always favour procrastinating on some other interesting project instead. God forbid I should ever get my personal life in gear!

Well, this bad habit has been stressing me out for a LONG time now. I’m a long-term fan of Gretchen Rubin’s Happiness Project, and the other day stumbled across one of her older posts entitled Measure what you want to manage. I’d been wanting to graph the size of my inboxes over time, to get some grip on how bad my backlog actually is, and her post gave me the nudge to actually sort it out.

As usual, Ruby makes it almost ridiculously easy. There’s a beautiful written gem called gmail which uses IMAP to talk to your gmail account. So then it’s just a matter of writing a little program to append a line of gmail folder sizes to a CSV file every time it gets run:

#!/usr/bin/env ruby

require 'pathname'
require 'rubygems'

# sudo gem install gmail
# Note: this is an improved version of Daniel Parker's ruby-gmail
require 'gmail'

# sudo gem install fastercsv
require 'faster_csv'


CSV_FILE = Pathname(ENV['HOME']).join(
  "choose", "a", "path", "to", "gmail-counts.csv"

labels =, 'r').shift[2..-1], 'a') do |csv|
  Gmail.connect(USERNAME, PASSWORD) do |gmail|
    now =
    counts = [ now.to_i.to_s, now.strftime("%Y/%m/%d.%H:%M:%S") ]
    labels.each do |label|
      unread = label.gsub!(/ unread$/, '')
      folder = gmail.mailbox(label)
      count = unread ? folder.count(:unread) : folder.count
      puts "%s: %d (%d unread, %d read)" % \
        [ label, count, folder.count(:unread), folder.count(:read) ]
      counts << count
    csv << counts

Then create gmail-counts.csv in the folder referenced in the script, whose header line contains a list of the labels you want counted (append unread if you want the unread count rather than the total, and prefix “special” gmail folders with [Google Mail]/. Here’s an example of the header followed by a single line of folder counts:

epoch,datetime,INBOX,INBOX unread,[Google Mail]/Drafts,music

Then make sure the program is automatically run on a regular basis somehow. On Linux this is as simple as adding a new line into your crontab. My quietrun utility comes in handy for this:

0 6,12,18 * * * quietrun /path/to/script/count-gmail

Then you can use Google Docs or your favourite spreadsheet / charting application to plot some nice graphs. I used this script which is written in the Ploticus graphing language; here is the result:

sample graph of gmail inbox size over time


UPDATE 5 months later! (15th May 2011): I finally made it!


ideas in the shower

By , November 19, 2010 7:01 pm

Ever noticed how all your best ideas come in the shower? Well, this morning I had an idea in the shower … it was actually an idea about having ideas in the shower. I was thinking “I wonder how many good ideas I get here and then forget as soon as I walk out?”, and then the solution popped into my head – waterproof whiteboards!

After wasting a few more minutes under the showerhead concocting highly delusional visions of setting up ShowerBoards’R’Us® to patent, manufacture, and market this revolutionary concept, making zillions, and retiring earlier, I had breakfast, got to work, and promptly forgot about the idea … until later, when in an ironic twist which perhaps demonstrates its worthlessness, I remembered it again and did a bit more research.

So it turns out that it’s not a remotely original idea (hey I didn’t say that all ideas originating in the shower were good), and in fact it’s very well documented that the shower is conducive to fresh thinking. Mitch Ditkoff suggests 20 reasons why the best ideas come in the shower, although I have to say I can’t agree with #19 – “if you shower with a friend, and he/she happens to be in a brainstorming mode, lots of great ideas get sparked”. If I’m sharing a shower with someone, brainstorming is not going to be the top priority.

There are plenty more blogs on the same topic. Andy Hunt’s highly original book about the brain suggests that using involving multiple senses during problem solving activates more neural pathways, and quotes the example of one study which showed a 500% improvement for students using multi-sensory techniques. Clearly being in the shower activates different senses to sitting motionless staring at a monitor or book.

As a result, it’s not surprising to find that many people have already invented water-compatible solutions to this idea capturing problem. For instance, on the forum belonging to David Allen‘s Gettings Things Done (GTD) company, there is a whole thread which suggests ideas such as voice-activated dictaphones, scuba diving slates, waterproof notepads and zip-lock bags, even memory tricks such as mnemonics and visualization. One guy has even installed an entire office wall next to his shower, which is pretty hilarious. In fact there are so many waterproof notepads that I am going to have to buy one and spend a lot more time in the shower to have any chance of an early retirement…


Panorama Theme by Themocracy