Mutt: encrypt all messages sent to known PGP users
Classified in : Homepage, Debian, Command line, To remember
This is one thing I have wanted to do for a long time: configure Mutt to encrypt all messages sent to addresses for which I have a valid public key. Well, here is an awk-based script to generate that configuration.
(Yes, I know, a similar script was already written. But I did not see it at first, and I find mine more readable. :-) )
Read more Mutt: encrypt all messages sent to known PGP users
Beware of symlinks when testing a file existence
Classified in : Debian, Command line, To remember
A strange problem
Yesterday, I was reported a funny problem with the dokuwiki Debian package's postinst script, which contains a piece of shell script similar to that:
# Check the destination does not already exist if [ ! -e /the/destination ] then ln -s /some/file /the/destination fi
It was failing with that message: ln: failed to
create symbolic link '/the/destination': File exists
. Even
though I had just tested it did not exist!
Working with XML using standard Unix tools
Classified in : Homepage, Debian, Command line, To remember
Like it or not, XML has been used everywhere, even in cases where text-based formats would have been sufficient. Unfortunately, standard tools such as grep, sed or awk are not really adapted to work with XML. Let us take the following example:
<chapter xmlns="http://docbook.org/ns/docbook" version="5.0"> <title>The Debian distribution</title> <para>Debian is a free operating system, describing itself as “the universal operating system”. It is mostly known as a GNU/Linux distribution, but it also exist in other variants such as GNU/Hurd and GNU/kFreeBSD…</para> </chapter>
grep --only-matching
Classified in : Homepage, Debian, Command line, To remember
grep is designed to print lines matching a given pattern, but I often need to print only the matching part, discarding the remaining.
I used to do that with sed, but it involves several actions: match, replace the line by only the matching pattern and print. Fortunately, GNU grep has an option to do just that:
-o
,--only-matching
- Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.
Unfortunately it is not a standard option, so it may be missing on non-GNU systems.
Suspend your computer from a non-mainstream desktop environment
Classified in : Homepage, Debian, Command line, To remember
UPower for regular users
Major desktop environments usually provide a user-friendly menu to suspend your computer. Internally, if seems to use something called UPower, which uses something called PolicyKit, which in turn may or may not use another piece called ConsoleKit (do not ask me what all these pieces are and how they relate to each other, I do not know and I do not want to know). For the regular user, the result is the following: when they click on that button, it suspends their computer.
Read more Suspend your computer from a non-mainstream desktop environment