Pavol Rusnak #cypherpunk #hacker #openhw #privacy #bitcoin #newmediaart

Idea Factory - Semantic Patches on Github

This post is a part of Idea Factory series.

Two years ago someone sent me quite weird pull request on Github. It took me some time to realize that the only change was the removal of whitespace at the end of the lines of all files. Commit message contained a link to some software development company so the whole effort could be considered as some kind of spam or publicity stunt.

But it sparked an idea!

When I was at FOSDEM I saw a great talk about Coccinelle which is a tool for semantic patches. These are similar to normal patches, but they contain something like expressions which are being matched during applying of the patch. That way they apply the change to usually more places of the codebase not just one (which is the case when using “normal” patches). Basically, you want to come up with most generic “rule” that fixes one particular issue, but it’s not triggered at any other time. Some examples how Coccinelle was used in Linux kernel development are here.

Another quite common example (which I’ve seen at many, many places while working as a package maintainer at SUSE) is the wrong usage of strncpy function. The last argument has quite different meaning than the one used in strncat function. It is the maximum length of the appended string, not the size of the whole output buffer. The patch fixing this issue is similar to the following:

--- source.c
+++ source.c
@@ -34,7 +34,7 @@
   return 0;
-strncpy(buf, player, sizeof(buf));
+strncpy(buf, player, sizeof(buf) - sizeof(player) - 1);
 if (verbose)

This patch obviously fixes the problem only at one particular place. Semantic patch that fixes all wrong usages of the function might look like this (but please don’t take my words for granted, I have not tested it):

identifier dest, src;
-strncpy(dest, src, sizeof(dest));
+strncpy(dest, src, sizeof(dest) - sizeof(src) - 1);

So back to the idea:

  1. Collect the most common programming mistakes people make.
  2. Create semantic patches for fixing them.
  3. Write a bot that scans Github for these issues and creates a pull request when necessary.
  4. PROFIT!

While writing this post I found this article which says that bots are generally not welcome on Github. But I think if the pull requests are reviewed by a person and the fixing rules are beneficial to everyone, then it might really be worth a try!

Idea Factory - Facebook Random Comics

This post is a part of Idea Factory series.

Recently my friend sent me a link to this great random comic generator at Pandyland. My idea is to create a similar application but instead of the drawn figures it would use your friends photos from Facebook. One could check which of his/hers friends should appear in the comic (or leave it to a random chance), select the layout of the comic strip (e.g. 3x1 frames, 2x2 frames, etc.) and click the generate button. The application then calls the Facebook API which returns reasonable photos together with their metadata (such as who is in the picture and at what pixel position, the API already includes that kind of info in the results). Next step is to add speech bubbles filled in with either random sentences or leaving the bubbles empty so one can add his/hers own replicas. Lastly, a nice frames and a title are added, so the result could be shared back to Facebook or any other webiste as one image.

Idea Factory - Coin Counter

This post is a part of Idea Factory series.


The idea is simple: create a mobile phone application that is able to count coins (and their values) from the photo. You pour coins from your wallet on the table, make sure they don’t overlap by spreading them, take a photo and voila the phone will tell you exactly how much money in coins you have. User can select what currency is she using (dollars/cents, euros/cents, etc., to make the recognition easier). Using OpenCV or some other computer vision library should make this task pretty easy.

Special points awarded if the application is using realtime augmented reality, but for this particular case it is not necessary.

Idea Factory

From time to time I come up with the “ultimate idea”, but because I don’t have usually time to implement it right away I put it in my backlog. Unfortunately, the backlog is growing bigger and bigger and I started to realize there are some ideas on the list to which I’ll never return, but still they would be nice to have. There are lots of bright minds out there, so I decided to start publishing the ideas from the backlog list. Maybe someone will find them interesting enough and implement them. Heck, maybe someone will be able to build a successful startup around some of them. For that case I put the donate section in the sidebar, so you can do me a favor once you are a millionaire. :-)

But, enough talking, here are the ideas! I’ll keep adding links to this list in the future:

  1. Coin Counter
  2. Github Semantic Patches
  3. Pack My Stuff
  4. Mycelium Animated Photos
  5. Facebook Random Comics

Ars Electronica Festival 2012

Last week I attended Ars Electronica Festival with an additional title “The Big Picture”. This was quite a new experience for me, because I usually visit technical conferences, while this one was more about art (but tech was of course present as well!).

The first evening in Linz I decided to spend with folks from hackerspace Linz called DevLoL. Technically, it’s not a hackerspace yet, because they are still waiting for their premises, but once they get them, it’s gonna be great! They are promised around 1000 square meters of space in a former tobacco factory, now a culture centrum called Tabakfabrik. Hopefully they’ll be able to do some amazing projects there soon. We had a great discussion about stuff we do at brmlab and I got some valuable input as well. It’s always nice to see more and more hackerspaces to appear in new places.

The other days were mostly about Ars Electronica. I attended quite a lot of expositions, talks and events. If you’ve never been to Ars Electronica Center, go there, their main exposition is amazing and the tickets are quite cheap (8 EUR full price).

During the festival these two projects caught my eye: CogniToo and BioBookCover. The first one is basically a tattoo of your fMRI scan. The times when people were tattoing the names of their loved ones are past, the future is having a fMRI scan of your brain while thinking about your love. :-) The second one is an attempt to create biodegradable (starch based) plastic, which can be made in amateur environment (like a kitchen) and will dissolve in few days (in contrast to few centuries) in nature if thrown away.

From the talks I mostly enjoyed the talk from Golan Levin. He started with the following image:


I think it’s really a good way how to describe current efforts in technology. He didn’t said that explicitly, but my opinion is that artists are leaning towards interesting-beautiful side and hackers towards useful-interesting side of things. There are also other groups like for example designers, which are positioned somewhere else in the triangle. Golan showed us some examples of interesting-beautiful projects like: Most Wanted and Least Wanted Paintings by Komar Melamid, Every Playboy Centerfold by Jason Salavon or The Secret Lives of Numbers by himself.

Other nice talks I attended were about about Free Universal Construction Kit and Apertus, an open source camera. It’s nice to see that an idea of open-source hardware is advancing in these more-or-less artistic fields as well.

But undoubtedly, the main attraction of the festival were so called Klangwolke (Sound clouds). This is a tradition that happens on the bank of Danube river every year and this time there were around 90000 participating people. Around one thousand of them used an opportunity to make a big blinking letter during the festival and these were connected via network during the performance. The letters were not the only things blinking, we also had a chance to see buildings with projections and 50 quadcopters flying changing colour and flying in nice formations. See the video for yourself:

I’d like to thank all people I hanged out with (especially Prokop who made the trip possible and Szara who kindly sheltered me) and I hope I’ll be able to visit the event next year as well!