Patches for IceWM online
Posted on April 15, 2009
| 1 minutes
| 109 words
| Ton Kersten
I’ve been using IceWM on and off for many years
now. And because we used it in our UNIX/Linux education environment I
did create some patches for IceWM. Some of these patches are now part of
the mainstream version and (of course) some are not.
My patch files can be found here.
These patches are mostly focused on window management such as (This list
is not complete): ~ + win_allowRestore + win_allowMove + win_allowSize
+ win_allowMaximize + win_allowMinimize + win_allowHide
win_allowRollup + win_allowRaise + win_allowLower + win_allowLayer
win_allowMoveto ~ and some are focused on system control (reboot and
family)
[Read More]
W3C Compliant
Posted on April 14, 2009
| 1 minutes
| 54 words
| Ton Kersten
I did take a lot of care to make this site W3C compliant, but a little
bug entered the code. This spoiled it and W3C give me 48 errors. Of
course that’s too much. A little debugging session showed the problem
and now I’m W3C again.
Nanoblogger code plugin
Posted on April 10, 2009
| 1 minutes
| 71 words
| Ton Kersten
#include <stdio.h>
int main( int argc, char* argv[] )
{
/* A Hello world example */
(void) printf( "Hello, World!\n" );
return 0;
}
#!/bin/bash
# A Hello world example
echo "Hello world"
If you want to cut and paste code examples, just go into `vi` and give it a
~~~ {.vim}
:%s/^[0-9]* //
Editing files and posting to git
Posted on April 9, 2009
| 2 minutes
| 249 words
| Ton Kersten
A couple of days ago I posted that I was converting to git
. Well, that
was not the completely truth. I already had switched to git
.
But what I didn’t like was the fact that git
doesn’t support
keyword-expansion and therefore there’s no way of knowing what version
of the file you are editing. I do like this in CVS
and SVN
, so I
implemented it in a script called
vigit
.
[Read More]
Version control with git
Posted on April 8, 2009
| 2 minutes
| 222 words
| Ton Kersten
Some time ago I decided it was time to change from subversion to git for
my version control system. The advantages where obvious. git is
distributed and so I can code on my laptop without being connected to my
home server. When I do get home I just sync the repositories and
everything’s OK.
But, how to do this. I took the easy road and created an user on my home
server and made sure I could login with SSH key authentication. After
that I did:
[Read More]
MySQL Backup
Posted on April 6, 2009
| 1 minutes
| 71 words
| Ton Kersten
When using a MySQL database, it’s often very useful to create backups of
the databases. This can be done with the MySQL dump
command, but this
does not allow for separate week, month and year backups. On the web I
found the tool
automysqlbackup and
that did almost what I wanted. I changed it a lot and my version can be
found here or here.
The Header Script
Posted on April 2, 2009
| 2 minutes
| 257 words
| Ton Kersten
In my daily working routine I do create a lot of shell scripts, LaTeX
source and whatever. I always try to keep things simple and consistent.
This not always being easy, so I wrote a Perl program that generates a
standard template for a lot of standard code. This could be e.g. Bash
shell, Perl, RPM spec file, LaTeX source, C source, etc.
The only thing this program needs is Perl and a file in your home
directory called .name.info
. This file should contain a tag and the
value on a single line. An example:
[Read More]
How I broke the triple-e and repaired it
Posted on October 19, 2008
| 2 minutes
| 267 words
| Ton Kersten
Last weekend I decided it was time again to completely update my eeePC.
So I ran the command tantrum everybody knows:
apt-get update
apt-get upgrade
and that gave me 287 new and updated packages.
After that I needed to reboot because I got a lot of new stuff.
Well, there the trouble began. No X, no network, no mouse, no USB etc.
It was in a terrible state.
Digging around and repairing the odd stuff, I got X running, but still
no mouse and no network. I thought that there had to be a general
problem, because it looked impossible that everything was broken without
some major hickup. Digging further and further I suddenly noticed that I
did have a lot of files with the name ending in dpkg-new
. That gave me
the clou that these where new configs and new scripts that didn’t update
the original ones. why wasn’t clear, first get the thing up and running
again.
[Read More]
Portforwarding without IPtables
Posted on October 14, 2008
| 1 minutes
| 200 words
| Ton Kersten
Live’s good and the problem is simple. Having a Linux server at home
with two virtual machines running within VMware server, I would like to
have a tunnel to the host OS and forward ports for smtp
, imap
, rdp
and maybe some others.
I thought this could simply be solved with IPtables, but that turned out
to be a big pain in the *ss. It didn’t work as I wanted, I locked myself
out several times and still it didn’t do exactly as I wanted.
[Read More]
Seek in the Kornshell
Posted on September 16, 2008
| 1 minutes
| 117 words
| Ton Kersten
Searching for shell builtins to speedup Nanoblogger, we stumbled across
a very charming and nice way to implement a tail
function in the
Kornshell.
This works in KSH93
and newer.
The new redirection operators, <#
and >#
are used to seek. For
example,
will seek to 36 bytes before the end-of-file. You can apply this along
with any redirection so that
Eeepc battery script for 2.6.24 AND 2.6.25
Posted on September 13, 2008
| 2 minutes
| 333 words
| Ton Kersten
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 own 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
[Read More]