I’ve used the Debian xfce pkg stuff to build Ubuntu packages of xfce 4.6.
The … release … rocks :)
You can find the debs in files/xfce/.
Be my guest…
I’ve used the Debian xfce pkg stuff to build Ubuntu packages of xfce 4.6.
The … release … rocks :)
You can find the debs in files/xfce/.
Be my guest…
Today if removed two annoyances I had with VIM.
I often mistype the following:
:w! becomes :W!
or
:q! becomes :Q!
Which is annoying because W and Q do not mean anything, and I don’t
write or VIM does not quit.
VIM has a nifty feature called commands which you can (re)define
or add new commands.
Lets try some to fix this, in a running vi:
:com -bang W write!
or
The following might be helpful to others too. I was trying to setup a new
raid1 device from two partitions /dev/sda4 and /dev/sdb4. I wanted to
do this the “right way” and use UUID everywhere, i.e. in
/etc/mdadm/mdadm.conf and in /etc/fstab.
I hit a few snags along the way.
# mdadm --create --verbose /dev/md6 --level=1 --raid-devices=2 \
/dev/sda4 /dev/sdb4
Get the uuid mdadm uses:
# mdadm --detail /dev/md6 | grep UUID
UUID : dc9aba5e:ed1a70d4:770765d8:b0f56d86 (local to host elektron2)
Check. Add that to /etc/mdadm/mdadm.conf:
In bash (and other shells) you can use the [[ construct
From the bash manpage:
[[ expression ]]
Return a status of 0 or 1 depending on the evaluation of the
conditional expression expression. Expressions are composed of
the primaries described below under CONDITIONAL EXPRESSIONS.
Word splitting and pathname expansion are not performed on the
words between the [[ and ]]; tilde expansion, parameter and
variable expansion, arithmetic expansion, command substitution,
process substitution, and quote removal are performed. Condi‐
tional operators such as -f must be unquoted to be recognized as
primaries.
So no word splitting and pathname expansion.
When you use control-v or shift-v in vim to do a visual selection
and then use (for instance) y to copy the selected text,
you loose the selection.
More often than not you want to do another thing with the selection you just had. How?
gv
Copy to clipboard
Make a selection and use
"*yy
Now the selection is ‘under your mouse’. If think I’m going to
bind this sequence to something more easy, like *Y.
You are using the ControlMaster
feature of ssh and you are having problems remembering
which shell is the master?
That’s why I’ve made zsh display this in the prompt.
You get a m@ when a connection is a master connection and
an @ if it is a slave.
The check if we are a master works by creating a file
which has $SSH_CLIENT as the name, as the following snippet shows.
The script in
using git and vi
together
was a little bit borked, as too many git repo’s were created. Hence a
new and improved version. This one will look up the directory tree to
spot an existing git repository - is nothing found a new one will be
created in $PWD.
#!/bin/zsh
# a wrapper around git and vi
# expands $Hash$ to $Hash: file short_hash epoch committer $
# git checkout HEAD $file? when would I need this
# TODO: spaces in filename
[[ ! -x =git ]] && exit 1
who=$SUDO_USER
who=${who:-$LOGNAME}
function search_git_dir {
gpath="$1"
[[ -d "$gpath/.git" ]] && echo "$gpath" && return
[[ -z "$gpath" ]] && echo "" && return
# strip that last path component and try again
search_git_dir "${gpath%/*}"
}
for file in "$@"; do
dir=$(dirname $file); cd $dir
base=$(basename $file)
if [[ -z $(search_git_dir $PWD) ]]; then
# make a new one in $PWD
git init || exit 1
else
#echo FOUND ONE
fi
chmod +w $base 2> /dev/null
if vi $base; then
[[ ! -e $base ]] && exit 0
git add $base
# collapse $Hash: id $ line
sed -i -e 's/\$Hash:.*\$/$Hash$/' $base
git commit $base
fi
id=$(git-show -s --pretty=format:$base\ %h\ %ct\ $who%n -- $base)
[[ -z $id ]] && exit 1
# re-add $Hash: sha1hash$ line
sed -i -e 's/\$Hash\$'/\$Hash:\ $id\ \$/ $base
chmod a-w $base 2> /dev/null
done
manpage And ofcourse the manpage.
A long while back I used vi together with rcs to manage files
in /etc. This worked, but I found rcs to be clunky. So welcome
to the 21st century and my git + vi script.
It is a wrapper around git, which will create a new
git repository, add the file and commit it when changed.
The script will also expand $Hash$ to
$Hash: basename-of-file short-commit-hash epoch committer`
a typical example is
Ok, so far I’ve created a cfengine setup that works. On
my main host ’elektron’ I’ve created a /export/nfsroot/x86
directory. This holds the general files for the x86 Ubuntu
lazy clients. With 2 scripts (see below) I can easily create a
whole new x86 from scratch. Bringing up new lazy clients is
even more easy, once the groundwork is there.
I only need to do three things:
There is one script that creates a new host in a chrooted environment,
it starts a debootstrap and after that calls a follow-up script to
finish the configuration for this host - after this step cfengine
takes over. The second stage script takes care of setting up the
sources.list for apt and a preliminary /etc/hosts file. Cfengine
fixes everything else.
In my ongoing effort to make my lazy client work I’ve embarked on the next phase of the project: Making a client boot from a generic NFS mounted root partition and then giving it its own /etc on a ramdisk.
This way I’m saving disk space and administration overhead on my
server. The virtual /etc is provisioned by cfengine. This allows
for small changes between the lazy clients while they still share
the bulk of the rest of the files.
while playing with cfengine I kept seeing these messages:
Cfengine input file had no explicit version string
Well, I greped in the source of cfengine and this has helped me find
the solution, in the file install.c we have the following:
3359 void VersionAuditFile()
3360
3361 { char *sp;
3362
3363 if (sp = GetMacroValue(CONTEXTID,"cfinputs_version"))
3364 {
3365 AUDITPTR->version = strdup(sp);
3366 }
3367 else
3368 {
3369 Verbose("Cfengine input file had no explicit version string\n");
3370 }
3371 }
(Line numbers are from VIM).
I want to quiet, full blown PC, without fans nor a harddisk in my living room. See my other blog about this subject
Currently I’m thinking about the following setup:
I wanted to use puppet, but after seeing it use more than 30% of my main memory – This is on a AMD64 Ubuntu server – I was ready to ditch it.
I’ve also have experience with cfengine, so I’m going to use that. In
conjunction with svn. I’m going to store all my configs + cfengine
files in one repository. The modus operandi will become:
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.
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
.snapshots directory (for instance)..snapshot directories
must be mounted on a separate mount point..snapshot directories should be encrypted
and send to remote server.I think this is too much to ask…
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.
Grrrrr
cd
rm -rf Desktop
mv Documents docs
I don’t want desktop environments messing with MY home directory.
Thank you.
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.
I’m trying to move my noisy server to the cellar I’m left with the question how do I cater for my desktop computer needs. I would be nice to have a thin client, but then you have the problem that local devices do not work: because you are actually working on the server, it needs to “know” somehow that you have locally inserted an USB disk. This sucks.
So how about a thick client, a client with enough power to run a full blown Linux distro. This works but has the following disadvantages:
Small script which display “teletekst” pages from the Dutch teletext (or the Belgium, but I’ve never used that).
I’m not the original author, but feel free to grab your copy.
#!/usr/bin/perl
#
# Dit scriptje laat de NOS teletext zien
#
# (c) 2001, 2002, 2003 by Bas Zoetekouw <bas@debian.org>
# All rights reserved.
#
# Naar een idee van Wouter Bergmann-Tiest
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice and this list of conditions.
# 2. Redistributions in binary form must reproduce the above copyright
# notice and this list of conditions in the
# documentation and/or other materials provided with the distribution.
#
#
## 2003-01-06: niew teletekst format
## 2003-01-06: kleurtjes
## 2003-01-06: meer html entities toegevoegd (dank Richard)
## 2003-01-22: VRT support
## 2003-02-07: kleur support aangepast
#use strict;
#my $SOURCE = "VRT";
my $SOURCE = "NOS";
my $LYNX;
foreach my $l (qw|/usr/bin/links /usr/bin/lynx lynx|) {
if (-x $l) {
$LYNX=$l; last;
}
}
my $color = 1;
if ((scalar @ARGV > 0) && ($ARGV[0] eq "-m")) {
$color = 0;
shift @ARGV;
}
my %COLORS = ( "000000" => "\e[30m", #black
"black" => "\e[30m", #black
"ff0000" => "\e[31m", #red
"red" => "\e[31m", #red
"00ff00" => "\e[32m", #green
"lime" => "\e[32m", #green
"0000ff" => "\e[34m", #blue
"blue" => "\e[34m", #blue
"ffff00" => "\e[33m", #yellow
"yellow" => "\e[33m", #yellow
"ff00ff" => "\e[35m", #magenta
"fuchsia"=> "\e[35m", #magenta
"00ffff" => "\e[36m", #cyan
"aqua" => "\e[36m", #cyan
"ffffff" => "\e[37m", #white
"white" => "\e[37m", #white
"reset" => "\e[0m"); #reset color
my %HTML = ( """ => '"',
"­" => "",
"<" => '<',
"&" => '&',
">" => '>');
sub display(\@) {
my @Output=@{(shift)};
my ($print, $last) = (0, 0);
foreach my $line (@Output) {
# print "--> $line";
($print = 1) if ($line =~ s/^.*<pre>//i);
($last = 1) if ($line =~ s/<\/pre>.*$//i);
next unless ($print==1);
if ($color==1) {
foreach (keys %COLORS) {
$line =~ s/COLOR=$_[^>]*>/>$COLORS{"$_"}/ig;
}
}
foreach (keys %HTML) {
$line =~ s/$_/$HTML{"$_"}/ig;
}
$line =~ s,<[^>]+>,,g;
last if ($last == 1);
print $line;
}
print $COLORS{"reset"};
}
my ($Pagina, $SubPagina) = @ARGV;
$Pagina = "100" if (scalar @ARGV == 0);
$SubPagina = "1" if (scalar @ARGV <= 1);
my @Output = ("");
if ($SOURCE eq "NOS") {
$SubPagina = sprintf("%02i", $SubPagina);
@Output = `$LYNX -source 'http://teletekst.nos.nl/tekst/${Pagina}-${SubPagina}.html'`;
} elsif ($SOURCE eq "VRT") {
@Output = `$LYNX -source 'http://193.121.55.225/tt/tt.php?p=${Pagina}/${SubPagina}&g=0&s=0&r=0&x=1'`
}
display @Output;
This is an older article that I’ve brought back to live This was original written at the time of Linux 2.6.0
So be ware!
As it turns out, the script below never did work correctly (see the bottom of
this page for an updated version). The reason it did work for me was that sshn
INET_2 never blocked outgoing port 25…until October the 8th. This was at the
same time I was experimenting with linux2.6 (go figure). When sshn started to
block port 25 outgoing, the script broke. For telnet session to port 25 it
worked correctly, but actual sending of email was already done from a high port.
This was always (incorrectly) routed through INET_2.
This info can also be found on the Internet, but I thought I compile it here too.
You want to save something (say passwords) in a file and protect the file with a master password (say with your PGP/GPG key). This can be cumbersome unless you have vim.
The following examples will handle *.gpg files differently, vim will
decrypt the file when opening it and encrypt the file when writing it.
Also the use of a swap file is disabled.
You all, of course, know about the fc command. From bash’s help system:
fc: fc [-e ename] [-nlr] [first] [last] or fc -s [pat=rep] [cmd]
fc is used to list or edit and re-execute commands from the history list. FIRST and LAST can be numbers specifying the range, or FIRST can be a string, which means the most recent command beginning with that string.
Now I had the following problem: you have a file with shell commands in it. Next you want to select a few lines from this file to be executed in your running shell. A way to do this is:
Well, after giving Xmonad a chance I’ve reverted back to XFCE. This time with a 1-pixel wide window decoration. Short story: I really like the tiling of Xmonad (or any other tiling window manager). But you do miss some flexibility if you really want to move a window. Also I needed a panel and system tray, which are available as third-party tools, but aren’t the real deal.
So back to XFCE.
Every now and then I get the ‘prompt-itch’ and then I need to tweak my prompt again :) Of course I’m very happy with the way my prompt was.
My idea of a good prompt is to be as short as possible and still be informative about your environment:
Only tell stuff I’m really interrested in and for the rest SHUT THE HELL UP!
So no date output in my prompt, If I want to know the time I will type
date myself. I’m still thinking about leaving out the current hostname
and current username… but for some reason I’ve become attached to
seeing elektron (my hostname) on the screen.
I’ve created a new latex style to mimic some old school UNIX manuals I’ve been reading the past few months. It’s a very plain style that keeps out of your face. This in contrast with the blockbook style
This is how it looks:
You can read about it a small howto doc. To use it, you will also need the class file.
UPDATE
I’ve updated the style file so that the description lists will be
indented with the same amount of space, no so more
Hmmm, this is the second time in 1 year that I had a corrupt filesystem
on my raid partition. I saw no other option than mke2fs -j /dev/md7.
My first problem with XFS started on my fileserver, which only had 256
MB of memory. Turns out XFS was OOM-ing inside the kernel, this in
turned messed up the filesystem. xfs_repair was also running out of
memory. When I finally got enough virtual memory in this box
xfs_repair was kind enough to segfault. Ok, shit happens, mkfs.xfs
and try again.
The GNOME decadence thread got me thinking. What does GNOME give me? (I consider myself a hardcore UNIX user). Well… it gives a nice interface with a nice terminal implementation (gnome-terminal). Further more with the recent Ubuntu 8.04, it also provides
locate? Never got
that working, and when I did, it was dog slow.mutt user.So I purged GNOME from my system and started using Xmonad, a tiling window manager. I’m still using GTK applications, because most of them still rule. But I’m happy that I’m leaving this whole GNOME business behind.
I’m publishing this for my own future reference. A short usage
guide on git for an ex-svn addict.
| goal | client | server |
|---|---|---|
| init .git repo | git init | git init |
| start remote repo | git clone ssh://server | |
| add a file | git add $file | git add $file |
| commit the file | git commit -a -m"log" | git commit -a -m"log" |
| upload to server | git push origin master | |
| import remote changes | git reset --hard |
|
| get changes from server | git pull |
Note: this is an older article that I’ve revived. Also note: in todays email flood I don’t know if such a popup is something you want to use…
#intro
I’ve used gnubiff, xbiff and God knows what to
provide a simple notify when receiving mail. But I wanted more.
I want to be able to tweak certain settings, without going in to
the source code of the application. Also the way mail notifiers
mess with your mailbox is not something I particularly like.
On Jun the 7th I gave a little presentation about DNSSEC at the NLLGG meeting. The presentation is in Dutch and the title is: “DNSSEC, wat is het? Komt het er ooit nog van?”
(DNSSEC, what is it? Does it ever happen?)