General-Foo linux, technology and more

6May/120

Git visualization with gource

Are you using git/svn/mercurial/bazaar as version control system and you ever wanted to visualize your work, how the project developed over time well Gource is there to visualize all this in a beautiful way. It takes the history of your svn/git/mercurial/bazaar repository and visualizes the changes over time, by whom they were done and so forth.

sudo apt-get install gource

 

Now run the following with path/to/project being your projects root directory, and give gource the .git subfolder. Run it and you should see the animation being presented.

gource /path/to/project/.git/

 

Now to export this to an mpeg4 video do the following.

gource /path/to/project/.git/ --stop-at-end --output-ppm-stream - | ffmpeg -y -b 6000k -r 60 -f image2pipe -vcodec ppm -i - -vcodec mpeg4 /tmp/gource.mp4

 

Tagged as: , No Comments
27Apr/120

Install Firebird 2.5 onto Ubuntu 10.04 via PPA

As of Ubuntu 12.04 Firebird 2.5 packages are included in the official repositories, but here I am focusing on installing Firebird 2.5 on older installations with Ubuntu 10.04 LTS. So you want to install Firebird 2.5 onto Ubuntu 10.04 without the need to install everything by hand, you can go ahead and use a ppa which has Firebird 2.5 packages. But there seems to be a problem with the gpg keys so a simple sudo add-apt-repository ppa:mapopa like it is stated on the official Ubuntu Documentation doesn't work. So here is what did the trick for me.

Mariuz's PPA

First we'll have to import the key from Mariuz's PPA by hand.

sudo gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv 0BE6D09EEF648708

 

Once we did that add the next two values to your /etc/apt/sources.list

deb http://ppa.launchpad.net/mapopa/ppa/ubuntu lucid main
deb-src http://ppa.launchpad.net/mapopa/ppa/ubuntu lucid main

 

After that you're done .. do a apt-get update and a apt-cache search firebird and you should see the following packages in your results.

firebird2.5-classic - Firebird Classic Server - an RDBMS based on InterBase 6.0 code
firebird2.5-classic-common - common files for firebird 2.5 "classic" and "superclassic" servers
firebird2.5-classic-dbg - collected debug symbols for firebird2.5-classic and -superclassic
firebird2.5-common - common files for firebird 2.5 servers and clients
firebird2.5-server-common - common files for firebird 2.5 servers
firebird2.5-super - Firebird Super Server - an RDBMS based on InterBase 6.0 code
firebird2.5-super-dbg - collected debug symbols for firebird2.5-super
firebird2.5-superclassic - Firebird SupecClassic Server - an RDBMS based on InterBase 6.0 code
26Mar/120

Run through folder add files with a certain extension to a list – Python Oneliner

Here is great Python Oneliner I came across, to put a list of files ending with a certain extension or name to a list, all this in just one line...

import os
 
list = []
list += [each for each in os.listdir('path/to/files') if each.endswith('.jpg')]
Tagged as: , No Comments
25Mar/121

Gtk using ugly theme in KDE 4.8.1 on Ubuntu 11.10 Oneiric

GTK standard theme on Kde 4.8.1

I lately updated my laptop with the latest packages and I've got KDE 4.8.1 from the ppa. To my surprise all the gtk apps that I have installed look terrible, with the standard GTK look, apps like firefox/pidgin and so on. The default theme look was change from oxygen to clearlooks, which is the default in GTK2. I knew there was a little app called gtk-theme-switch2 to change the default look of gtk, which you have to install. So a simple apt-get install got me the thing and I changed the gtk theme to the gtk oxygen theme which looks just about awesome on Kde! If you experiencing the same thing, here is how you fix it.

# sudo apt-get install gtk-theme-switch gtk2-engines-oxygen

Then start the it up and select oxygen-gtk and voila!

Tagged as: , , , 1 Comment
22Mar/121

Syncing 8TB with DRBD (what a beauty)

Hey all, this is just a screenshot, for all you nerds out there. Syncing 8TB of data with Drbd via a single 1GBps connection, crazy I know, but it was worth the test :)

Filed under: Drbd, Linux, News 1 Comment
22Mar/120

Python resize image keeping aspect ratio

This time I am posting just a little snippet which came in handy with the latest web development I am doing. The problem was to resize an uploaded image on the fly and creating an according thumbnail for that image. For testing purposes I create a script that could be executed on a number of files. So here it is

