boxfs for Ubuntu Precise Quantal ppa
Do you have a box.com Account. For those who do not know http://www.box.com, it is a cloud storage system just like http://www.dropbox.com but it uses an open standard API called OpenBox API. Domenico Rotiroti wrote a fuse driver called boxfs to mount your box.com account as a filesystem in Linux. Pretty awesome, if you compare it to Dropbox where you only sync from one folder to your Dropbox account. Well anyways over the past weekend I created a ppa repository to install boxfs onto Ubuntu in three easy steps.
- First get python-software-properties (this will give you add-apt-repository)
# sudo apt-get install python-software-properties
- * Next register my ppa ppa:flazzarini/boxfs (hit ENTER when it asks you to)
# sudo add-apt-repository ppa:flazzarini/boxfs
-
* Do an update of your apt sources
# sudo apt-get update
-
* And finally install boxfs
# sudo apt-get install boxfs
You should have everything you need, to get going. To mount your box.com account do the following.
# cd ~ # mkdir box.com # boxfs -u-p box.com/
To unmount simply do
# umount ~/box.com/
For any bugs please report them to https://launchpad.net/~flazzarini/+archive/boxfs
Conky Amarok integration – Show current playing song
Last weekend, I worked a little bit on a python script that connect via dbus to Amarok, and fetches information of the currently playing track. It also has the feature to copy the cover art to a fix location so you can use it in conky as a static image.
So for all of you guys out there using Conky and loving Amarok, here is the perfect combination of both.
For the source go to my github repository and look in tools for the python script. You can also read the entire post for the source code.
Migrate resources depending on ocf:pacemaker:ping RA with Pacemaker
The job we want to accomplish is quite simple. Let's just say you have two nodes nodeA and nodeB on two different locations which both have a individual gateways. Now let's imagine the following scenario, gatewayA goes down, and resulting in this there is no more internet connectivity on nodeA, so ideally you would want the cluster to switch to the node which still has internet connectivity. Using the resource agent ping you can create such a rule in pacemaker.
There are 3 different resource agents to accomplish this tasks, but we are going to use just one specific.
--> ocf:heartbeat:pingd (Deprecated you shouldn't use this one anymore)
--> ocf:pacemaker:pingd
--> ocf:pacemaker:ping
Configure
First let's create the ping primitive in crm and create a clone of it, so it runs on both nodes. We are going to ping ip addresses outside of the network, so internet ip addresses. For each successful ping result the p_ping primitive will score 1 point which is going to be multiplied by 100. But we'll come back on scoring later on.
# crm crm(live)# primitive p_ping ocf:pacemaker:ping params host_list="8.8.8.8 4.2.2.2" multiplier="100" dampen="5s" op monitor interval="60" timeout="60" op start interval="0" timeout="60" op stop interval="0" timeout="60" crm(live)# clone c_ping p_ping crm(live)# commit
host_list the ip addresses that are going to be pinged separated by a space e.g "x.x.x.x y.y.y.y"
multiplier each successful ping will result in a score value of 1 which is then multiplied by the multiplier value, usually you should use 100 here.
If you look at the cluster now you should see something similar to this.
Online: [ nodeB nodeA ]
Master/Slave Set: ms_drbd [p_drbd]
Masters: [ nodeB ]
Slaves: [ nodeA ]
Resource Group: g_cluster
p_fs (ocf::heartbeat:Filesystem): Started nodeB
p_ip (ocf::heartbeat:IPaddr2): Started nodeB
Clone Set: c_ping [p_ping]
Started: [ nodeB nodeA ]
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
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.
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
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')] |
Gtk using ugly theme in KDE 4.8.1 on Ubuntu 11.10 Oneiric
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!
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
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
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




