LiraNuna's Development Blog
PHP Path Resolution – Now PHP 5.3 compatible!
Posted on Sunday, 29 August 2010

Presenting the PHP 5.3 compatible version of my PHP path resolution class!

Why there should be a difference? Because my original version used create_function, which… created a whole new function object every time you used one of the class’s methods. This was very memory expensive and even incurred a slight performance hit.


LiraNuna @ 00:52
Filed under: Articles, Releases
Diff parser for CodeMirror
Posted on Saturday, 6 February 2010

I wrote a quick diff parser for  CodeMirror.

CodeMirror is a real-time code editor for your browser. I know that diff isn’t a format edited by humans, but I found myself needing the diff syntax highlight where other code is shown.
More on that soon.

Live Example, Download the parser.

LiraNuna @ 19:56
Filed under: Releases
PHP Path resolution class – Relative paths made easy
Posted on Saturday, 5 December 2009

Lately I’ve been working on a project that required me to handle a lot of file-system related operations, especially paths.

While PHP offers some basic functions to handle paths, such as basename and dirname to resolute the (direct) parent and base name of a path, it does not offer any means of normalizing or combining a path if it’s on a remote file system that is not in the server’s reach. If the files are local, it offers the function realpath.

I didn’t like the case and decided to write a ‘static’ utility class to handle file paths safely, without worrying about possible path masquerading from broken code.


LiraNuna @ 04:24
Filed under: Articles
libellen on devkitARM r26
Posted on Monday, 3 August 2009

Thanks to a contributed patch from Iván Vodopiviz, libellen now works on the latest release of devkitARM.

libellen also recieved an official svn repository, incorporating this patch. Get libellen latest sources from svn using:

svn co ellen

Current revision is 4, so this release is named libellen r4.

LiraNuna @ 10:30
Filed under: libellen, Releases
SSE intrinsics optimizations in popular compilers
Posted on Friday, 24 July 2009

Lately I have been playing a lot with SSE optimizations and I really enjoy it so far – using functions to tell the compiler what instructions to use makes you feel the power in your finger tips. At first I was naive and thought the compiler will do exactly what it’s being told, assuming that you know what you’re doing – looking at the SSE intrinsic header file was mostly a bunch of calls to internal GCC functions or ‘extern’ in MSVC, suggesting that the compiler will simply follow your leadership.

I assumed wrong – the compiler will take the liberty to optimize your code even further – at points you wouldn’t even think about, though I have noticed that is not always the case with MSVC. MSVC will sometimes behave too trusting at the coder even when optimizations obviously could be made. After grasping the concept of SSE and what it could do, I quickly realized MSVC won’t optimize as good as GCC 4.x or ICC would.

I read a lot of forums about people who want to gain speed by using SSE to optimize their core math operations such as a 4D vector or a 4×4 matrix. While SSE will notably boost performance by about 10-30% depending on usage, there is no magic switch to tell the compiler to optimize your code to use SSE for you, so you need to know how to use intrinsics while actually optimizing along the way, while carefully examining the resulting assembly code.

This article will closely inspect and analyze the assembly output of 3 major compilers – GCC 4.x targeting Linux (4.3.3 in specific), the latest (stable) MSVC 2008 (Version 9.0.30729.1 SP1 in particular) and ICC 11.1.


LiraNuna @ 23:33
Filed under: Articles
Securing your Debian server against slowloris
Posted on Friday, 26 June 2009

I recently came across a very nasty DoS attack that any script kiddy can execute – called slowloris. It involves sending partial HTTP packets while Apache2 patiently waits for an unreasonable amount of time for the remaining data while consuming a thread, doing so continuously will prevent Apache2 from opening more threads and serving potential web viewers.

One old remedy for this was supposedly mod_evasive, but it doesn’t really work against that specific type of attack as it acts too late to understand it’s an attack.

Very recently, an Apache mod fixing this vulnerability had been released – mod_antiloris, but it’s made with a RedHat based server in mind. Here are the steps to get it working on a Debian or any other Debian compatible server (such as Ubuntu).


LiraNuna @ 19:26
Filed under: Articles
Sintia has a Twitter page
Posted on Saturday, 13 June 2009

Sintia, the suicidal MegaHAL IRC service bot I run for over 6 years on EFnet now have a twitter page! Sintia will be updating it regularly.

Check Sintia’s page here.

LiraNuna @ 01:09
Filed under: Uncategorized
Lessons updated
Posted on Thursday, 30 April 2009

My aging NDS 2D lessons have been updated to conform to the latest version of libnds. They should now compile and run on a modern devkitARM toolchain.

I hope someone will find this useful.

LiraNuna @ 19:47
Filed under: General
NDS Blending Demo
Posted on Saturday, 4 April 2009


First I would like to start with the fact that this demo was lying around in my HDD since Halloween.

This demo was written to demonstrate how easy it is to utilize the DS’s hardware blending and create impressive effects with no effort. In this demo, the witch is flying in the sky, and whenever she’s hovering between the moon, she turns black, because the light from the moon illusions it as such.

The demo is composed of 2 backgrounds and a sprite. the sprite is set to blend with the first background (the moon) with 0 blending, resulting the black color.

Download: blending-demo.

LiraNuna @ 19:16
Filed under: Releases
Rhythmbox ‘Now Playing’ script for XChat
Posted on Friday, 27 March 2009

This is a small script I wrote for myself when using XChat and Rhythmbox.

Ever since the latest Rhythmbox release, there has been an undocumented feature in rhythmbox-client to print the string received from shoutcast streams, such as my favorite radio, which I normally have on. I found several xchat-rhythmbox announcers but they all lacked the ability to determine if rhythmbox currently streams music or listens to a music file.

Now that I actually have free time, I could write a small script to do exactly what I wanted, and I’ve decided to share it. The source/script is released under the terms of the WTFPL.

Download link: rhythmbox_nowplaying.tar.gz.

LiraNuna @ 21:39
Filed under: Releases