Finally, a usable calendar program

I have never managed to use my computer to manage my schedule. Most calendar programs are either too slow, too limited, too clunky, too ugly, or all of the above. Over the years, I have tried many (I mean many) calendar apps, but never found anything that I could continue to use consistently. The applications that came closest to what I liked were orage, which is a light calendar application for the Xfce desktop environment, and calcurse, which is a command-line based calendar application. Both had their strengths and weaknesses, but ultimately, did not fit into my work flow.

That is, until I tried remind+wyrd[1]. Remind+wyrd is similar to calcurse; both wyrd and calcurse are curses based calendar applications. The main difference is that wyrd is just a front-end. It leaves all the processing to remind, which provides a ton of features. And I mean a ton. This is best explained by an example, copied from the remind wiki (and slightly modified to be self contained).

The 4th of July is a holiday in the U.S. However, if it falls on a Saturday, the previous Friday is a holiday. If it falls on a Sunday, the next Monday is a holiday.

We can keep track of the independence day in US by adding the following code snippet to $HOME/.reminders.

REM 4 July SCANFROM [trigger(today()-7)] SATISFY 1

IF WKDAYNUM(TRIGDATE()) == 6
	REM [TRIGGER(TRIGDATE())] MSG Independence day (actual)
	OMIT [TRIGGER(TRIGDATE()-1)] MSG Independence day (observed)
ELSE
	IF WKDAYNUM(TRIGDATE()) == 0
		REM [TRIGGER(TRIGDATE())] MSG Independence day (actual)
		OMIT [TRIGGER(TRIGDATE()+1)] MSG Independence day (observed)
	ELSE
		OMIT [TRIGGER(TRIGDATE())] MSG Independence day
	ENDIF
ENDIF

Then, we get

$ rem -s2 july 5 2010 | grep 'Independence'
2010/07/04 * * * * Independence day (actual)
2010/07/05 * * * * Independence day (observed)

Now, can your calendar program do this!. If this does not impress you, how about calculating when a blue moon (two full moons in a month) occurs. Add this to your $HOME/.reminders

FSET isGood(date) \
           monnum(moondate(2, date)) == \
                monnum(moondate(2, moondate(2, date)+1))

REM 1 SATISFY isGood(trigdate())

set blue moondate(2, moondate(2, trigdate())+1)

MSG Next blue moon is [blue]

Then, we get

$rem | grep 'blue moon'
Next blue moon is 2012-08-31

I know. How often do you need to figure out the next blue moon. But the point is that remind is text based and programmable. I will not try to explain how remind works. Others have done a far better job than I could ever do.

For an overview of remind, see the article in the Linux Journal by David Skoll, the author of remind. Another excellent introductory article is by Mike Harris in 43 Folders. For a bit of a history of remind, see David Skoll’s presentation. There is also a wiki with some more information, especially, how to integrate remind so that you see a pop-up message for reminders. For me, just adding

rem -q

in my .zshrc is sufficient.


[1] I thought that the name wyrd was geek-speak for weird. I was close. Wyrd is the ancestor to weird. Google for more information on wyrd.

A color scheme for pdf output

While working on a TeX document I split the screen into two parts, an editor on the left, and the pdf on the right. I also use a dark color scheme for my desktop. The contrast between a dark colored editor window on the left, and a bright pdf preview window on the right becomes harsh on the eyes after a while. So I decided to have the same color scheme for the pdf as the rest of my desktop.

My ~/.Xdefault looks like this

*background:  #333333
*foreground:  #AAAAAA

and I wanted pdf to follow the same scheme. So, I first define these colors in ConTeXt

\definecolor[dullwhite][r=0.625, g=0.625, b=0.625]
\definecolor[dullblack][r=0.1875,g=0.1875,b=0.1875]

and then use them as the foreground color and background color

\setupcolors[textcolor=dullwhite]
\setupbackgrounds[page][background=color,backgroundcolor=dullblack]

The result is a pleasing (to me) and consistent color scheme.


screenshot

This is good for screen reading but not for printing. So, I wrap the whole thing around a start-stop mode.

\startmode[screen]
\setupcolors[state=start]
\definecolor[dullwhite][r=0.625, g=0.625, b=0.625]
\definecolor[dullblack][r=0.1875,g=0.1875,b=0.1875]

\setupcolors[textcolor=dullwhite]
\setupbackgrounds[page][background=color,backgroundcolor=dullblack]
\stopmode

Now, when I need to preview on screen I can run

texexec --mode=screen filename

and when I need to print I can leave the --mode=... part off.

Pacman, don’t eat my disk space

I run Arch Linux on my laptop that has a 100GB disk with a 15GB partition for /, a 15GB partition for /opt and the remaining 70GB for /home. Recently I ran out of disk space on /. First I thought that this was due to a huge browser cache (in opera, my temporary download directory is set to /tmp/opera/downloads which can get really big). Clearing up the /tmp did not help, and I went on a wild goose chase of figuring out which directory was hogging disk space. The culprit: /var/pacman/cache/pkg.

pacman, the arch package manager, keeps a cache of all packages it downloads! Over the last year or so that I have been running Arch, this directory had become huge, taking over 5GB of space. I do not want a cache of all package that I ever downloaded. I bit of hunting through the man pages revealed the right options.

pacman -Sc

which removes all the uninstalled packages from the cache. After that, /var/cache/pacman/pkg is at a bearable 2.5GB. I also learnt that if I ever need more disk space, I can run

pacman -Scc

which will remove all packages from pacman cache.