import os, sys, Image
 
size = 150, 150
 
for input in sys.argv[1:]:
	output = os.path.splitext(input)[0] + ".thumbnail"
	if input != output:
		try:
			im = Image.open(input)
			im.thumbnail(size, Image.ANTIALIAS)
			im.save(output, 'JPEG')
		except IOError:
			print "Could not create thumbnail for %s" % input
python resize.py /path/to/files/*

Hope this helps anybody coming across the same problem. Quick and dirty :)

Filed under: Coding, How-to, News, Python No Comments
29Feb/120

Using your luxtrust token with Ubuntu 11.10

For those of you out there not living/working in Luxembourg a short introduction. Luxtrust is a company based in Luxembourg selling authenication tokens or cards to use in combination with your online banking. The login they use is done via a Java Applet which is all fine so far if Luxtrust wouldn't check the version of the Java plugin in your browser and would accept openjdk icetea plugin which they don't. But as Ubuntu doesn't include the original Sun/Oracle Java 6 or 7 anymore and we are told to switch to openjdk we are stuck. So this is just a little tutorial showing you how you get online banking back on track by installing Sun/Oracle Java 6 runtime and copying/linking the javaplugin to the right place so your browser will recognize is and so Luxtrust will recognize java running on your box. In this tutorial I will only show you how this is done with Firefox, but it should be similar when you are using the Chromium Browser.

Let's get started ....

Step 1 - Install third party repo for Java

We'll add a third party repository as of Ubuntu 11.10 sun-java6-jre is not available anymore in the partner repositories, so we'll have to use the following repository.

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jdk sun-java6-plugin

You may want to also add the following

sudo update-alternatives --config java

If you get something like the following that means that you still have openjdk installed, so you should select the newly installed java6-sun. Select 2 here and press Enter.

  Selection    Path                                      Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      auto mode
  1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      manual mode
  2            /usr/lib/jvm/java-6-sun/jre/bin/java       63        manual mode
 
Press enter to keep the current choice[*], or type selection number: 2

Step 2 - Link the plugin to firefox

Now lets create a link in the .mozilla directory in your home directory.

mkdir ~/.mozilla/plugins/
ln -s /usr/lib/jvm/java-6-sun/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins/libnpjp2.so

Restart Firefox. In Addons under Plugins you should see Java(TM) Plug-in 1.6.0_26 beeing listed. To check if everything works as planed go to the following site.

https://secure.dexia-bil.lu/ssl/trust/lxtst_checker.asp

13Feb/120

Amazing uptime so far at Linode

Here a prove of how awesome the hosting @ linode really is. If you are looking for a hosting provider which offers a lot with an easy to use dashboard to configure/install your OS, look no further. I had my machine running for more than 470 days, but I had to reboot in order to boot to the latest kernel. Here is a screenshot of htop showing the uptime.

uptime @ gefoo.org small

Tagged as: , No Comments
31Jan/121

Simple Conky configuration PlainConky

PlainConky Fullscreen
Hey you all out there, today I want to show off my very simple but nice conky setup that I use on my Laptop. The layout is fairly small to match the resolution of my laptop's monitor. The configuration uses only conky functions and uses the fonts Terminus and AvantGardeLTMedium. For those that don't know what conky is head over to the conky website or check out these awesome configurations here or here. But if you want to have a simple setup something to start off with I suggest you start using mine and adjust it to your liking.

It features visualizing things such as CPU Usage, Temperature, Memory Usage, current ip address depending on which device is up, if wlan is up information on that device is shown, if eth0 is up that information is shown, Disk Usage, and General Date/Time information.

plainconky.conf

use_xft yes
xftfont Terminus:size=8
xftalpha 0.8
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_class conky-semi
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
background no
double_buffer yes
minimum_size 300 200
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
default_shade_color black
default_outline_color white
default_bar_size 150 5
default_gauge_size 20 20
imlib_cache_size 0
draw_shades no
alignment top_right
gap_x 5
gap_y 35
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no
default_color ECEAE4
color1 9f907d
color2 01C400
 
 
 
TEXT
${font AvantGardeLTMedium:bold:size=10}${color Tan1}Info ${color slate grey}${hr 2}${font}
${color1}Date               	${alignr}${color slate grey}${time %a,}${color}${time %e %B %G}
${color1}Time			${alignr}${color}${time %T}
 
${font AvantGardeLTMedium:bold:size=10}${color Tan1}System ${color slate grey}${hr 2}${font}
${color1}Hostname		${alignr}${color}${nodename}
${color1}${sysname}		${alignr}${color}${kernel}-${machine}
${color1}CPU			${alignr}${color}${freq_g}GHz
${color1}Loadaverage		${alignr}${color}${loadavg 1} ${loadavg 2} ${loadavg 3}
${color1}Uptime			${alignr}${color}${uptime}
${color1}Battery Status		${alignr}${color}${battery_short BAT1}
${color1}Cpu Temperature	${alignr}${color}${acpitemp}C
${color1}Hdd Temperature	${alignr}${color}${hddtemp /dev/sda}C
 
${font AvantGardeLTMedium:bold:size=10}${color Tan1}Processors ${color slate grey}${hr 2}${font}
${color1}Core 1		${alignr}${color}${cpu cpu1}%  ${cpubar cpu1}
${color1}Core 2		${alignr}${color}${cpu cpu2}%  ${cpubar cpu2}
 
${font AvantGardeLTMedium:bold:size=10}${color Tan1}Memory ${color slate grey}${hr 2}${font}
${color1}Memory 	${color}${alignr}${memeasyfree} / ${memmax}
${color1}Currently	${color}${alignr}${memperc}%   ${membar}
 
${font AvantGardeLTMedium:bold:size=10}${color Tan1}Filesystem ${color slate grey}${hr 2}${font}
${color1}/		${color}${alignc}${fs_used /} / ${fs_size /} ${color}${alignr}${fs_free_perc /} %
${color}${fs_bar 5,300 /}
 
${font AvantGardeLTMedium:bold:size=10}${color Tan1}Networking ${color slate grey}${hr 2}${font}
${if_existing /proc/net/route wlan0}${color1}Ip		${color}${alignr}${addr wlan0}
${color1}AP		${color}${alignr}${wireless_essid wlan0}
${color1}Signal		${color}${alignr}${wireless_link_qual_perc wlan0}${wireless_link_bar 10,100 wlan0}
${color1}Download	${alignr}${color}${downspeed wlan0}${downspeedgraph wlan0 10,100}
${color1}Upload		${alignr}${color}${upspeed wlan0}${upspeedgraph wlan0 10,100}
${color1}Total Down/Up	${alignr}${color}${totaldown wlan0}${color1}/${color}${totalup wlan0}
${else}${if_existing /proc/net/route eth0}${color1}Ip		${color}${alignr}${addr eth0}
${color1}Download	${alignr}${color}${downspeed eth0}${downspeedgraph eth0 10,100}
${color1}Upload		${alignr}${color}${upspeed eth0}${upspeedgraph eth0 10,100}
${color1}Total Down/Up	${alignr}${color}${totaldown eth0}${color1}/${color}${totalup eth0}${endif}${endif}
 
${font AvantGardeLTMedium:bold:size=10}${color Tan1}Top Processes ${color slate grey}${hr 2}${font}
${color1}${top name 1} 	${alignr}${color}${top cpu 1} ${top mem 1}
${color1}${top name 2} 	${alignr}${color}${top cpu 2} ${top mem 2}
${color1}${top name 3} 	${alignr}${color}${top cpu 3} ${top mem 3}
${color1}${top name 4} 	${alignr}${color}${top cpu 4} ${top mem 4}
${color1}${top name 5} 	${alignr}${color}${top cpu 5} ${top mem 5}
Tagged as: , 1 Comment
10Jan/123

Drbd partition mount check bash one liner

This is just a quick tip for you out there that use DRBD in simple Primary/Secondary mode and need to check whether a script is executed on the node which is currently Primary and has the Drbd Filesystem mounted. Let's just say you need to copy stuff onto your Drbd partition via a cron script. You can use the following one liner which is checking on the device '''/dev/drbd0''' which you probably need to adept to your needs and will print a message to standard output if this is the node which is holding the resources. Just replace that message output with the command you would like to execute and you are good to go.

if [ "`mount | grep /dev/drbd0 | wc -l`" == "1" ]; then echo "We are holding the resources"; fi
Filed under: Bash, Crontab, Drbd, Linux 3 Comments