on Wednesday, July 10, 2013
I recently bought a Synology DS213+ and I have to say it's awesome. Initially I wanted to run SABnzb and Sickbeard directly on the NAS. Unfortunately this setup has two problems. First of all with the SABnzb and Sickbeard packages installed on the Synology, the NAS never goes into hibernation (standby) anymore. There is a workaround that suggests having the log files of these two applications on a USB pen-drive but I never got this to work for me. The second problem is the transfer rate. SABnzb on the Synology NAS only gave me between 3 and 4 MB/sec while running it from a desktop computer in the same network gave me between 10 and 12 MB/sec.

Finally I decided to continue running SABnzb and Sickbeard on my desktop computer and to copy new files manually onto my Synology NAS via FTP. I run the common post-processing setup using sabToSickBeard.py.

Keeping track of new files and manually uploading them to the NAS is a bit tedious. That's why I decided to start the upload as part of the post-processing. Here is what I did. Go into your folder containing the Sickbeard post-process scripts, i.e. ~/.sickbeard/autoProcessTV, and in that folder create a new file upload.py with the content listed below.

This is essentially a copy of this script on stackoverflow with some of the extra features like encryption, sftp and walk removed. Find the line that says FTP_PWD and replace it with the password of the FTP user on the Synology NAS. Plain FTP is not very secure, so you might as well have the password in the file - and yes I don't care so much about security since everything is behind a router and a firewall anyways. Make upload.py executeable, i.e. chmod +x upload.py

Now make a backup of the original autoProcessTV.py file that comes with Sickbeard and replace it with the file I have listed below. In the new autoProcessTV.py file replace FTP_USER with the username of the FTP user on your Synology (i.e. ftpuser). Replace FTP_PATH with the shared folder where you want to upload to (i.e. video). Replace FTP_HOST with the ip address of your NAS (i.e. The modified script works as the original. The upload it triggered whenever a line is printed that starts with “Moving”. From that line, the target directory in Sickbeard is extracted and uploaded via FTP to the NAS. Enjoy.

on Monday, January 14, 2013
Ever wanted to know the total size of the memtables in your Cassandra cluster? Here is a little oneliner which gets you the total size in bytes.

on Thursday, January 10, 2013
I found it annoying that Cygwin asks for the passphrase of your private ssh key every time you are starting a ssh connection. In the regular bash shell under Ubuntu it would remember the passphrase so it only needs to be entered once. Here is a nice recipe that helps Cygwin remembering the passphrase (thanks to this blogpost). In your ~/.bash_profile add the following at the end:

on Tuesday, August 28, 2012
Today I had to use Redis for the first time which doesn’t seem very well supported under Windows at this point. Coming from Linux I try to use Cygwin under Windows as often as I can. So here is what I did to build the latest Redis version (there were some old binaries for download but I wanted to use a newer version). First make sure you have the Cygwin packages “make” and “gcc” installed. Then open a Cygwin terminal and follow the steps under “Installation” but do not run “make” yet. Before you run “make” open the file src/redis.c and add the following block somewhere on top of the file (I have copied it just one line before the #include statement):

This is a manual change which I found in this issue. Finally run “make”. Ignore the warnings. If all goes well, you should have a bunch of new .exe files at the end. redis-benchmark.exe, redis-check-aof.exe, redis-check-dump.exe, redis-cli.exe and redis-server.exe – copy them into the bin folder of your Cygwin installation and restart the terminal. To test execute “redis-cli -h <your-redis-server> -p <your-redis-port> ping” and hopefully get a pong back.
on Tuesday, August 7, 2012
Next week I'll be changing jobs inside EA. My time at Playfish will be over and I will be working for another studio in Stockholm. Playfish mail is running on the Google mail infrastructure. I am sure I won't be able to access my corporate mail account after I have left, so I thought it was a good idea to get a backup of all my corporate emails. One promising program is gmvault, which I found after stumbling upon an old Matt Cutts blog post about backing up Gmail on Linux yay. Matt is suggesting getmail to get the job done but the project seems to be dead since 2009.

I am running Ubuntu 10.04 Lucid Lynx. First I installed me a new virtualenv, which you should always do if you are required to install new pip packages (gmvault). Just follow these instructions to get started with virtualenv. Once you have your virtualenv activated run pip freeze, to check what packages are installed. If you created the virtualenv with the –no-site-packages option like me, there should be 2 packages distribute and wsgiref. Make sure the distribute package is at least in version 0.6.24. On my Ubuntu 10.04 I needed to upgrade.

Finally install gmvault in your virtualenv and run it.

First it will print some instructions for you. After pressing Enter a browser window is opened and you have to log into your mail account. You will be told that the program gmvault wants to access your credentials. Click accept. This will store a Gmail XOAuth token to your local disc, i.e. as /home/user/.gmvault/reik.schatz@old-company.com.oauth. This token is now used by gmvault to access your email account. Press Enter again and start the download. It took about 3 minutes for 1200 emails to be downloaded via imap. On a side note, if you want to learn more about imap and python, you should read this great book which I just finished.
on Tuesday, July 17, 2012
Done compiling a FiSH module for irssi, which runs on Debian 6.0.5 64-bit. As some of the guides out there are somewhat broken, because links have changed and so on, I decided to post a newer version here.

First verify what system you are running on.

Alright, so we are on Debian x86_64. Lets install some prerequisites.

This will install you irssi and some irssi sources in the same version (0.8.15 on Debian 6.0.5). Now run the following commands line by line. This is basically following this or this guide, but some of the links have changed.

Now it's time to update the Makefile. Change the first 3 lines to the following values.

Make sure these directories exist. They should have been created earlier when installing the packages above. Double check that glib_inc contains glib.h and gmodule.h. Finally run:

This might give you some warnings but if you didn't get any errors, you should now have a libfish.so file. If you get error messages, start reading the make output from the top. The first time I tried, it couldn't include glib.h and gmodule.h because I had the wrong directory configured in Makefile.

To use you new fish module, copy it to the proper location.

To autoload the fish module during irssi startup add a line to you startup file.

Voila enjoy encrypted irc chat.
on Friday, June 1, 2012
Today I spent some time chasing ghosts and a missing textarea value in my POST data. All form elements were posted correctly but the textarea was missing. I am using the WYMeditor for the textarea to turn the element into a rich text field. The textarea was missing from the POST data because it has it's style attribute set to display:none. This is something that the class="wymeditor" attribute does to the textarea. The important bit is the submit button which also needs a class attribute. Something I had missed when copying from the demo page for the WYMeditor. After giving the submit button a class="wymupdate" everything works just fine.