Skip to content

Latest spectrwm - where to get it

Spectrwm seems to be the best-kept secret on the net, or at least among tiling window managers for linux. It gets less attention than others although, for me, it's the best.

In fact, it's elusive to the point that googling didn't tell me where to find the source code for the latest version. One link gave me a quite out-of-date file. For the most recent available version see here. (Of course, your distribution may provide a precompiled package too.)

Tarsnap - deleting unwanted archive-files

Last revised 20 March 2020.


Introduction

I backup my system with Tarsnap every night via crontab, using the following command to make files with date stamps.

tarsnap-exclude [any-files-not-to-backup] -c -f arcadiabackup-`date +%d-%m-%y`[data-to-backup]

After some days this produces archive-files of the following character as seen with tarsnap --list-archives.

arcadiabackup-131101
arcadiabackup-131102
arcadiabackup-131103
arcadiabackup-131104

(In practice, the files will not always be in the correct date order as they are in this example.)

The problem
After several months I ended up with over 100 archive files and this resulted in my paying for more space than I needed.*

*Actually, Graham Percival, the author of Tarsnap, has recently said that retaining old archives costs much less than you would expect. See http://mail.tarsnap.com/tarsnap-users/msg01535.html.

Deleting many files manually is slow so I use a semi-automatic method which I now describe. (There are scripts for doing this and other things at https://www.tarsnap.com/helper-scripts.html. However, I still use the method described here.)

My solution

(Note: my editor is vim. If you use a different editor, such as emacs, you'll have to adapt the steps for that.)

1. Make a list of all the archive-files and save it as, e.g., archivelist.

tarsnap --list-archives > archivelist

2. Make an executable script called, e.g. tarsnap-delete. It should contain the following lines initially:

#!/bin/sh
tarsnap -d \

3. Import archivelist (made in Step 1) into tarsnap-delete.

It will now look something like this.

#!/bin/sh
tarsnap -d \
arcadiabackup-131101
arcadiabackup-131102
arcadiabackup-131103
arcadiabackup-131104

(Note: no spaces between any of the lines.)

4. Now delete all the entries that you DON'T want to remove from the tarsnap archjve. E.g. in this case you might delete the newest two entries (arcadiabackup-131103 and arcadiabackup-131104).

5. You next want to insert -f before each remaining archive entry and append \ to each entry. In vim you can do it by recording a macro. The following string of commands starts recording the macro, inserts the necessary characters into the first entry, moves the cursor to the next entry (if any) and ends recording the macro.

qz[Esc]0i-f[Space][Esc]A[Space][Space][Space][Esc]j[Esc]q

(NB. the "0" is a zero.)

6. Test this. Put the cursor on the first line of the archive list (arcadia-backup-131101)
and issue @z.

This line should now read:

-f arcadiabackup-131101 \

and the cursor should be on the next line.

7. If it works, you can repeat the macro as many times as necessary with, for example, 40@z. (Don't worry about 'over-running'.)

8. You can now save and exit vim, after which executing the file tarsnap-delete will delete all the archive files you selected. (Double-check the file before running it because the changes are irreversible!)

Note: To save the macro to use again later, edit your .vimrc and insert the line:

let @z = '[macro here]'

Type the macro sequence as you did previously but without "qz" and "q". I precede each character with Ctrl-v although I'm not sure it's strictly necessary.

To run the macro in future, type @z.









Writing a book on LyX

I've written six books on LyX previously but the last one was a few years ago. I've just done another and thought it would be worth making a few notes about the experience. I found that I'd forgotten how to do some things while others now work better than previously. Here are the main points. (I was using the Book class but I expect most of this would apply to other classes too.)

1. Settings
These are my current settings,for the Preamble with comments. I'm grateful to people on the LyX mailing list and other lists for many of these settings.

% Include index
\makeindex

% Next line provides a latex command "\blankpage"
\newcommand{\blankpage}{\newpage \thispagestyle{empty} \mbox{} \newpage }

% Next line allows margin notes (see below for details of this)
\usepackage{marginnote}

% Reduce hyphenation
\hyphenpenalty=100

% next line for strike-through (if you want this) - use latex command "\st{word}"
\usepackage{soul}

% To improve end alignment of lines (see the next two links for details)
% http://www.latex-community.org/forum/viewtopic.php?f=19&t=21170&p=70341
% http://marc.info/?l=lyx-users&m=129071085416743
\usepackage{microtype}
\tolerance 1414
\hbadness 1414
\emergencystretch 1.5em
\hfuzz 0.3pt
\vfuzz \hfuzz


2. Margin notes
I wanted little pictures and notes in the margins. I tried using the LyX command /Insert/Marginal Note but it didn't work well. Sometimes the notes appeared on the wrong side of the page and there were difficulties using images. I solved this by using the marginnote package and the following Latex entries in the text:
\marginnote{\includegraphics{foo.png}}


3. Notes

Index errors
When making the index I occasionally found that it wasn't appearing in the pdf. It took me some time to find out why. It happened because I'd accidentally made a blank index entry, by selecting /Insert/Index entry without actually making any entry. It can take quite a long time to track these bogus entries down, by cutting sections of the text and testing.. It's best to keep remaking the pdf while you are inserting index entries to make errors easier to spot.

Resolution of images in gimp
In the past I've had difficulty getting the images in my books to apear at a sufficiently high resolution. They kept ending up at 72px whatever I did. I'm not sure if this was my fault for missing the obvious or if gimp has improved, but anyway, it's easy now in version 0.2.0. Simply click on Image/Scale Image and you can set the size and resolution to whatever you want.