Adam Wolfe Gordon <>
Hosted at Linode
Design by Minimalistic Design
Powered By Loathsxome

21 November 2011

Using Exchange Effectively on Linux

I've just started a new job at a company that uses Exchange for email et al. Exchange works pretty well with Outlook on Windows, and the web UI is pretty good in Internet Explorer, but if you want to use Linux it's a bit trickier. But, I think I have everything working to my liking now, so I thought I should post what I did.

Specifically, the problems to solve with Exchange on Linux are:

  1. What to do with email, especially given that I only really like using Gmail.
  2. What to use for calendaring, with bonus points if it syncs to my Android phone.
  3. How to access the company address book, for email recipient completion.
  4. How to do all this without storing passwords in plaintext.


Email is pretty easy: Exchange exposes IMAP, so I use offlineimap to fetch it, and then index it with notmuch. Notmuch approximates Gmail better than anything else I've seen, and the Emacs interface works well.

My offlineimap config is very plain: it just synchronizes every two minutes. There are only two customized things: a post-sync hook that imports mail into notmuch and tags it, and a python script that fetches my username and password from gnome-keyring. The python script is based on one from Carsten Clasohm, and on his page you will find an accompanying script to add your passwords to the keyring. The only addition I've made is a main method that lets us fetch the username and password; we'll see later why we want this.

I use a special .emacs for notmuch. I start Emacs using an alias: emacs -q -l $HOME/.emacs-notmuch -f notmuch, which loads the config and starts the notmuch module. A few notes on the config:


Google actually has a tool that syncs your Outlook calendar with your Google Calendar. It does require that you have Outlook running, so you'll need a Windows VM and a registered Outlook. If you're willing to do that, it's the perfect solution: your calendars get synced, and since your Exchange calendar events are on your Google calendar, they'll show up on your Android phone.

Address Book

Tab completion from emails that are already in your notmuch database is easy: just use Sebastian Spaeth's addrlookup (hint: check out the static-sources branch if you don't want to compile Vala code). However, I wanted to have tab completion of the whole company directory, not just people I've emailed before. This involves three steps.

