Archive for May, 2012

Side-by-side comparisons of programming languages

Facebook tips

You want to get the profile photo of a friend.

The profile address is . Visit (or

User info in JSON
See . Here you’ll get the user ID too.

Tip from here.

Firefox: get rid of that annoying download pop-up window

May 13, 2012 1 comment
Categories: firefox Tags:

MagPi: A Magazine For Raspberry Pi Users

Past issues: .

Read about it here (in Hungarian).

Categories: Uncategorized Tags: ,

The Debian Administrator’s Handbook

Written by two Debian developers — Raphaël Hertzog and Roland Mas — the Debian Administrator’s Handbook started as a translation of their French best-seller known as Cahier de l’admin Debian (published by Eyrolles). It’s a fantastic resource for all users of a Debian-based distribution. Accessible to all, this book teaches the essentials to anyone who wants to become an effective and independant Debian GNU/Linux administrator.” (source)

Available as:

Read about it here (in Hungarian).

Categories: ubuntu Tags: ,

MC: get the same folder in the other panel

In Midnight Commander, you want to see the same folder in the other panel.


Alt + i

It can also be a good idea to run through the manual for more tricks: “man mc” :)

Send desktop notification from your script

May 10, 2012 2 comments

From your script you want to send a notification to the user.

Solution #1

xmessage 'Warning! CPU overheated!'

It’ll open a window that stays there until the user closes it.

Solution #2

notify-send "New version of MC is out."

It looks cool (see the figure) but it disappears after a while. So if the user is not in front of the machine, (s)he may miss the message. I saw this tip here.

Categories: ubuntu Tags: ,

Google search on Apache-generated directory lists


intitle:"index of" +"last modified" 
+"parent directory" +description +.mp3

This will look for MP3 files. Try here.

Update (20140615)
Finding books on Python:

python pdf +"index of /"
Categories: google Tags: , , ,

mc doesn’t open zip files

After I upgraded Ubuntu to 12.04, I also updated mc from source. The current stable version is However, these recent versions of mc introduced some novelties. For instance, using the old mc.ext files, they won’t open archives :(

Another novelty is that the folder of mc was moved from “~/.mc” to “~/.config/mc“. So I moved my mc.ext file to the new location. I also had a symbolic link called “bindings” that pointed to mc.ext, it was moved too. Then I removed the obsolete folder ~/.mc.

Now, update your mc.ext file to the new format in order to open archives:

cd ~/.config/mc
mv mc.ext mc.ext.old
cat mc.ext.old | sed 's|\(Open.*\)#\(.*\)$|\1/\2://|' > mc.ext

Restart mc and opening the archives should work now.

This tip is from here.

Categories: ubuntu Tags: , , ,

Use Python like PHP (in public_html with wsgi)

May 6, 2012 1 comment

You want to set up a LAMP (Linux, Apache, MySQL, Python) environment at home for testing purposes.

Since development on mod_python has stopped, the recommended way to go is mod_wsgi.

In addition, we want to create a public_html directory in our HOME directory and we want to put our Python web scripts in there.

I suppose Apache2 is installed and works correctly. If you visit http://localhost/, you should see the text “It works!”.

Now, create the directory ~/public_html and put in this folder a basic index.html file with some greetings context (like “<h1>hello from index.html<h1>”). Enable the user directories and restart the web server:

$ sudo a2enmod userdir
$ sudo service apache2 restart

Now visit http://localhost/~%5Busername%5D/index.html. You should see the greetings.

Install and enable WSGI in user directories

Create the file ~/public_html/hello.wsgi:

def application(environ, start_response):
    """"Simplest possible application object"""
    status = '200 OK'
    response_headers = [('Content-type', 'text/plain')]
    start_response(status, response_headers)
    return ['Hello, World!\n']

Point your browser to this file. It’s very likely that your browser will try to download this file, which means that WSGI is not yet configured.

Install the WSGI module and enable it in Apache2:

$ sudo apt-get install libapache2-mod-wsgi
$ sudo a2enmod wsgi

Open /etc/apache2/apache2.conf and add this line to the end:

WSGIRestrictEmbedded On

For each wsgi user on the system, add the following lines to the end of /etc/apache2/apache2.conf:

WSGIDaemonProcess [user name] user=[user name] home=/home/[user name]/public_html
<Directory /home/[user name]/public_html>
    WSGIProcessGroup [user name]

Add the following lines to /etc/apache2/sites-available/default above the closing </Virtualhost>:

<Directory /home/*/public_html>
    Options Indexes FollowSymLinks MultiViews ExecCGI
    AddHandler wsgi-script .wsgi
    Order allow,deny
    Allow from all

Restart Apache2 with “sudo service apache2 restart” and point your browser to hello.wsgi. It should work fine.

Get Flask work with Apache2 + mod_wsgi
Put in the ~/public_html/hello2.wsgi file the following:

from flask import Flask
app = Flask(__name__)
application = app    # The trick is HERE! Add this extra line!

def hello():
    return "Hello Flask!"

if __name__ == "__main__":


Categories: python, ubuntu Tags: , , ,