Updating LoopiaDNS from Tomato and DD-WRT firmware

Posted 30/01/2012 by khromov
Categories: Computers, Technical solutions, Tutorials

Tags: , , , , , , , ,

Loopia is one of the largest Swedish hosting providers and offers a free dynamic DNS service for any domain you own.

They have a great API which can be updated with a number of dynamic DNS clients. They also provide the possibility to update via a HTTP GET request, which we can use in Tomato and DD-WRT.

Go to Basic -> DDNS, select Custom URL as service and enter the URL below, swapping username, password and domain.com for your own values:


If you want to update multiple hostnames to the routers IP address, you can use comma delimited values in hostname, for example:



If you have a wildcard record (*.domain.com) it will get wiped, unless you append


to your request. Read this page for more info. (Swedish)


Updating LoopiaDNS from DD-WRT can be done via a startup script, check this forum post for instructions.

You can visit https://www.loopia.com/loopiadns/ for information about LoopiaDNS in english.

Tweaking Bulletstorm for PC

Posted 29/12/2011 by khromov
Categories: Computers, Games, Technical solutions, Tutorials

Tags: , , , , , , ,

A couple of days ago I picked up Bulletstorm during the Steam Holiday Sale.

Bulletstorm is an excellent shooter, but it has been given a pretty bad PC port.

Luckily, since it’s based on the Unreal engine (UDK) you can tweak away any shortcomings using the configuration files.

First, you will need a tool to edit the obfuscated config files. Here are some mirrors for it:
Mirror 1 Removed due to DMCA request
Mirror 2

On Windows 7, the configuration files are located in:

C:\Users\<your account name>\Documents\My Games\BulletStorm

Important: If you use the tool above to open the configuration files directly from this folder, you need to run the tool with administrative privileges.

Now, start out with this excellent article by Ars Technica. It will help you fix things such as Mouse Smoothing, locked framerates and poor field-of-view in the game.

After this, there is one more important bug to fix – the scope view.

By default, the scope view (a.k.a. the aim down sight) has a fixed sensitivity that is unaffected by the in-game sensitivity setting. This means that if your in-game sensitivity is set very low, for example due to a high DPI mouse, the scope view will be too sensitive.

To fix this, we will need to adjust the internal Unreal engine mouse calibration.

In StormInput.ini, find the line MouseSensitivity and change it to a lower value, like this: (Default is 60)


This setting affects both the scope view and the regular sensitivity, so you will also have to increase the sensitivity in-game after this tweak.

Here are the settings I run in-game. Of course, the graphical settings are subject to your card.

Speaking of Bulletstorm…
Some UI design choices in this game are really weird, here’s one that stumped me the first time, let’s see if you spot it:

Collect visitor stats using any image with the Piwik Tracking API

Posted 10/11/2011 by khromov
Categories: Computers, Programming, Technical solutions

Tags: , , , , ,

Piwik is an open source web analytics system in PHP and a great alternative to Google Analytics.

It offers simplified tracking via an image tracking code:

<!-- Piwik Image Tracker -->
<img src="http://example.org/piwik/piwik.php?idsite=1&rec=1" style="border:0" alt="" />
<!-- End Piwik -->

In some scenarios, you might not want to expose that you are using Piwik analytics, or would like to avoid loading unnecessary resources.

Let’s use the Piwik Tracking API to turn any image into a tracker. This is useful for websites, newsletter stats and email signatures alike.


You need to have a Piwik install running with administrative access. Apache is required to get a “nice” image url.

Step 1 – Setup Piwik

Create a new website in Piwik, which will contain your stats for the image. Make note of the new site ID (Visible in Settings > Websites)

Create a new user and give that user admin rights to the website. Make note of the token_auth for that user. (Under Settings > Users)

Step 2 – Get the PiwikTracker.php Tracking API

You can obtain this file by going to the following URL (Replace example.org with your piwik install path)


You can also find a copy of the file here.

Step 3 – Build the tracking code
Pick an image you’d like to use, name it stats.png and put it in a folder on your web server. I am going to use this “thumbs up” clipart. Also put PiwikTracker.php in this folder.

Now, create the file stats_t.php. (Base code below) Change line 3 and 4  to your own site id and the token_auth of the user you created in step 2. Also set your Piwik URL at line 10. If you want to distinguish between multiple tracking images, you can change line 22 to have a different message. That means you can track any number of images using one site in Piwik.

    //Set the id of your piwik site here
    $idSite = 1;
    $token_auth = 'your user token here';

    //Load Piwik Tracker
    require_once 'PiwikTracker.php';

    //Set the URL path to your Piwik Installation
    $t = new PiwikTracker($idSite,'http://example.org/piwik');

    //Auth to allow for more API functions

    //Set correct IP (Should be users, not the web server issuing the request)

    //Set referrer (if applicable)

    $t->doTrackPageView('Image viewed');

    $im = imagecreatefrompng("stats.png");

    //For transparency (Alpha blending)
    imagealphablending($im, true);
    imagesavealpha($im, true);

    //Set header
    header('Content-Type: image/png');
    //Output image
    //Unload image

You can set many more visitor details, refer to the reference.

