CDE is Open Source

Today the classic, and old, Common Desktop Environment (a.k.a. CDE) was released into the Open Source world.

You can get the very alpha version at SourceForge.

I haven’t been able to get a running version by now, but I keep trying.

Good job, guys.

Tags: linux code news 

git status in the prompt

Working with git a lot I decided I needed some git status in my prompt.

I searched the web and some solutions where almost what I wanted and this one by Sebastian Celis came very close.

But it didn’t work with my version of zsh, because that didn’t seem to understand the =~ operator.

I also think Sebastian makes things over complicated and so I changed some things aroud.

This is what I came up with:

[Read More]
Tags: git sysadm code linux 

New version of We-Blog

Today I released version 0.8 of We-Blog.

Version 0.8 is now the stable branch and 0.9 the development branch.

What’s new?

Well, to be really honest, not that much. I fixed some minor bugs and did a lot of code cleanup. Although the original code of Jaromir was very nice, there was some room for improvement. I removed a lot of double functions and variables and put them all together in a We.pm Perl module. Saves a lot of work with an update.

[Read More]
Tags: blog code 

Finding key codes on Linux

It often happens that I get into a situation where I need to know key codes of pressed keys. On my Mac that’s simple. Just use the Key Codes by Many Tricks.

But on Linux I constantly was trying to find out which key produced what.

So I ended up writing a program for that. I started of in the shell, but that ended up being rather tricky and unnecessary complicated. So I redid the whole thing in C.

[Read More]
Tags: code linux sysadm 

New header

Today I’ve posted a new version of the header program.

Nothing really fancy happened, just added support for zonefiles, in this case the Bind ones.

It’s available at the usual places.

Tags: code linux 

sed tips and tricks

I’m creating a Puppet Starter Kit with some standard manifests included and a complete set of documentation. All documentation should be written in Markdown and will be served by Markdoc. But I want to generate all Markdown files from the Puppet manifests, so I only need to document the manifest file. Generating the Markdown is not that difficult, except that I kept ending up with empty lines at the top of the manifest code and I wanted to get rid of those. Of course this should be done with sed, because the whole generation process is written in bash. When playing around with sed I found

[Read More]
Tags: sysadm linux code 

Puppet updates

When working with Puppet and a VCS (like git and SVN) it’s nice to have a simple way of updating the Puppet tree.

My tree is always in /etc/puppet and owned by user and group puppet. User puppet is allowed to checkout the complete tree from git or subversion.

I have created two one-liners to update the complete tree and make sure all rights are still correct.

update_svn ~ \{.bash} #!/bin/bash # update_svn su - puppet -c `cd /etc/puppet; svn up; cd doc; ../bin/gendoc' ~

[Read More]
Tags: puppet sysadm code 

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 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]
Tags: code