Jeff Epler's blog

20 May 2013, 21:37 UTC

tardiff: diff two (compressed) tar files without extracting

Recently I was googling for a script to compare tar files, and found references to a perl script (which I did not read) which reportedly did this by expanding both tar files and then diffing the trees. This would actually have been fine for my case, but some people noted that their use case involved tarfiles that were too big to extract comfortably. I assume that this is due to space considerations, but doubtless there are time considerations too.

read more…

4 April 2012, 12:54 UTC

dusub: Subtract two 'du'-style listings

Life is a constant war against the limited size of backup media. Here is my next weapon in the fight: dusub. Save a du listing today, then find out tomorrow or next week what's been growing:
dusub olddu newdu
du … | dusub olddu
Positive numbers in the output represent an item that grew since olddu; negative numbers represent a decrease in size since olddu.

Version 2 knows about "du -h"-style listings.

dusub is useful with sorttop:

du … | dusub olddu | sorttop

Files currently attached to this page:


read more…

1 February 2011, 16:33 UTC

Custom compose sequences in X

In modern gnome-based Linux distributions, it's quite easy to enable a compose key through the Keyboard Preferences window. However, I had trouble finding information on how to define custom compose sequences like compose+"inf" for ∞.

The answer is the ~/.XCompose file. Start by copying the default compose file (/usr/share/X11/locale/en_US.UTF-8/Compose for me) to ~/.XCompose, and then edit it to add any additional sequences that are desired. (You can also remove any sequences you don't use, though it's not clear whether there's any benefit to this. For example, I removed all "dead key" sequences)

Applications seem to read this file once at startup, so my testing generally involves opening a new urxvt to verify the sequence works and inserts the desired character.

The Character Map applet is quite useful for finding the desired characters.

Make sure your text editor is using the right character encoding (typically UTF-8).

Here are some of the sequences I've found it useful to define:

<Multi_key> <i> <n> <f> : "∞"
<Multi_key> <p> <i>     : "π"
<Multi_key> <o> <h> <m> : "Ω"

It's also worth noting that you can define compose sequences that result in entire strings:

<Multi_key> <m> <e>     : "Jeff Epler <>"

Update, May 2011: By default in certain locales including the en_US locale, gtk+ uses its own hardcoded list of compose sequences. To get ~/.XCompose support in gtk+ applications, arrange to set GTK_IM_MODULE=xim in the environment. Related: gnome bug 96053, where I found the answer for how to get gtk/gnome apps to behave.


All older entries
Website Copyright © 2004-2018 Jeff Epler