Create a .htaccess file in the same folder. We will use this to rewrite the URL so that we can still use a .png extension for the file. When stats_t.png is called, Apache will instead load stats_t.php , which will run the tracking code.

RewriteEngine On
RewriteRule stats_t.png stats_t.php

Your folder structure should now look like this:

Verify that your image is displayed properly in a web browser by navigating to stats_t.png

Verify that Piwik recorded the visit correctly. If it did not, make sure you have entered $token_auth and $idSite correctly.

Step 4 – Display your new tracking image anywhere

Now you can include your image anywhere, like this:

<img src="http://khromov.se/email2/stats_t.png" alt="thumbs up" />

If you would like more information please see the official documentation of the Tracking API.

Let me know if this helped you out or if you have any suggestions or improvements!

Update: Now includes referrer tracking. If the image is used on a page, you will see what page it is used on. (See line 19 and 20 of stats_t.php)

Review: Deus Ex: The Missing Link brings the atmosphere

Posted 30/10/2011 by khromov
Categories: Games

Tags: , , , , ,

Just played through the first DLC to Deux Ex: Human Revolutions – here’s my thoughts on it. (Warning, contains light spoilers.)

Let’s get it out by saying that at it’s current price point of 11EUR/15USD, it’s not really worth it. I agree with Kirk Hamiltons Kotaku review and do feel that GameTrailers went very soft when giving it a 7.9/10.

The world you are presented with is claustrophobically small, the side missions almost nonexistent, the main plot irrelevant in the larger scope of things and the ending a huge anticlimax. (Guess they really took that forced boss fight criticism to heart.) The length isn’t great either – I breezed through it in three hours. Don’t even get me started on the security scans that serve as a substitute for loading screens – they take three times as long to get through and since the game forces you to run back and forth in the same three parts of the ship you’ll see plenty of them.

At least they’re pretty though!

What I did like were the vistas the game presented you with. Even though the world itself is small, each corridor is packed to the brim with atmosphere. Deus Ex: Human Revolutions was a beautiful game, and The Missing Link takes it up another notch. Below is an album of some more of the gritty scenery you’ll be presented with throughout the course of the game. While the looks don’t atone for the other flaws, it does make The Missing Link noteworthy if you are a series diehard or simply enjoy lots of pretty (if cramped) visuals.

GOMTV.net RSS Feed

Posted 23/10/2011 by khromov
Categories: Computers, Technical solutions

Tags: , ,

Hey everyone!

I have whipped up a quick RSS feed for the e-sports site GOMTV.net using the excellent Feed43 service, that can be used to convert any web page into an RSS feed.

Simply add this to your RSS reader to get the latest VOD updates:


Let me know in the comments if it works for you and if it breaks. The feed is open for editing so you can also fix it yourself if you’re feeling up to it. 🙂

Updated to reflect new page structure.

PHP function for obfuscating e-mail addresses and phone numbers using Javascript.

Posted 04/10/2011 by khromov
Categories: Computers, Development, Programming, Technical solutions

Tags: , , ,

Update 2012-12-23

The technique below is now available as a WordPress plugin. Check out the Email Obfuscate Shortcode plugin!

Here’s a short snippet that I have been using in various PHP projects to protect e-mail addresses and phone numbers against being harvested for spam purposes. It uses Javascript to scramble some text and output it as a self-contained piece of Javascript. It’s compatible with all major browsers (and IE5.5 and up). The idea is based on this ruby snippet, so head over there if you want to read more about the way it works!

safe_text() snippet

function safe_text($text)
    if(mb_detect_encoding($text, 'UTF-8', true))
        $text = utf8_decode($text);

    $ret = '
<script type="text/javascript">// <![CDATA[
                    var t=[
    $chars = str_split($text);

    $enc[] = rand(0,255);

    foreach($chars as $char)
        $enc[] = ord($char)-$enc[sizeof($enc)-1];

    $ret .= join(',',$enc);
    $ret .= '
                ]; for (var i=1; i<t.length; i++) { document.write(String.fromCharCode(t[i]+t[i-1])); }
// ]]></script>';

    return $ret;

To output the Javascript anywhere (it’s entirely self-contained), simply run:

echo safe_text('bob@examplecorp.com');

Update: Thanks to Fredrik for a fix that makes this function multibyte safe! It now also works with special characters like å,ä,ö and similar.

/dev/india – Post-India picture dump, Part 2

Posted 03/09/2011 by khromov
Categories: /dev/india, Computers

Tags: , ,

Long-delayed part 2 of previous post coming up – most of these are already on Facebook and Google+, so you should have seen them already.

There’s been a ton of interesting stuff happening – our app is entering beta in the days to come, I’ve been to Paris, and now school and part-time work is starting again.

In other news, I’m refusing to concede to the current erratic blogging schedule, so there’s a new strategy to make posts more frequent – I have created empty posts and scheduled them to publish every two weeks using WordPress. This guarantees at the very least an update every 14 days, even if it might be short, but the goal is to write something – no matter how small.

Below is a short video of when we were driving to the High Street Phoenix shopping mall, featuring music by Alexander Brandon.