August 2008 Archives
Older (DNSSEC) presentations
Some older presentations I have given can be found here.
The all deal with DNSSEC - note that most of them have been written a few years ago.
Getting rid of the cable mess
As any long time computer addict will tell you, (computer) cables are a pain in the butt. They collect dust and generally look bad. So ever since I worked for BIT I wanted to clean up my cable mess at home. Yesterday I finally started... only a year after I have left BIT.
hardware
I've bought a roll of velcro (5 m and 25 mm wide)
and some fitcoflex (25 m and 50 mm wide)
at display.nl. It wasn't cheap, but I think it is worth the price. Also I've been using ty-rap's, but I think velcro is much better as you can easily unty them.
first project
As a first attempt to get a feel for the material I wanted to clean up my computer and bundle some SATA cables and power lines. As I was too hasty I don't have any before photos...only the after shots.
Well here is how it looks now
Trust me; this is better than it has ever looked!
closing remarks
Cutting the Fitcoflex is not that easy, and you want to use some lighter to burn the ends so that it will not split too easy.
And of course I had to mess with the system WHILE it was running, resulting in a shutdown of my raid disks -- all three of them. I accidentally pulled the power cable from the disks.
Next up: cables behind my computer(s).
Found this nice webgame again
Completely forgot the name and where you could find it. I had a lot of fun with this game more than a year ago. So for future generations here it is.
Slowly changing the background in XFCE
Google is always helpful of course, so I've found this blog entry on how to set the background in xfce.
It boils down to setting a jpg in XFCE's backdrops.list and then
reloading xfdesktop. Crude, but it works.
This can de done with the following command:
cat <<EOF > ~/.config/xfce4/desktop/backdrops.list
# xfce backdrop list
background.jpg
EOF
And then
xfdesktop --reload
However when running from CRON it is more easy to do a
killall -USR1 xfdesktop.
A collage from ATComputing, Jacques loonen had a little script that will download a nice image from some site showing the earth with actual clouds rendered on it. I'm going to use it to make a background that slowly changes from day into night and vice verse.
The following script wil be run from cron, it will generate a new
jpg suitable for background use. Images from
opentopia.com
are particularly nice.
#!/bin/sh
IMG=/home/miekg/tmp/xfce_bg.jpg
wget \
http://www.opentopia.com/images/cams/world_sunlight_map_hemisphere.jpg \
-O $IMG
# not really needed, but... heh
cat <<EOF > ~/.config/xfce4/desktop/backdrops.list
# xfce backdrop list
$IMG
EOF
killall -USR1 xfdesktop
The # xfce backdrop list comment seems to necessary to make it all work.
CRON
CRON is the most natural fit to download new images. So save the
script to a place where it can be found, say in ~/bin/xfcebg and
edit your user cron entry with crontab -e and put something like
this in there
*/5 * * * * $HOME/bin/xfcebg
That's it!
Didn't like it
The whole scaling seems to be a bit off and the earth image is way too white, so I'm already back on my go'old background :-)
LPI-1 Certified
After playing with Linux for 12 years, I have now been LPI-1 certified. It wasn't really difficult, but you still need to know a lot of details.
Next up: LPI-2 (if it is needed for my lessons)
The file system I want
Working on backup programs for almost a decade now, I've had plenty of time to think about file system wrt backups. Basically I want the following properties in a file system
- online snapshots in a
.snapshotsdirectory (for instance). - the possibility to say the all those
.snapshotdirectories must be mounted on a separate mount point. - to ability so say the
.snapshotdirectories should be encrypted and send to remote server.
I think this is too much to ask...
Eeepc battery script for 2.6.24 AND 2.6.25
The new kernel for the EeePC (2.6.25) has deprecated the
/proc/acpi/battery interface, so I had to write a new
script for use in my zsh prompt.
The script will work in both 2.6.24 and 2.6.25, so without further ado, here it is. It is written as a function for easy inclusion in any prompts.
#!/bin/zsh
bat() {
PROC=/proc/acpi/battery/BAT0
SYS=/sys/class/power_supply/BAT0/uevent
STATE=
# dc: design capacity, rc: remaining capacity
if [ -f $PROC/info ]; then
STATE=$PROC/state # 2.6.24
dc=$(grep 'last full' < $PROC/info | awk '{ print $4 }')
rc=$(grep 'remaining' < $PROC/state | awk '{ print $3 }')
elif [ -f $SYS ]; then
STATE=$SYS # 2.6.25
dc=$(grep '\<POWER_SUPPLY_CHARGE_FULL\>' < $SYS | awk -F= '{ print $2 }')
rc=$(grep '\<POWER_SUPPLY_CHARGE_NOW\>' < $SYS | awk -F= '{ print $2 } ')
else
exit
fi
p=$(echo 3k $rc $dc / 100 \* p | dc )
if grep -iq discharging $STATE; then
printf " %02d" "$p"
else
if [ ${p%.*} -lt 100 ]; then
printf " %02d+" "$p"
fi
fi
}
bat
Update
Ton Kersten has an even better one which
saves a few greps.
#!/bin/zsh
bat() {
PROC=/proc/acpi/battery/BAT0
SYS=/sys/class/power_supply/BAT0/uevent
STATE=
# dc: design capacity, rc: remaining capacity
if [ -f $PROC/info ]
then
STATE=$PROC/state # 2.6.24
dc=$(awk '/last full/ { print $4 }' $PROC/info)
rc=$(awk '/remaining/ { print $3 }' $PROC/state)
elif [ -f $SYS ]
then
STATE=$SYS # 2.6.25
dc=$(awk -F= '$1 ~ /^POWER_SUPPLY_CHARGE_FULL$/ { print $2 }' $SYS)
rc=$(awk -F= '$1 ~ /^POWER_SUPPLY_CHARGE_NOW$/ { print $2 }' $SYS)
else
return 0
fi
p=$(echo 3k $rc $dc / 100 \* p | dc )
if grep -iq discharging $STATE; then
printf " %02d" "$p"
else
if [ ${p%.*} -lt 100 ]; then
printf " %02d+" "$p"
fi
fi
}
bat
Update 2
Just found that there is also a nice tool, called acpi...which makes
it even more easy:
% acpi -V
Battery 0: Full, 100%
AC Adapter 0: on-line
Thermal 0: ok, 53.0 degrees C
Cooling 0: Processor 0 of 7
Updated rdup roadmap
The previous
rdup roadmap has been implemented. I'm now working on the post 0.6.1
items and added a few new features:
The regular expressions are now
pcre(Perl Compatible Regular Expressions), this adds an extra dependency tordupfor this library. But these are so much more powerful that I think it is worth it.For completeness sake I added: sockets, named pipes, character devices and block devices as recognized file types to
rdup. One side effect of this is that thefilesize(%s) is (again) overloaded to mean minor,major just as in thels -loutput when an character or block devices is printed.The rdup-utils currently ignore these extra file types.
So lets say I have this directory:
$ ls -l A total 0 -rwsrwsr-x 1 miekg miekg 0 Aug 11 12:45 blaat* -rw-rw-r-- 1 miekg miekg 0 Aug 11 16:30 ff prw-rw-r-- 1 miekg miekg 0 Aug 11 16:34 fifo| brw-r--r-- 1 root root 8, 0 Aug 11 16:24 sda crw-r--r-- 1 root root 8, 0 Aug 11 16:24 sdb srwxrwxrwx 1 miekg miekg 0 Aug 11 16:58 socket=rdupwill now print this as:./rdup /dev/null A +d 0755 0 0 5 0 /home +d 0751 1000 1000 11 0 /home/miekg +d 0711 1000 1000 15 0 /home/miekg/svn +d 0700 1000 1000 20 0 /home/miekg/svn/rdup +d 0775 1000 1000 26 0 /home/miekg/svn/rdup/trunk +d 0775 1000 1000 28 0 /home/miekg/svn/rdup/trunk/A +- 6775 1000 1000 34 0 /home/miekg/svn/rdup/trunk/A/blaat +- 0664 1000 1000 31 0 /home/miekg/svn/rdup/trunk/A/ff +p 0664 1000 1000 33 0 /home/miekg/svn/rdup/trunk/A/fifo +b 0644 0 0 32 8,0 /home/miekg/svn/rdup/trunk/A/sda +c 0644 0 0 32 8,0 /home/miekg/svn/rdup/trunk/A/sdb +s 0777 1000 1000 35 0 /home/miekg/svn/rdup/trunk/A/socketSo there as 4 new types: p, b, c and s.
The move to
GNodemight be needed to allowrdupto reverse print the filelist (i.e.rdup /dev/null ~/bin | tac). In 0.6.2 a-Rflag is added that makes this possible. The internal structures inrdupare stillGTree's (balanced binary trees). The-Rfeature is implemented by putting all elements in a linked list (GList) and reverse printing that.
EeePC doc-purge script
You want to clean up /usr/share/doc every time you install a package
to safe space. Here is how to do it.
Completely inspired by localepurge (and I stole some code from it).
But I wanted to purge stuff in /usr/share/doc/$package too as this
takes too much disk space on my precious (talking about the EeePC
here). If I really need the documentation I will also install the
package on my server and look at it there.
localepurge consists out of two important parts, a hook for dpkg
which is called after each installation. This hook is placed in
/etc/apt/apt.conf.d. And a script that will
actually remove the locales (/usr/sbin/localepurge).
For my needs a actually need to tweak the hook a little and write
a little script. My first thought was to actually look at the
package being installed and only remove the doc-dir for that
package, but a quick search yielded no clue on how to give the name
of the package to DPkg::Post-Invoke. So the next best thing I could
come up with was to delete everything in /usr/share/doc every time.
DPkg::Post-Invoke
The Post-Invoke from localepurge looks like this:
DPkg
{
Post-Invoke {"if [ -x /usr/sbin/localepurge ] && [ $(ps w -p "$PPID"
| grep -c remove) != 1 ]; then /usr/sbin/localepurge; else exit 0; fi";};
};
This needs to be tweaked a little for my purposes. I'm storing the
scripts in the dir /home/miekg/bin -- as I'm the sole user of my
EeePC.
DPkg
{
Post-Invoke {"if [ -x /home/miekg/bin/docpurge ] && [ $(ps w -p "$PPID"
| grep -c remove) != 1 ]; then /home/miekg/bin/docpurge; else exit 0; fi";};
};
Save this file in /etc/apt/apt.conf.d as 99-docpurge.
docpurge
I've named my script docpurge and its a stupid script that just
deletes stuff in /usr/share/doc. For completeness here it is:
#!/bin/bash
# delete stuff in /usr/share/doc
DOCDIR=/usr/share/doc
for i in $DOCDIR/*; do
rm -rf $i
done
XFCE title less theme
After some
switching
I have now settled on
XFCE. With
Ubuntu XFCE sometimes does not start, this is a dbus issue in
combination with gnome-screensaver (a race condition between the two).
This sucks, but can be resolved easily with
apt-get remove gnome-screensaver
(There aren't any interesting option anyway...)
So my XFCE is now up and running, time for some tweaking.
In the quest for precious vertical pixels (especially on the EeePC 701 I own) I decided I must remove those pesky title bars.
I found prelude-4.0
which is beautiful, but
it make it kinda hard to see which window is active. That's why I've
modified it slightly to have a blue-ish border (at the left,
bottom and right) when a window is active. Just enough to
give you a subtle visual hint. You download my variation (which
is called premiek for lack of a better name) from
here.
Further more my gtk theme is Mist, a simple theme that is much
quicker (i.e. takes less resources) than for instance Clearlooks.
Take a look at the following screenshots. Click on them for larger views.
Firefox with some gnome-terminals:
Thunar with terminals and a gvim session:
rdup 0.6.1 released
rdup 0.6.1 just got released a few days ago. It fixes some bugs
and has the rdup-s3 utility.
Go to the project page and read more or download it right away.
Grrrr
Grrrrr
cd
rm -rf Desktop
mv Documents docs
I don't want desktop environments messing with MY home directory.
Thank you.
Setup postfix with clamav and spamassassin WITHOUT amavis
I've battled with amavis too often and I started to dislike it a little.
So when I wanted to configured my postfix setup to scan for viruses
and spam and needed a solution which would work without amavis.
This is what I came up with.
debian administration
was kind enough to do the hard work, but this is only the setup for clamav
and I also want to spam scan.
packages
First install the packages you will need
apt-get install spamassassin spamc clamav clamsmtp
configuration
This is where I followed the 'Debian administration' article, in
/etc/clamsmtpd.conf you must have
Listen: 127.0.0.1:10025
OutAddress: 10026
You could also change:
# A header to add to all scanned email
Header: X-AV-Checked: ClamAV using ClamSMTP (elektron.atoom.net)
to add your own header to see if the scanning is working.
For postfix you must have a few lines in /etc/postfix/main.cf that read
# virus scanning
content_filter = scan:127.0.0.1:10025
receive_override_options = no_address_mappings
This is only for virus scanning, for spam scanning you will need to
tweak /etc/postfix/master.cf also
# interface to spamassassin.
spamassassin unix - n n - - pipe
user=nobody argv=/usr/bin/spamc -f -e
/usr/sbin/sendmail -oi -f ${sender} ${recipient}
This will feed the mail directly to spamc.
test it
/etc/init.d/clamsmtp restart
/etc/init.d/spamassassin restart
/etc/init.d/postfix restart
That's it!
My favorite LaTeX preamble
I've written quite a few LaTeX documents during the last few years, but
only recently I'm starting to discover very powerful new packages, like
memoir and xelatex.
So I just wanted to share my "new" way of writing LaTeX docs.
First read the memoir class documentation. And the fontspec doc.
preamble
This now looks like
\documentclass{memoir}
\usepackage{eurosym} %% for the EURO
\usepackage{fontspec}
\usepackage{xltrxta} %% \XeTeX if you need it
Usually this is hidden in one of my class files which implement a new look for a document. See the following articles for some examples
example
This is a small example on how to use XeTeX
\documentclass{article}
\usepackage{fontspec}
\begin{document}
Testing XeLaTeX!
\fontspec[Scale=0.9]{Trebuchet MS}
Something in trebuchet, but too large
\fontspec[Scale=MatchLowercase]{Trebuchet MS}
Size adjusted to the rest of the text!
\LaTeX rules
\rmfamily
\LaTeX in the normal font
\end{document}
Generate the pdf with
xelatex example.tex
xelatex is my new friend now :)




