Archive for January, 2013

.xsession-errors can grow HUGE

January 31, 2013 1 comment

Something funny happened to me today. I logged in to my desktop machine at my workplace when a warning message told me that “disk space is low”. A quick “df -h” indicated that it’s true, my HDD is at 100%! How is it possible, I should occupy no more than 30%. After hunting for 10 minutes for the guilty file/directory, it turned out that the file .xsession-errors in my HOME directory grew more than 200GB! WTF?

I removed this file and under the name .xsession-errors I put a link on /dev/null. However, after a reboot the symbolic link was gone and .xsession-errors became a regular file again. Tricky :) So I added the following lines to the end of my .bashrc file:

# .xsession-errors can grow huge... remove it
if [ ! -h $HOME/.xsession-errors ]
    /bin/rm $HOME/.xsession-errors
    ln -s /dev/null $HOME/.xsession-errors

if [ ! -h $HOME/.xsession-errors.old ]
    /bin/rm $HOME/.xsession-errors.old
    ln -s /dev/null $HOME/.xsession-errors.old

It verifies if .xsession-errors is a symbolic link. If not, remove it and replace it with a symbolic link.

Lock and unlock the screen from command line

January 30, 2013 Leave a comment

Is there a way to lock/unlock the screen from a script?

The answer is “yes”. Lock the screen:

gnome-screensaver-command -l

Unlock the screen:

gnome-screensaver-command -d

Demo (lock the screen, then unlock it in 5 seconds):

gnome-screensaver-command -l && sleep 5 && gnome-screensaver-command -d

Tip from here.

How to disable the HUD’s use of the Alt key?

January 30, 2013 Leave a comment

Pressing the Alt key brings up the HUD. How to get rid of it?


Launch System Settings, then Keyboard -> Shortcuts -> Launchers. On Key to show the HUD, press Backspace to disable it.

Categories: ubuntu Tags: , , ,

Rip streamed audio

January 30, 2013 Leave a comment

You want to rip a streamed radio.


  • fetch StreamRipStar, which is a frontend for streamripper
  • install streamripper (via apt-get)
  • configure StreamRipStar, specify the audio stream’s URL and start ripping

If you want to rip Slay Radio (best Commodore 64 tunes!), use this address:

Make room! Make room!

January 29, 2013 Leave a comment

Under Gnome/Unity, you want to increase the number of virtual workspaces.

Start CompizConfig Settings Manager (ccsm), then General -> General Options -> Desktop Size tab. Here adjust the horizontal and vertical virtual size.

The title of this post is a reference to a novel of Harry Harrison.

Categories: ubuntu Tags: , , ,

VLC gets stuck

January 29, 2013 Leave a comment

On my Linux box, VLC gets stuck sometimes and only the good old “kill -9” can shoot it out. Is there a single command to kill it?


alias killvlc='kill -9 `ps ux | grep vlc | grep -v grep | tr -s " " | cut -d" " -f2`'
Categories: bash Tags: ,

Online Convert(er)

January 27, 2013 Leave a comment

I wanted to convert a PDF with Calibre but it failed. I tried with Online Convert(er) too and it succeeded…

Categories: Uncategorized Tags: , , , ,


January 27, 2013 Leave a comment

Torcache is a free service for caching t. files online. I noticed by accident (got a timeout error…) that one big t. site stores its t. files here too.

Categories: Uncategorized Tags:

Automate a Windows application from Linux using Python

January 22, 2013 Leave a comment

For my everyday work I use Linux. I also have a Windows 7 in VirtualBox. Under Windows I’ve found a very nice movie catalogue called Movie Collector. It’s not free though; unfortunately I didn’t find any good open-source alternative for this task.

So, I had this software running in VirtualBox and I wanted to input a list of movies. I collected the list in a file. Movie Collector has a GUI interface where you can insert the title of a movie and it’s put in a queue (see the figure below). Then you can verify for each item if it found the correct movie.

The question is: how to insert the movie titles via the GUI interface in an automated fashion? I won’t type 100 titles by hand…


It’s a perfect job for Python. There is a great module called autopy that includes functions for controlling the keyboard and mouse. I already had it under Linux. Fortunately, you can launch an autopy script under Linux and it can interact with a Windows GUI that runs in VirtualBox.

The idea is simple: read the input file, where there is a movie title in each line. Put the movie title on the clipboard (we are lucky again, if you put something on the clipboard under Linux, it’s available under Windows too in VirtualBox). Click in the Title text field, select everything with Ctrl+A, press Del to delete the content, paste from the clipboard and click on the Add to Queue button. Then repeat: take the next movie title, etc.

The following script does exactly this:

#!/usr/bin/env python

from autopy import key
from time import sleep
from jabbapylib.mouse import mouse
from jabbapylib.clipboard.clipboard import text_to_clipboards

TITLE = (68, 124)    # input text field's position
ADD = (575, 123)     # button's position

def delete():
    key.tap('a', key.MOD_CONTROL)    # Ctrl+A
    key.tap(key.K_DELETE)            # Del

def paste():
    key.tap('v', key.MOD_CONTROL)    # Ctrl+V

def add():

def main():
    cnt = 0
    with open('movies.txt') as f:
        for title in f:
            title = title.rstrip('\n')

            cnt += 1

    print cnt


if __name__ == "__main__":
    print 'Switch to VirtualBox...'

The imported modules are here:

To figure out the position of GUI elements (to know where to click to), you can use this little helper.

Cobol Tutorial

January 14, 2013 Leave a comment

Just for fun: Cobol tutorial.

To be clear, I don’t ever want to touch Cobol. This is just for the record :)

Categories: fun, programming language Tags: ,

Get every new post delivered to your Inbox.

Join 62 other followers