Thomas Schwery's Blog

A Glog ... Plog ... Blog ...

Now with OwnCloud
7th February 2012

After a long pause in this blog, I just updated the broken edition method. Before, the only method to add new notes in this blog was using SVN, which was broken when I migrated to Mercurial.

Now, I shared a folder with WebDAV, using ownCloud so that I can access these notes from anywhere using either a mounted folder in my home directory or the online interface.

As soon as an entry is added or modified, a small watch script launch a blog recompilation :



while inotifywait -e modify $SHARED_FOLDER; do
    echo "Recompiled blog"

Easy !

Tags: blog.
My blog now supports Gopher
18th August 2010

As always during holidays, I have too much time on my hands.


My blog now supports Gopher !

You can visit it on gopher://

If you are interested in the script that is responsible for serving the pages, it is written in Perl5, is some 170 lines long and is bad code that needs to be rewritten in Haiku.

Tags: gopher, useless.
Mercurial Repositories
14th August 2010

I finally found a way to share the code snipplets that I wrote for a reason or an another with anyone who would have any use for them.

I decided to drop my usual SVN repositories and try another versioning tool : Mercurial. The main reason was that the name sounded cool and that it was really easy to setup some web repository view ... I know it's not really a plus since all VCS provide this feature through a plugin or an another ...

So, if you want to browse some code I wrote in the last months or some configuration files I use on my laptop, just go to

UPDATE : After some crash of the server used for this repository, I changed for a repository at BitBucket.

Tags: programming.
xRandr and dual screen
9th June 2010

As always when you have to study an exam, you notice something on your computer that doesn't work ... Today was the easy way to connect an external display and use it to ... hum ... work.

As I don't use fancy desktop environment, no gui tools are available. That's not a problem, you just have to do it the easy way: Some obscure key bindings that will launch a script that will do what you wanted.

The program used for display "manipulations" is xrandr. Very useful, simple, does what it claims to do ... and command line ! Perfect, let's do our little script :

touch /tmp/xrandr
loop=`cat /tmp/xrandr`
case "$loop" in
        xrandr --output $INTERNAL --auto --output $EXTERNAL --auto --left-of $INTERNAL
        echo "vga_left" > /tmp/xrandr
        xrandr --output $INTERNAL --mode $RESOLUTION --output $EXTERNAL --mode $RESOLUTION --same-as $INTERNAL
        echo "vga_double" > /tmp/xrandr
        xrandr --output $INTERNAL --auto --output $EXTERNAL --off
        echo "vga_off" > /tmp/xrandr
        xrandr --output $INTERNAL --auto --output $EXTERNAL --auto --right-of $INTERNAL
        echo "vga_right" > /tmp/xrandr

To be able to use it, just modify the internal and external display name. You can find them just by typing:

$ xrandx -q

The output should tell you the names:

Screen 0: minimum 320 x 200, current 2880 x 1200, maximum 8192 x 8192
VGA1 connected 1600x1200+1280+0 (normal left inverted right x axis y axis) 408mm x 306mm
   1600x1200      60.0*+
   1280x1024      75.0     60.0  
LVDS1 connected 1280x800+0+0 (normal left inverted right x axis y axis) 286mm x 179mm
   1280x800       59.9*+
   1024x768       85.0     75.0     70.1     60.0  
TV1 disconnected (normal left inverted right x axis y axis)
Tags: display.
How to modify the CPU voltage
7th June 2010

Hi !

Today I just experimented with an old tool: Linux-PHC. This is a kernel module that replaces the default apci module and allows more control over the cpu. The main function of this module is to allow the user to modify the CPU voltage, usually lower it.

Why would you lower the CPU voltage ? The answer is simple: On a laptop, it means less heat and more battery.

I tried the experiment a long time ago, we still needed to patch and recompile the kernel ... Long procedure, boring when the updates come ... Now it is possible to just compile a module and insert it, so I decided to try again.

You can get the archive from the official website:

We need to have the kernel headers to compile a module, so let's install them:

$ sudo aptitude install linux-headers-2.6-686

After a simple

$ ./ 2.6.32
$ make
$ sudo make install

I was good to go !

First, get the default voltage values:

$ cat cpu0/cpufreq/phc_controls
75:39 74:34 8:28 6:23 136:19

And then, try some new one ... There is no risk involved, except a beautiful system freeze if you set the voltage too low. Even then, the voltages are reset on reboot ...

