Resolving DNS with OpenWRT

I use MAMP for local PHP development server and it has a very nice option to automatically set up ServerAlias using so that the virtual host will become accessible from LAN. This is especially nice to allow communication between tablet and my virtual host.

Screen Shot 2017-07-13 at 11.25.37.png

This worked well in the office, but my home OpenWRT router seemed to block such usage. Turns out that it has a security feature to filter out DNS results that point to private networks, otherwise known as RFC1918 responses.

Allow RFC1918 Private Network DNS responses

To allow OpenWRT to forward such responses, open the web interface, and navigate to DNS settings.


In the General Settings tab, scroll down to find Rebind Protection and add as whitelisted exception.openwrt_rfc1918_exception.png

Now try to access your domain from your LAN and it should work as intended.

MacOS Estonian Development keyboard layout

My previous post about creating custom Estonian layout using Ukelele has gone seriously outdated.

Nowadays customising layouts is a lot simpler, as is sharing your custom layouts.

My new customised EstonianDev layout has the following modifications compared to stock layout:

  • Option+ä will result in ^ (caret symbol)
  • Key next to Backspace is now correctly producing   acute accent (´) and grave accent/backtick (`)



  1. Download  the file (sorry for the .zip – WP does not allow .dmg files to be uploaded directly)
  2. Unzip and mount the image
  3. Drag the EstonianDev.bundle to the Keyboard Layouts folder linked into the DMG
  4. Add the new layout from Input Sources
  5. Enjoy!

GIT merge-svn

How to use GIT to merge two SVN branches

TL;DR: Download the git-merge-svn script here

I’ve been using git for years now but had to start using SVN for some projects. I found that GIT is good enough Subversion client too, especially as I retain the ability to commit often and rebase my work on top of commits from other devs (on the SVN side).

The only question arose – can I merge two SVN branches so that GIT log will show the merge?

The git-svn manual states that one should avoid all git clone|merge|pull|push activity when using git-svn.

But git log does show merge history that was created in Subversion – how does it do that?


Subversion does not support actual merge of branches (more like cherry-picking), but since version 1.5 Subversion supports the svn:mergeinfo property that is used to track what has been merged into this folder previously.

Digging some more into the matter, I found out that GIT supports setting svn:mergeinfo property on the SVN branch when dcommit‘ing:

git svn dcommit --mergeinfo "/branches/somebranch:1-3"

NB! the svn:mergeinfo is overwritten with whatever is given on the command-line, so be careful to list previous merges too.

While more recent git version added the config parameter to automatically set this property:

config key: svn.pushmergeinfo

I had some troubles with the automatic mergeinfo – for one reason or the other GIT calculated it wrong and I couldn’t get it to work.

SOLUTION: git-merge-svn

To automate the process, I wrote a shell script git merge-svn which can be used to merge two SVN branches with correct svn:mergeinfo set on the dcommit.

The script handles both situations:

  • the branch is not merged in git – will do git merge beforehand
  • the branches have been already merged in git (but not in SVN) – will traverse until previous ancestor for the merged commit revisions.

UPDATE: Thanks theantway and haraldreingruber for patches – the script now:

  • always does full merge (no fast-forward) so that SVN can fully understand and
  • does not die on first merge (no previous mergeinfo)

Download the git-merge-svn script here

Example usage

With this script I was able to produce these merges solely on git-side and retain the merge info so that GIT graph shows the log nicely:

git-merge-svn result

  1. Make some commits on devel6
  2. dcommit devel6 to SVN (required to get SVN revision numbers for the commits)
  3. check out testtunk6 – yes, I know I made a typo in the name 😉
  4. git merge-svn devel6

The last commant outputs:

% git merge-svn devel6
About to do an SVN merge: devel6 -> testtunk6

| * devel6 [7b71187] (r102)
* | testtunk6 [0682a45] (r101)
  * [273d6d6] (r100)

STEP 1: GIT merge
  git merge --no-ff devel6

Continue? (y/n) [n]: y
Merge made by the 'recursive' strategy.
 testfile | 1 +
 1 file changed, 1 insertion(+)

STEP 2: SVN dcommit

git svn dcommit --mergeinfo
/idp/branches/devel:9-32,35-41 /idp/branches/devel6:89 /idp/branches/devel6:94 /idp/branches/devel6:93 /idp/branches/devel6:96 /idp/branches/devel6:97 /idp/branches/devel6:99 /idp/branches/devel6:100 /idp/branches/devel6:102

Continue? (y/n) [n]: y
Committing to ...
  M testfile
Committed r103
  M testfile
Found merge parent (svn:mergeinfo prop): 7b71187fc371d3f86658c5850009e63be88157ac
r103 = 87759323cbadd38bac78087d57b6870a926287e7 (refs/remotes/svn/testtunk6)
No changes between 3fb2168cfbbe605fbd810d76513443203a85a549 and refs/remotes/svn/testtunk6
Resetting to the latest refs/remotes/svn/testtunk6

Turn Linux into a remote AirPlay speaker

Some time ago Apple game out with the AirPlay feature (an upgraded AirTunes) which enables iOS devices and iTunes play music and videos on a remote device.


In our office we have a Linux box, a set of speakers and a few laptops sporting Mac and Windows. Tonight I set out with a goal to turn that Linux box into an AirPlay speaker so that each of us can play music from their laptop without having to reconnect the cables every time.


First off I stubled upon RougeAmoeba’s Airfoil, which is a $25 sofware piece that, enables half a dozen device classes to be hooked up as remote speakers to a Mac or Windows (yes, that too). And, better yet, instead of only enabling iTunes to play, it can reroute all sound to that remote speaker. Though, it’s Linux speaker software is free download, it still seems to require paid Airfoil to route audio, because bare iTunes couldn’t care less of the wannabe Linux speaker that should have appeared to the WiFi. As the price would have been multiplied by the number of laptops, it was unfortunately out of question.


With a bit of googling around, I next found Shairport, which (if I got it correctly) is based on data found in a hacked and reverse engineered AirPort Express. ShairPort turns a random PC into a fake AirPlay speaker set. The software itself got installed relatively quickly after going through the short docs (perhaps because I had most of the dependencies like avahi etc already in place because of the Airfoil).


Also, for Airfoil, I had already opened firewall to Zeroconf/Bonjour and ports TCP:5000-5005 and UDP:6000-6005  which seemed to apply to Shairport too.

After starting up the daemon, all of our iTunes magically discovered the new remote speakers and allowed us to play music there with a simple mouse click. Even from Windows. And from iPhone. And, if wanted, all at the same time. Voila!

This is definitely much easier than messing with the wires all the time.


desopafy Wikipedia

Today Wikipedia has a blackout. This is because US is passing a law that can threaten open Internet.

Please read all about the SOPA blackout in the Wikipedia article. I have signed a petition against SOPA and I am fully concerned about what this could mean to Internet.

Wikipedia is main source of information for me and when googling around I hit Wikipedia dozens of times a day. I would not even like to think about what it would be like if Wikipedia would be blocked, because of linking to webpages that, among other things, contained some alleged pirated materials.


Now what?

Having said all this and having already put in my 2 cents, I now have work to do and this blackout is hindering my progress, even if for just one day. Fortunately Wikipedia has not removed itself from Internet. It only has drawn a black blanket over it’s contents. So, after viewing this black page and dedicating a few (milli)seconds to think about the consequences of SOPA, tech-savvy people can still reach the articles and make use of them.

NOTE: This post is not about avoiding Wikipedia blackout. This post is about getting work done, after you have signed some anti-SOPA petition or written a letter of concern to the US Senate or your own Ministry of Foreign Affairs if you live outside US.


There are several ways to still access Wikipedia today. Wikipedia itself has pointed out that mobile Wikipedia is still accessible and as the blackout is JavaScript-based, disabling JavaScript, will avoid the blackout too. But being JavaScript based, the blackout can also be reversed with JS. My initial code was a bit crude, so I googled around and found a more thorough version (thanks timraymond and kballenegger). Add this link to your bookmarks (or drag it to your bookmark bar):


This bookmarklet will hide the blackout and show the Wikipedia article. But please, do at least think of what this blackout means, before you remove it.

Gimp Resyntesize: remove unwanted objects from photos

Probably many of us have seen at least demos of using Photoshop to un-clutter your photos, resulting in almost unseemingly removed objects and restored background. While I won’t argue that Photoshop does excellent job at this, it is good to know that open-source GIMP this functionality too.

The GIMP Resynthesizer plugin makes it easy to intelligently remove unwanted objects from photos. There seems to be a 2.0 version of this plugin available at the developer’s github page (bootchk/resynthesizer), but I haven’t tried that yet.

How this plugin works has been covered number of times before, (e.g this “Content-Aware Fill” clip or this resynthesizer tutorial), so I won’t go into details of this here.

Only difference for me was that I used the Enchance > Smart remove selection... filter rather than Map > Resynthesize... and the result is displayed below.

Using GIMP Resynthesizer to remove unwanted objects

Overfilled ZFS won’t delete files

Today I ran into a trouble when I had filled my ZFS filesystem and tried to free up some space:

$ rm
rm: Disc quota exceeded

The same error was given for all kinds of rm options, recursive, force, etc.

Digging around, pointed me to this post and that B solution was excellent:

$ ls -larth
-rw-r--r--  1 laas  wheel   344K Apr 19  2009

$ cat /dev/null >
$ rm

Though this only freed up 344 kilobytes, it was enough that I could remove the file itself and then move on to more bigger files to free up the needed space.

Note: It was pointed out to me that the ZFS filesystem was compressed, which would shed light on the whys of the problem, as modifying compressed structures might increase the size, whereas truncating is the only option to decrease it.

Chrome ad blocking

I noticed that all of a sudden my Google Chrome (Mac OS X version) has a ~ 10s delay between displaying a web page and making the links clickable.

At first I suspected my password manager extension that it scans through the page for possible forms to fill, or some other extension. So I went through a Search and Destroy sequence with all of my extensions but for avail, until I disabled the AdBlock extension.
Suddenly all is fast again. Alas, now the ads slow it down.Read More »