Linux Snippets

Install LESS on Ubuntu with npm

LESS is available on Ubuntu repositories as “node-less” package. However, as of writing this post, it is an old version (1.3.1) which contains lots of bugs, while a newer and more stable one (1.3.3) is available. And you can install latest LESS version with npm:

sudo apt-get install npm
sudo npm install -g less

Because the command name of the node.js is nodejs (instead of node) on Ubuntu, when the installation is complete, you need to change this first line of lessc command. Open /usr/local/bin/lessc with your favorite text editor (with root privileges), and change the end of the first line from node to nodejs.

--- lessc.old	2013-05-21 13:50:00 +0300
+++ lessc	2013-05-21 13:51:00 +0300
@@ -1,4 +1,4 @@
-#!/usr/bin/env node
+#!/usr/bin/env nodejs
 var path = require('path'),
     fs = require('fs'),

After saving the file, you can test if lessc command is available, and the correct version is installed.

which lessc
lessc -v

If you have any trouble, you can ask me on the comment section below.

Linux Python Programming Web Programming

How to Run Flask Applications with Nginx Using Gunicorn

We have recently bought a VPS for İTÜ24, the online newsletter of Istanbul Technical University. The server is running on Ubuntu Server 12.04 operating system. Due to limited memory resources and performance concerns, we preferred to setup nginx as web server.

Our server will serve several web pages and applications developed in various programming languages, such as PHP, Python, Ruby (on Rails). Currently, we have one Python application, which is using Flask framework.

How we run Flask application with nginx, step by step…


Compaq Armada 110 Running Linux

My roommate has an old computer that belongs to one of his relatives: Compaq Armada 110. It’s operating system was, Windows ME and since he is going to return it after few months we are not supposed to change it. However, he is in love with Linux, and it is really hard to find proper software for daily needs (browsing web, watching movies, reading/editing documents) which runs on Windows ME.

Backing up

We decided to create image of the harddrive, install Linux, and restore image before returning it back. I created disk image with dd command:

dd if=/dev/hda of=/media/externaldisk/backup.img

It took a while, (about 3 hours) so be patient. After we backed up the hard drive, we are free to be “free” 🙂

Verifying backup image

But, I wanted to be sure about the backup is not corrupt. I wanted to try it on a virtual machine using VirtualBox. First, I thought I can run a live Linux, and use dd command to restore it back to an empty virtual drive. But then, I remembered that I’ve read something about converting image files to virtual drives. I searched on Google (you should try, it is amazing!), and reached the command within seconds.

VBoxManage convertdd /media/externaldisk/backup.img /media/externaldisk/backup.vdi

Virtual machine booted up successfully, automatically installed drivers for virtual hardware (except graphics driver). But I didn’t matter for me, because I’m going to restore image to the same computer again, and a successful boot up was all I need to see.

Now, the distro!

Since Armada 110 is ten years old, performance is important. So we had to choose a light desktop environment, like XFCE. xubuntu would be the best choice. I wanted to try latest version (11.04), and started installing. It took 40 minutes, and after a restart, it was ready. Performance? It was too much higher than my expectations.