January 11th, 2010
Scenario: subversion repository installed on a home-server. Sometimes you need to interact with it from the L.A.N. and sometimes from internet.
This script other then being a wrapper for svn, checks whether the working copy needs to be relocated or not before the operations.
#!/usr/bin/env bash
GATEWAY_IP=192.168.0.254
GATEWAY_MAC=00:14:6c:ab:d2:ca
REPO_LOCAL=192.168.0.4
REPO_REMOTE=code.matteolandi.net
arp -a | grep $GATEWAY_MAC > /dev/null
if [ $? -eq 0 ]; then
source=$REPO_REMOTE
destination=$REPO_LOCAL
else
source=$REPO_LOCAL
destination=$REPO_REMOTE
fi
url_before=$(svn info | grep URL | cut -d ' ' -f 2)
url_after=${url_before/$source/$destination}
if [ "$url_before" != "$url_after" ]; then
echo "Relocating ${url_before} -> ${url_after}"
svn switch --relocate $url_before $url_after
if [ $? -ne 0 ]; then
exit 1
fi
fi
svn $@
I know you could create a new entry inside /etc/hosts and use it depending on the situation, but easy solutions are not my best!
Obviously you will find it inside the hacks/svn-tools repository.
Tags: relocate, svn
Posted in hacks, programming | No Comments »
January 10th, 2010
This morning I needed to rename my database and found these three commands I’m going to show you:
mysqldump -u username -p -v olddatabase > olddbdump.sql
mysqladmin -u username -p create newdatabase
mysql -u username -p newdatabase < olddbdump.sql
[ source: stackoverflow.com ]
Tags: database, dump, mysql, restore
Posted in tips & triks | No Comments »
January 4th, 2010
Take this as a note rather than a guide, by the way don’t forget to execute these commands as root.
Backup:
cd /
tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found \
--exclude=/backup.tgz --exclude=/mnt --exclude=/sys --exclude=/dev /
Restore:
tar xvpfz backup.tgz -C /
mkdir proc lost+found mnt sys dev
[ source Ubuntu Forums ]
Tags: backup, linux, restore
Posted in tips & triks | No Comments »
January 3rd, 2010
Tags: house, music
Posted in music | No Comments »
December 30th, 2009
Tags: chillout, langue
Posted in music | No Comments »
December 29th, 2009
Here is a funny snippet of code:
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> class foo:
... def __init__(self, x=[]):
... self.y = x
...
>>> a = foo()
>>> a.y.append("123456")
>>> a.y
['123456']
>>> b = foo()
>>> b.y
['123456']
>>> a.y.append("987654")
>>> a.y
['123456', '987654']
>>> b.y
['123456', '987654']
You better define foo as following:
>>> def foo():
>>> def __init__(self, x=None):
>>> if x is None: x = []
>>> self.y = x
Tags: arguments, default, python
Posted in programming, tips & triks | No Comments »
December 27th, 2009
Tags: house, music
Posted in music | No Comments »
December 6th, 2009
Default
http://download.eclipse.org/releases/galileo
Pydev (Python)
http://pydev.org/updates
JGit (Git)
http://www.jgit.org/updates/
Subclipse (Subversion)
http://subclipse.tigris.org/update_1.6.x
Vrapper (Vim)
http://vrapper.sourceforge.net/update-site/stable
AnyEdit (Editor features)
http://andrei.gmxhome.de/eclipse/
Tags: eclipse, update
Posted in developement | No Comments »
November 27th, 2009

I’ve just created a script which simulate a bsod by creating a fullscreen window and placing the right text in the right position.
In order to make it closer to reality, it’s better for you to download and install this font.
And now the script: bsod
Tags: bsod, gtk, pygtk, python
Posted in hacks, programming | No Comments »