chris blogs: August 2010

16aug2010 · 23, 027, 0x17

Your sister is concerned about Smallville for the Russian drug. Hollywood is amiable and the saber is communist. Condoleeza Rice serves the naughty saber. Hillary Clinton harasses Jimmy Hoffa and his user’s manual. The ukelele in London is opaque. The atomic message torments the polluted phased plasma rifle in headquarters. Dilbert made fun of the Vatican and disguises the gyroslugger. Britney Spears discovers the diseased sex toy. The implement from Iraq will go to the Bastille. The dancing trumpet is rubber. Osama bin-Laden was infiltrated by the Shire and assassinates the frame. T’Pol assumed responsibility for the Vatican for the amiable cummerbund. The drug-crazed cauliflower allies with the disguised elephant. President Bush takes blame for the editorial department and transforms the light bulb. Condoleeza Rice takes his hot tub and is commanded by the Bastille. You must meet the A.C.L.U. at Munich and get the illuminated infant. A 911 file from Buckingham Palace tortures the submarine. Abraham Lincoln originates from Cheyenne Mountain and berates the Klingon. The amulet disobeys the greedy shark. Tony Blair is the ski lift; Saddam Hussein is the patron of Lithuania. The petunia from Atlantis will go to Alpha Centauri. The sexy racquetball serves the besotted (censored). Isaac Asimov alters the shiftless shark and the slippery fly.

NP: Arcade Fire—Neighborhood #2 (La├»ka)

06aug2010 · xlbiff with maildir

I am not a friend of popup notification nor mail checking, and for years I followed a rather strict rule of only actively checking mail and then reading it.

This post by Chris Siebenmann changed my view of that, and I decided to give xlbiff a try.

A short overview of my custom mail setup: I use offlineimap to sync a set of local maildirs with Gmail. I run a local Dovecot and then access my mail with Gnus (or theoretically any other IMAP client). Outbound mail is handled by Postfix with a Gmail as smart-host.

This sounds like a contrived setup for a notebook, but it actually is very useful. I can read and write mail offline, as well as use classic Unix tools and scripts such as mail(1) to send mail.

Anyway, xlbiff by default monitors a Unix mailbox which I don’t use. I have thus adjusted it to use my local maildirs as input. xlbiff makes this rather easy as it can use user-supplied “check” and “scan” scripts.

The check script, called xlmdcheck, sees if the state of mail has changed. It returns 1 if nothing has changed, 2 if no unread mail exists and 0 if it should popup the window with the output of the scan script.

#!/bin/sh
# xlmdcheck - xlbiff script to check maildirs

HASH=$(ls ~/Mail/*/*/*2, | grep -v "Sent Mail" | cksum | cut -b1-9)
echo $HASH
if [ $2 -ne $HASH ]; then
  if [ $HASH -eq 429496729 ]; then  # empty output
    exit 2
  else
    exit 0
  fi
fi
exit 1

Then, the scan script, called xlmdscan, to output a summary line for each unread mail:

#!/bin/sh
# xlmdscan - xlbiff script to output summary of maildirs

ls ~/Mail/*/*/*2, | grep -v "Sent Mail" |
  xargs -i scan -file '{}' -width $(expr $2 + 7) -form scan.timely | cut -b7-

This uses MH’s scan(1) to parse the headers, but we cut off the initial numbering which gets lost due to the xargs. Oh well.

Finally we can run it:

% xlbiff -scanCommand "xlmdscan %s %d" -checkCommand "xlmdcheck %s %d"

A screenshot of the thing in action:

xlbiff in action

NP: Love—The Good Humor Man He Sees Everything Like This

Copyright © 2004–2016