Archive for February, 2008

VideoLAN (VLC) patch

Check it out, I’m in VLC code! o_O

No Comments

Ferien / Vorlesungsfreie Zeiten

Du kannst auf http://stud4.tuwien.ac.at/~e0625457/cal/Ferien.ics einen Kalendar abbonnieren, der die Ferien enthält. Die URL wird erhalten bleiben und gefüllt. Patches/Anmerkungen sind willkommen.

No Comments

Current calendar week on Desktop

This should say all:

Calendar-Desktop
Your next week calendar as Desktop background.

This is a hack. The script opens Sunbird (which you configured before), takes a screen shot of the window, closes Sunbird, cuts away the borders of the image and sets it as GNOME desktop background.

You will have to edit the pixels to cut off (depending on your theme).

#!/bin/bash
#TEXT="2 Friday"
TEXT="Friday" # next friday, so on saturday we see the next week
TOP=176   # in px
LEFT=112
BOTTOM=26
RIGHT=18
BACKGROUND='#76848F'
DATE=$(date --date="$TEXT" "+%m/%d/%Y")
WEEK=$(date --date="$TEXT" "+%-V")
FILENAME="$HOME/current-calendar.png"
TITLE="Week $WEEK - Sunbird"
killall sunbird-bin 2>/dev/null
sunbird -showdate "$DATE" 2>&1 &
# mozilla is slooow...
sleep 20
#import -crop "+$TOP+$LEFT" -window "$TITLE" $FILENAME
#import -crop "+$TOP+$LEFT" -rotate 10 -window "$TITLE" $FILENAME
#import -crop "+$TOP+$LEFT" -rotate 10 -monochrome -window "$TITLE" $FILENAME
import -crop "+$TOP+$LEFT" -window "$TITLE" - |
convert - -gravity NorthWest -crop "-$RIGHT-$BOTTOM" -colorspace Gray - |
convert - -colorspace RGB -background "$BACKGROUND" -rotate -10 $FILENAME
killall sunbird-bin
which gconftool   2>/dev/null >/dev/null && GCT=gconftool
which gconftool-2 2>/dev/null >/dev/null && GCT=gconftool-2
$GCT --type=string --set /desktop/gnome/background/picture_filename "$FILENAME"
wait 

Also see MDC Command Line Options

No Comments

compiling elinks on Stud4

Lynx respectively the configuration on stud4 has some problems with control-keys. Luckily, elinks compiles fine on stud4. You can even browse with tabs and the mouse using it.

wget elinks.or.cz/download/elinks-current-stable.tar.gz
gunzip elinks-current-stable.tar.gz
tar -xf elinks-current-stable.tar
cd elinks-0.11-20080214/
./configure
gmake
src/elinks

No Comments

Converter Extension for deskbar

Do you know units? It’s a small forgotten unix program (like cal) that converts units … It tells me it supports 2411 units, 71 prefixes and 33 nonlinear units. Not bad, huh?

So let’s use this in the deskbar-applet. Some friendly neighbor already did this, I updated it to 2.20 new-style classes.

Screenshot: Deskbar-Applet-Units

Code: converter (py, 6 KB)
Don’t use this anymore. Try this updated version!

Download to your Desktop, then drag and drop it into the deskbar preferences window. Or copy it to ~/.gnome2/deskbar-applet/modules-2.20-compatible.
Don’t forget to enable it in the preferences.

Yaha, you need to install the units program first!

,

1 Comment

Lynx – External Editor

Cool feature I just found in the Lynx Manual: In e.g. textareas, where is normally
not possible to add a new line in the middle of the text) you can open the external editor with ^Xe (Ctrl-X e)

You can specify the external editor with the -editor argument, e.g. lynx -editor=pico

No Comments

Python – Load Module from File (by Filename)

You know where a file is and want to load it as a module.

This loads from the file test1 from the directory in which this file is located too.


import os
import imp
def myimp(name):
thisdir = os.path.dirname( myimp.func_code.co_filename )
filename = os.path.join(thisdir, name + ".py")
fp = file(filename, "r")
description = (".py", "r", imp.PY_SOURCE)
return imp.load_module(name, fp, thisdir, description)
test1 = myimp("test1")

No Comments

Good bash.org comments

This grays out lowrated bash.org entries from the random site. Open the file random2 with a browser, e.g. Epiphany (as it automatically reloads the file on changes)

wget bash.org/?random1 -q -O - |
sed 's/\(<p class="quote">.*<\/a>([0-4]\?[0-9]\{1,2\})<a .*<p class="qt"\)/\1 style="color: lightgray !important;"/g' > random2

No Comments