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

32C3 Highlights

These are my highlights from 32C3 (32nd Chaos Communication Congress):

The exhaust emissions scandal (“Dieselgate”)

thumb

How the Great Firewall discovers hidden circumvention servers

thumb

Thunderstrike 2

thumb

PQCHacks

thumb

Rowhammer.js: Root privileges for web apps?

thumb

Let’s Encrypt – What launching a free CA looks like

thumb

Logjam: Diffie-Hellman, discrete logs, the NSA, and you

thumb

Tor onion services: more useful than you think

thumb

Computational Meta-Psychology

thumb

Say hi to your new boss: How algorithms might soon control our lives

thumb

Ten years after ‘We Lost The War’

thumb

Sin in the time of Technology

thumb

LÖVE (Love2D) on Android

Almost two years ago I blogged about my Global Game Jam entry called Hexoboros. This year’s approacing GGJ reminded me that I wanted to port this game to Android. Back then it turned out to be quite hard and results were not very satisfying.

I knew that SDL 2.0 was released in August 2013 bringing Android support out of the box. What I didn’t know was that LÖVE 0.9.0 was released in December as well, building on top of SDL2. I was pretty excited, because I felt that LÖVE on Android will became a real thing soon.

And I was right. Martin Felis is working on love-android-sdl2 repo, which combines all these efforts into one easy to build Android package.

After fixing some minor issues in Martin’s and mine code I ended up with this result:

hexoboros-android

Great! Now I’m convinced that I’ll be using LÖVE again during Global Game Jam this year.

Some notes:

  • love-android-sdl2 loads LÖVE resources from /sdcard/lovegame/ directory (this is useful for debugging)
  • if you zip your LÖVE resources to a file named game.love and add this file to assets directory of Android project, you end up with APK that bundles LÖVE with your game (this is great for deploying final game)
  • never force fixed resolution in your LÖVE code; rather update your code so it works with any given resolution and aspect ratio (i.e. don’t hardcode sizes and positions of rendered objects)
  • you can test you got that right by putting t.window.resizable = true in your conf.lua and using something like this in your main.lua code:
function love.resize(w, h)
  width, height = w, h
  scale = height / 1024
end

function love.load()
  love.resize(love.window.getWidth(), love.window.getHeight())
  ...

Idea Factory - Pack My Stuff

This post is a part of Idea Factory series.

Last two years I travelled a lot to various Open Source related conferences. After few of them I already got quite a good idea what to pack and what not, depending on the length and the destination of the trip. But from time to time I forgot something and that later turned out to be a huge mistake.

The idea is to create a mobile application where you can define several lists of things you need to pack, for example: “3 days in Europe (summer)”, “a week in the USA (winter)”, “Christmas with Family” and so on. You open the application while packing packing your stuff at home and it will show you the list of things you need to pack. Everytime you put an item into your suitcase, you check the corresponding checkbox in the list. When the list is fully checked you know you didn’t miss anything. Simple, isn’t it?! :) You do the same process on the last day of your trip, so you can make sure you don’t forgot anything at the hotel.

Idea Factory - Mycelium Animated Photos

This post is a part of Idea Factory series.

One evening I found really nice work by Ryan Alexander where images are created by simulating a life of mycelium. I was wondering how it was done and I came up with my own Processing sketch that creates something similar (although not as quite nice as the original work).

The principle is simple: you take an image and convert it to grayscale. The brighter (or darker) is the pixel, the more food you put on that particular position. Then you run several autonomous agents that feed from this food, move randomly, die if they are starving and multiply if they are well enough. The original photos and the mycelium growing process can be seen here:

img

The idea is to create a mobile phone application that is able to take a photo from a camera (and/or open a gallery photo) and runs the described process on it. The final result or animated GIF of the process could be then uploaded to the Internet and shared among your friends.

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!