for i in `seq 0 1`; do echo "75:25 74:20 8:8 6:8 136:8" | sudo tee /sys/devices/system/cpu/cpu$i/cpufreq/phc_controls; done;

Have fun !

Tags: kernel.
How to disable Num_Lock
16th May 2010

A small note about the most useless key on my keyboard : Num_Lock.

I don't know about you, but when I have numbers to type, I use the line on top of the keyboard and not the numeric pad that, once activated, replaces some keys of my keyboard - Yes, I'm on a laptop.

So, about disabling that key and rendering it useful :

xmodmap -e 'keycode 77 = ISO_Level3_Shift'

Replace the keycode with what corresponds to your numlock key. If you don't know the keycode, use xev.

If you use that numlock key sometimes, you can map the Shift+NumLock to NumLock:

xmodmap -e 'keycode 77 = ISO_Level3_Shift Num_Lock'

Now you have a numlock key that can be used for anything you want ...

PS: The mapping disappear at reboot, you'll have to add it to the startup or login, I'll let you play !

Tags: debian.
Wood Computer
13th April 2010

Okay, this is just a random thing I saw last year during the open doors at the IC faculty :


A Computer made of wood, chains and some plastic blocks ... And it works ! (Well, it is able to execute some operations ...)

Tags: useless.
What's this blog ?
12th April 2010

Okay, I already see the questions coming :

a. What's this blog ? b. Why not using Wordpress like everyone else ? c. What more does it have ? d. Obi-Wan Kenobi ?

So :

a. I'm using Chronicle to power this blog. b. Because I was looking for something clean, simple and efficient, because I want to be able to edit every entry by hand, using either a simple nano by ssh or a subversion repository. c. No database. d. Yup !

To post articles to this blog, I rely on two systems : A text editor and Subversion. Simple, efficient, flexible. The only thing I have to do is type in any text editor and then commit the file. The script will compile the blog just after the commit and Magic involved publish it.

Anything else ?

Tags: blog.
Pretty boot output
12th April 2010

I've always asked myself how some Linux distributions have pretty lines along the :

Starting ACPI services...                                                                                           [   OK   ]
Starting anac(h)ronistic cron: anacron deferred while on battery power.                                             [   OK   ]
Starting deferred execution scheduler: atd                                                                          [   OK   ]

It appears this is managed by the LSB and there is only one file to edit to have anything you want for your boot output :

log_end_msg () {
    # If no arguments were passed, return
    if [ -z "${1:-}" ]; then
        return 1


    log_end_msg_pre "$@"

    # Only do the fancy stuff if we have an appropriate terminal
    # and if /usr is already mounted
    if log_use_fancy_output; then
        RED=`$TPUT setaf 1`
        GREEN=`$TPUT setaf 2`
        YELLOW=`$TPUT setaf 3`
        NORMAL=`$TPUT sgr0`
        $TPUT hpa $((`$TPUT cols` - 12))

    if [ $1 -eq 0 ]; then
        /bin/echo -e " [   ${GREEN}OK${NORMAL}   ]"
    elif [ $1 -eq 255 ]; then
        /bin/echo -e " [${YELLOW}WARNING!${NORMAL}]"
        /bin/echo -e " [ ${RED}FAILED${NORMAL} ]"
    log_end_msg_post "$@"
    return $retval

log_action_end_msg () {
    log_action_end_msg_pre "$@"
    if [ -z "${2:-}" ]; then
        end=" ($2)"

    /bin/echo -n "${end}"

    # Only do the fancy stuff if we have an appropriate terminal
    # and if /usr is already mounted
    if log_use_fancy_output; then
        RED=`$TPUT setaf 1`
        BLUE=`$TPUT setaf 4`
        NORMAL=`$TPUT sgr0`
        $TPUT hpa $((`$TPUT cols` - 12))

    if [ $1 -eq 0 ]; then
        /bin/echo -e " [  ${BLUE}DONE${NORMAL}  ]"
        /bin/echo -e " [ ${RED}FAILED${NORMAL} ]"
    log_action_end_msg_post "$@"

Thanks to Google and Jonathan McDowell

Tags: boot, debian.
First Post
8th April 2010

Okay, so once again I wanted to start a blog to share / store every small things I have lost in my bookmarks.

In my bookmarks are links to virtually everything that has been useful in my system, with notes on how to apply these configurations stored everywhere. Now I want to have someplace where I can order all that and share with anyone interested.

I hope that this time, I won't post three small things and let this blog die ...

No tags

RSS feed

Created by Chronicle v4.4