Show last logins after logging in

Display current open connections, all of today and yesterday’s entries

Did a Sunday project today: Print last logins after you connect to your remote machine.

Can also be used locally.

Sorts the last logins, listing their connection times and duration. Also warns you of active connections.

The default Message of the Day is hardly useful, so today i just enough time to make it prettier.


Follow the steps written in the github page to add it to your bash login, or run it locally.

Expect a slight delay when logging in, as it reads all the latest entries from the /var/log/wtmp.

Have fun

Xcom : Enemy Unknown Tech Tree plus Armor and Weapon Stats

Xcom : Enemy Unknown Tech Tree

XCOM: Enemy Unknown is a great game but the tech tree left me terribly confused. The existing tech trees graphs ( on which i based mine ) helped a bit, but i thought there was plenty of room for improvements.

It turned out like this. I hope it helps you!

XCOM:EU – tech tree ( High Resolution )

XCOM:EU – tech tree ( Low Resolution )

Also, here’s the SVG version for your immediate changes. Feel free to alter it. Let me know if there’s anything wrong with it.
XCOM:EU – tech tree ( SVG )

Fonts used:

xolonium by Severin Meyer ( GNU General Public License )
Lavoir by Alex Chavot ( SIL Open Font License )
Tulpen One by Naima Ben Ayed ( SIL Open Font License )


Javascript tests and results

I’ve been testing some basic javascript functions in the awesome Some confirmations about the native browser code being faster, but strangely, there’s a huge difference in performance. I started wanting to know the difference between using a strange js code i found online. It used .html().html("<img [...]") every cicle. Surely this wasn't the best way to handle a photo gallery counter. 

getElementById vs jQuery id selector

