[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 :)

[2012-09-16] Resize all pictures in one folder in place

Here we go, my first blog post.

If you want to resize all pictures in one folder and replace them with the smaller version just type

mogrify -resize 800x800 *

you need image magick installed on your system.