PyLint and Pep8 validation in geany

If you’re into python, but don’t know about PEP8 or PyLint, you should find out right now. And because pep8 and pylint are great, but it’s hard to force yourself to use them all the time, lets integrate them into geany, a fast and lightweight IDE.

First download the packages containing pylint and pep8. For arch linux, they’re called pep8-python3 and pylint respectively. The names may differ for other distributions.

Now start geany and open the Build menu. Open Set Build Commands.

Click on the button next to the number 2. and give it a proper name, e.g. pep8lint. Now put the following command next to it:

This basically calls both programs and prints their output into the compiler panel at the bottom  of the screen. Now, to highlight all lines that don’t validate, we need to set up a regular expression like so:

This regular expression matches the output of pep8 and pylint. Geany interprets the first group as the name of the source file and the second group as the line number.

This is how your configuration should look like

This is how your configuration should look like

To valiate, just press F9, since that launches the second build command.

Everything is red now. Great.

sourceallred

Using a Raspberry Pi to connect a third display over LAN

I’ve received my rPi a while ago, but never wound up doing much with it. Recently I have received another screen which is a little older, but still features a DVI input. Since developers can’t have enough screen space and my laptop has only one VGA output, I decided to use the raspberry pi as my ethernet-to-DVI adapter.

IMG_20130331_200140

This how-to is composed of two parts, first I explain how to get synergy up and running, and then how to set up your VNC to help the illusion that everything is happening on the same computer.

Continue reading

3to2 by hand – back porting python 3 to python 2

As mentioned in an earlier post, I’m currently writing a music streaming server in python. As I wanted to go with the newest thing available, I wrote it in python 3. Unfortunately the application server we rely on, cherrypy, is only packaged for python 2 in most distributions! Even worse, even if the packages were installed for python 3, it would not run, since I relied on python 3.3 features.

Since this keeps my program from being used in the world, I decided to backport it to python 2. For me it was very important, that the code would not get any uglier by doing so, so I started writing a replacement module.

Here’s a collection of useful code snippets to help you making your software python 2 / 3 compatible.

Continue reading

Raspberry Pi Case DIY

I finally got myself a Raspberry Pi and it obviously needs a case. (By the way, it runs the ARM version of Arch Linux, naturally.) Of course I wanted to build one myslef, rather than buying one of those boring cases that almost cost more than the device itself. I already had a vague idea about the concept but nothing solid yet. The concept had to be simple (but solid), because besides a Dremel and an electric drill I only had standard tools at hand. (You do not even need a Dremel if you have a small saw instead.)

Continue reading

CherryMusic – A Music Streaming server for your browser

I recently wrote a Music Streaming Server in python, that allows you to listen to your music inside a browser, no matter where you are. It is called CherryMusic and features a standalone webserver based on cherryPy as well as JPlayer, a HTML5/Flash music player. It indexes your data for fast search using a sqlite database, so there is nothing to setup for you, just download the sources and off it goes!

In my tests it works perfectly with many thousand indexed files: searches are returned immediately, even on my  little home server.

You can download the sources from github or download them directly from the projects page. Any suggestions for improvement are welcome.

After the break you can find some screenshots of it in action.

Continue reading

Conway’s Game of Life in 3 Lines of Python

I recently saw a video of an implementation of Conway’s game of life written in APL which was done in just one line. And because I couldn’t sleep last night, I implemented it in python as short as I possibly could.

So here it is:

There’s a little write-up and the source after the break.

Continue reading

Indexing large tar files for fast access using python

I recently needed to get some data out of a large tar file, about 5gb in size, that I didn’t want to extract, as it contained many thousands of small files. Unfortunately the tar format was not designed to be indexed, since it was meant for backups on magnetic tapes (tar stands for tape archive). The gnu tar has a command for retrieving single files, but it needs to go through the whole tar each time, which was just not doable.

So I decided to write a little tool, that would index the files and write that index to another file. Now I can access each file within the tar in just a second, instead of 15 minutes. Introducing the tarindexer!

Continue reading

DIY: Building a Japanese shoji-style ambient lamp — the nerd way

This is another old project that I made a while ago. I have to admit, the idea itself is stolen from instructables.com and you can see that the outcome looks similar at first glance. But I wanted to take a different approach. While I really like the shoji-design, I wanted my lamp to be more solid and long-lasting. Besides, I prefered the size (and ratio) of the DIN-A4-format, so that I can easily replace the paper without trimming it first, in case it gets damaged or i want to change the color. It has a beautyful ratio (297 / 210 = √2). The lenght of the sticks within the frame are chosen in a way that the rectangular pattern on the frame also has a ratio of √2.

Continue reading