run the test: jquery id vs document.getElementById
jQuery ID :  $(“#foo”);

result: 305,690 92% slower

document.getElementById : document.getElementById(“foo”);

result: 3,824,633 fastest

jquery id vs getElementById


Unless i did something terribly wrong, native implementation is way faster. I would expect to be faster, but not in this order of magnitude.



jQuery 1.8 selectors: id vs class vs tag vs pseudo vs. attribute

run the test: id vs class vs tag vs pseudo vs. attribute selectors
There’s a lot of results on this test, and almost every entry points to the $("#foo") selector being the fastest, class $(".bar") and tag $("blockquote") on the same range, and pseudo and attribute $(":hidden") and $("[name='baz']") are really slow.

jquery selectors 1

appendChild VS jQuery appendTo

appendChild vs appendTo
Next, i created a test for appending a child node to a html element. the element was created outside the test.

appendChild :  document.getElementById(‘testc1′).appendChild(newdiv);

result: 2,087,401 fastest

appendTo : $(newdiv).appendTo(‘#testc1′);

result: 8,250 100% slower

appendChild vs appendTo


Again, i wasn’t expecting such a huge difference between native and jQuery performance.

Creating complex elements

run the test: creating and appending elements (by WTK)

The following test tries to append several html elements
Passing full html string to jQuery

var elements = "<div><table><tr><td>1</td><td>2</td></tr></table></div>";


Create elements by hand but still using jQuery

function create() {
  return $("<div>").append($("<table>").append('tr').append('td'));

Using innerHTML

var elements = "<div><table><tr><td>1</td><td>2</td></tr></table></div>";
var div = document.createElement('div') = 'mycustomdiv'
div.innerHTML = elements;

insert elementsinsert elements firefox ie other


Sadly, the browser implementation differs greatly from chrome to the rest, so innerHTML is still a bit and miss.

Creating a image node with attributes

What started as a simple gallery turned out as a great opportunity to do these performances tests. The source didn’t have a license and the code behave so badly, that isn’t wor

Test Ops/sec
 no jquery

var newimg = document.createElement("img");	 
newimg.alt = "Test Image";	 
newimg.src = '';	 
newimg.onclick = function(){ swapCase();  };	 
$('#testc2').append($('<img>', { 
    alt : "Test Image",
    src : '',
    click: function(){
8,575 41% slower
jquery alternative
$('#testc3').append( $(document.createElement("img"))
        src: '',
        alt: 'Test Image'
7,950    49% slower

How to make Cucumber run faster

Speed up the startup time of cucumber for TDD/BDD tests

Getting started with Behaviour Driven Development with Cucumber and noticed that it takes more time to startup than actually run the scenarios.

Compare this:

2 scenarios (2 passed)
4 steps (4 passed)

real 0m16.013s
user 0m14.850s
sys 0m0.814s

Cucumber reports 0m2.252s but time says 0m16.013s, thats ~~14seconds of difference.

Remember: user time represents the time the application spent on user-mode, actually running the code, where as sys represents the time spent on kernel. real is the full time from start to finish

Using spork as a DRb server

(DRb = Distributed Ruby server)
Note from spork site

Because Spork uses Kernel.fork, it only works on POSIX systems. This means Windows users are not invited to this party. Sorry :(

For your rails app, follow this procedure:

Add spork to your Gemfile

gem 'spork'

Run bundle install

and rails g cucumber:install --spork

Finally run spork server on the background:

bundle exec spork cuc &

And happily run tests:

cucumber features/...

The conclusion: it works!

2 scenarios (2 passed)
4 steps (4 passed)

real 0m3.946s
user 0m0.658s
sys 0m0.059s

Syntax hightlight theme for Ruby/Rails/Haml in Aptana

I have a thing for code and colours. Let it be lolcode, lpsolve syntax for whatever the editor i’m using at the time, i have to tweak it.

This time i’m learning Ruby/Rails/Haml and whatnot. My favorite editor for WebDev has been Aptana with the Clouds theme, (a bit edited already) but it didn’t support ruby. So here it is “Clouds of Ruby”.

What does Clouds of Ruby look like?

Clouds of Ruby :: Ruby/Rails

Ruby/Rails Theme for Aptana

Clouds of Ruby :: HAML

HAML Theme for Aptana

Where to get Clouds of Ruby?

download Clouds of Ruby Theme. I recommend the Anonymous Pro font to go well with it.

To use, go to Preferences->Aptana Studio->Themes->Import. Change at will and have fun coding!

Stop internet censorship. Say no to PIPA and SOPA

Today’s the day of the world stood against the proposals that would create laws to censor the internet based on denounces without due process!

Although you may have heard about SOPA, please take note that there’s a similar proposal called PIPA that is also being discussed but is not getting attention.

If you live in the USA,  please write or call your representatives, or use this form: to stop PIPA and SOPA.

These proposals are also very dangerous for everyone outside the US. Although these are US based laws, don’t forget that many domains that have a .com, .org, or .net are considered as domestic to the USA, so they fall under these laws jurisdiction. We know that corporations have been influencing the European governments like the recent cases of France, Portugal and Spain, to push similar laws into our own civil codes.  A censored internet is the end of public sharing of knowledge and we all have been thankful for this. So thank you for taking action!

say no to PIPA and SOPA

say no to PIPA and SOPA

Lpsolve Syntax Highlight for Geany IDE

Add Lp Solve extension

Lp solve files Syntax highlight for Geany

An example of Lp solve files Syntax highlight in Geany

First, we need to add the extension file, so geany knows what file it can associate to lp solve files.

Either go to:  Tools -> Configuration Files -> filetype_extensions.conf

or:  edit directly the file in

Linux: ~/.config/geany/filetype_extensions.conf

Windows 7 :  c:\Users\username\AppData\Roaming\geany\filetype_extensions.conf

and add a new line with


Download Lp Solve syntax highlight file

Next, download this syntax highlight file:  filetypes.Lpsolve.conf

and place it in ~/.config/geany/filedefs/ (Linux)

or c:\Users\username\AppData\Roaming\geany\filedefs\ (Windows 7)

More information on syntax highlight

Note:  if not bothered to download this file, you can add the extension to any existing filetypes, for example:


Many thanks to editor.