[2013-03-24] virtuelenvwrapper

install

$ pip install virtualenvwrapper

create env

$ mkvirtualenv env1

enable env

$ workon env1

You can find more information on readthedocs.org.

[2013-03-22] China nutzt Ubuntu

So cool das auch sein mag, aber wenn China jetzt Ubuntu as Standard nehmen, dann wird die USA viel Geld in die Hand nehmen um im Cyberwar diese Rechner anzugreifen. Je nach dem wer Tronjaner für solche Systeme baut, verkauft diese dann auch an Staaten die damit Ihrer Bevölkerung auflauern. Das wars dann mit der Zuversicht, mit Linux vom Staatstrojaner sicher zu sein :(

http://www.theregister.co.uk/2013/03/22/china_makes_linux_os_with_canonical_help/

[2013-03-20] sed 101

remove all lines where somestring does not occour:

sed -i -n '/somestring/p' file

keep only lines wehere stringa or stringb occours:

sed -i -n -e '/stringa/p' -e '/stringb/p' file

remove all lines with somestring:

sed -i '/somestring/d' file

[2013-03-19] autojump

first install it

sudo apt-get install autojump

then you need to source it

source /usr/share/autojump/autojump.sh

and better put it in .bashrc.

echo "source /usr/share/autojump/autojump.sh" >> ~/.bashrc

After some time you could jump quickly with

j <part of directory>

[2013-03-19] How to cope with memoryleaks in python clibs

I had to cope now a few times with some python libs that had some memory leaks. The only way to use it often was to kill the script from time to time and start it again when it was not finished.

while python somescript.py; do sleep 1; done
for user_id in d.getUsers():
    filen = "out/%s.png" % user_id
    if os.path.exists(filen):
        continue
    i += 1
    if i > 20:
        exit(0) # we are not done yet
    # ... build the figure      
    fig.savefig(filen, dpi=300)
print "done..."
exit(1)

[2013-03-19] increase the inotify max user limit

sudo vi /etc/sysctl.conf

fs.inotify.max_user_instances = 8000
fs.inotity.max_user_watches = 524000

I found here another solution.

sudo -s echo 8192 > /proc/sys/fs/inotify/max_user_instances

[2013-02-14] googles movie timetable

I searched yesterday about 20 min for this site and couldn't find it. I think it is the best site to check what movies are right now in the cinemas with timetables. http://www.google.com/movies?near=Munich

[2013-01-05] Python boolean value of an object

This is helpfull if want to use Mock-objects in Case an Object is not available, but still want to know if a real object is available or not. I found the solution at stackoverflow.

class Foo(object):
    def __init__(self, bar):
        self.bar = bar
    def __nonzero__(self):
        return self.bar % 2 == 0

[2013-01-03] Download all photos of my Picasa web album

Here is the link if you want to download all of your photos, or just a specific album from Picasa.

https://www.google.com/takeout/?pli=1#custom:picasa

[2012-12-25] Install Cyanogenmod on Samsung Galaxy S3 from Ubuntu

There are a lot of Howtos telling you how install Cyanogenmod on your phone, but most of them assuming you are using Windows. I kicked out my last Windows PC years ago so thats not an option for me.

Luckily I could combine different posts to get it working for me. Which made me even more disturbed was the fact that every how to hosted their own zip files with the images that should be transmitted to phone or even installed on your computer.

I tried to find the original websites and download the stuff from there instead of trusting that the images are ok. I would like to spend a little bit more time to find the correckt image from the offical site than trusting someone I don't know that he didn't installed a backdoor in my image :P

Preperation:

Download the following files

Install the rom manager

connect your phone to your laptop with an usb cable.

press vol down + center + power for 10 sec to enter odin mode

extract the recover.img if the rommanager was delivered as a rar file and flash the recovery loader:

heimdall --flash recover.img --no-reboot

after the progress bar is full, diconnect the device and remove the battery or the image is deleted imeadatelly after the reboot and you have to try it again.

install the cyanogen mod image

put the zip files for cm and google app to the phone. E.g external SD card.

press vol up + center + power for 10 sec until it reboots into the recovery loader

make a factory reset install from zip install cm (you need to browse to the directory where you put them) install google

reboot :)