Step 1: Setup DavMail to provide LDAP access to the Exchange address book. The trickiest part of this was figuring out how to setup DavMail nicely. The best way I found was to use the EWS URL (e.g., NOT the OWA URL that most of the DavMail docs refer to. You can tell DavMail it's talking to EWS with the davmail.enableEws=true config line.

Step 2: Make something talk LDAP to DavMail. I started with the old script, but made some changes. In particular, this uses my script to fetch my credentials, and changes the criteria a bit to work better with DavMail's LDAP implementation.

Step 3: Integrate the LDAP script with the notmuch script to search both places. This is my address-lookup script. It searches notmuch, and if it doesn't find anything then it searches LDAP; this keeps it fast for the most-contacted people. To facilitate this, I made some changes to addrlookup so that it returns the number of results it finds.

That's All!

Not so bad, eh? I hope this will help other people deal with Exchange in a sane manner.

link -- [exchange, linux, email]

06 August 2011

Time Tracking With Timebook

Since I now have a real job, where I will eventually need to estimate how long various tasks will take me, I decided it would be wise to start tracking my time. I'm using a program called Timebook, which is a little Python script that uses a sqlite3 database. It's nice because the commands are pretty simple, and if I forget to t in or t out, I can go and edit the database to fix things up.

Inspired by a zsh completion module I found for tmux, I decided to write a zsh completion module for Timebook, available here. It completes all the Timebook commands, as well as timesheet names in appropriate places, and options to the few commands that take them. To use it, put it in /usr/share/zsh/functions/Completion/Linux (there is probably somewhere else zsh will look for it, but I'm not sure where). Note that if you call your Timebook executable something other than t, you will need to modify the script.

link -- [software, work]

02 December 2010

Markdown for Loathsxome

Since I started using werc, I've become a bit enamored with Markdown. So, I figured I'd set it up for my blog, too. It already has a Blosxom plugin, so it was very quick to make it work with Loathsxome.

You can download it here. To use it, move the file to plugins/markdown in your Loathsxome directory. It should probably run last, so you might need to rename it. This is because it formats the body of the post, which can screw up meta tags and things that are grabbed by other plugins.

link -- [meta, loathsxome]

The Not Insane Guide to Setting Up werc

I used to maintain my website using plain old HTML files. That works fine, considering how small my site is, but I decided a CMS would be nice, and I decided werc was probably the way to go. Werc is to CMSes what Loathsxome is to blogs. It uses plain files and directories instead of some silly database. It's also written in rc, the plan9 shell, which is kind of neat.

The downside of werc is that it doesn't have a simple HOWTO or tutorial for setting it up. So, here's a quick-and-dirty version:

  1. Download werc from the website, and un-tar it somewhere.
  2. Follow their web server setup instructions for your web server. I use lighttpd, and the instructions worked fine.
  3. Create a directory sites/ for your website to live in, but only if the domain of your website is actually This is where I got caught up: I was hitting the site as, but my directory was called, so nothing showed up. When I symlinked to, it worked!
  4. Edit, which will become your homepage. If you edit, it will be visible at If you edit bar/, it will be visible at
  5. If it's not working, make sure the permissions are right on everything. This caught me a couple times.
  6. To change how it looks, edit the templates in lib/ and the stylesheets in pub/styles.

That step 3 cost me a lot of time. Watch out for it.

link -- [werc, meta]

04 November 2010

Think of the Children

From Malcolm Gladwell's The Tipping Point:

The best analogy to this kind of epidemic is the outbreak of food poisoning that swept through several public schools in Belgium in the summer of 1999. It started when forty-two children in the Belgian town of Bornem became mysteriously ill after drinking Coca-Cola and had to be hospitalized. Two days later, eight more schoolchildren fell sick in Brugge, followed by thirteen in Harelbeke the next day and forty-two in in Lochristi three days after that - and on and on in a widening spiral that, in the end, sent more than one hundred children to the hospital complaining of nausea, dizziness, and headaches, and forced Coca-Cola into the biggest product recall in its 113-year history. Upon investigation, an apparent culprit was found. In the Coca-Cola plant in Antwerp, contaminated carbon dioxide had been used to carbonate a batch of the soda's famous syrup. But then the case got tricky: upon examination, the contaminants in the carbon dioxide were found to be sulfur compounds present at between five and seventeen parts per billion. These sulfides can cause illness, however only at levels a thousand times greater than that. At seventeen parts per billion, they simply impart a bad smell - like rotten eggs - which means that Belgium should have experienced nothing more than a minor epidemic of nose wrinkling. More puzzling is the fact that, in four of the five schools where the bad Coke allegedly caused illness, half the kids who got sick hadn't actually drunk any Coke that day. Whatever went on in Belgium, in other words, probably wasn't Coca-Cola poisoning. So what was it? It was a kind of mass hysteria, a phenomenon that is not at all uncommon among school-children. Simon Wessely, a psychiatrist at King's College of Medicine in London, has been collecting reports of this kind of hysteria for about ten years and now has hundreds of examples, dating back as far as 1787, when millworkers in Lancashire suddenly took ill after they became persuaded that they were being poisoned by tainted cotton. According to Wessely, almost all cases fit a pattern. Someone sees a neighbor fall ill and becomes convinced that he is being contaminated by some unseen evil - in the past it was demons and spirits; nowadays it tends to be toxins and gases - and his fear makes him anxious. His anxiety makes him dizzy and nauseated. He begins to hyperventilate. He collapses. Other people hear the same allegation, see the "victim" faint, and they begin to get anxious themselves. They feel nauseated. They hyperventilate. They collapse, and before you know it everyone in the room is hyperventilating and collapsing. These symptoms, Wessely stresses, are perfectly genuine. It's just that they are manifestations of a threat that is wholly imagined. "This kind of thing is extremely common," he says, "and it's almost normal. It doesn't mean that you are mentally ill or crazy." What happened in Belgium was a fairly typical example of a more standard form of contagious anxiety, possibly heightened by the recent Belgian scare over dioxin-contaminated animal feed. The students' alarm over the rotten-egg odor of their Cokes, for example, is straight out of the hysteria textbooks. "The vast majority of these events are triggered by some abnormal but benign smell," Wessely said. "Something strange, like a weird odor coming from the air conditioning." The fact that the outbreaks occurred in schools is also typical of hysteria cases. "The classic ones always involve schoolchildren," Wessely continued. "There is a famous British case involving hundreds of schoolgirls who collapsed during a 1980 Nottinghamshire jazz festival. They blamed it on a local farmer spraying pesticides." There have been more than a hundred and fifteen documented hysteria cases in schools over the past three hundred years."

Nowadays, of course, it's not demons and spirits or toxins and gases, it's radio waves.

link -- [idiocy]