About me

Paolo Iannelli Picture

Paolo Iannelli

Big Daddy at Mega Labs

Amsterdam Area, Netherlands
Information Technology and Services
C, Python, Big Data, Scalability, High Availability, Performance
Expert Software Engineer with more than 12 years of experience.
Strong in critical thinking, problem solving and high performance architectures.
Paolo Iannelli Labs Rss

Share files via HTTP without installing any webserver

Posted on : 20-07-2013 | By : Paolo Iannelli | In : Linux administration, Python, System Administration, Uncategorized


Did you ever been in a situation where you want to share a file and you don’t really have a way to do it ?

I mean, those situations when :

  • you would like to SCP a file, but you can’t because you don’t have your key in the other machine or is not directly reachable
  • you would like to send a file via FTP, but you don’t want to install any FTP server
  • you decide to share the file via HTTP, but then you realize you need to install a webserver with all its dependencies and nevertheless configure it

I have a solution !

Since most distributions nowadays have python installed by default, you can simply go to the directory that hosts the file and run

Port is optional and by default 8000 if you don’t specify a different one.

File listing is enabled by default, so be sure not to share any directory that contains sensitive files!

My suggestion is to put the files you want to expose to a dedicated directory and then start the HTTP server. When you are done, you can safely remove the directory.

Happy serving!

Htscanner-enhanced improves webhosting provider’s life

Posted on : 13-10-2012 | By : Paolo Iannelli | In : Linux administration, Performance Engineering, PHP

Tags: , , , , , , , , , , , , , , , , , ,


Short version

Today I spent a little bit of my time to write a small patch for the PHP htscanner module that you can normally find in PECL.

If you use Apache with mod_fcgi and you need something that parses nested .htaccess files, then you need the htscanner inclusive of the patch I wrote. Get it here :

Long version

For who is this module?

The reason why I wrote it is because I run on a scenario where I had to set specific PHP values for each vhost in my cPanel based server that is running Apache + mod_fcgi.

So this module is for anyone, such as cPanel users, that serve vhosts and want to customize PHP values per vhost in a transparent way to the user.

The problem

Since the only way to update PHP configuration values when using mod_fcgi is only by setting them inside your own PHP script, I gave a try to the htscanner module available in PECL.
The module itself is able to scan the directory where you run the PHP script and if it contains a .htaccess file it will parse it, looking for any php_value entries inside the <IfModule> directive and execute them.

That’s fine, but..

The real issue  is that it will only process .htaccess files that are in the same directory. This means that any .htaccess in the previous level won’t have any effect.

The scenario

Let’s say I host my vhosts in the /home/<username>/public_html directory.

On some vhosts I want to have the memory_limit set to default and on some set to 256MB.
Meanwhile, as a big fan of New Relic, I want to give to each vhost a specific application name, so that I can visualize its performance nicely in my New Relic dashboard.

Normally I would ask the user (or do it myself) to put an .htaccess file in the directory the scripts run (ie. the /home/<username>/public_html) :

But what if we just want to set values like this in a transparent way to the user ?
Does he really need to know that I’m setting the newrelic.appname ?
But also, what if the user replace the file or delete it accidentally?
Should I put again the file there or tell the user to fix it?
Will my dashboard in New Relic stop collecting data ?

What I can do is instead is to create an .htaccess file in /home/<username> and don’t give permissions to the user to modify it or delete it.
In this way, the user can in all cases maintain his  “own” .htaccess file in his own public_html directory, without bothering too much about settings he doesn’t have to know.

Of course he will be able to override anytime my settings anytime, but this is not in the scope of this document.

What does my modification do ?

My enhancement is very small, but what you can get with it can be valuable.

Basically, beside any other htscanner default parameters, my modification will allow you to always force the module to use the default_docroot entry.

In fact, the module will always try to find the document_root of the script that is running and look for an .htaccess.
With my mod, you can force the module to use always the default_docroot so that it will pick up each .htaccess contained in that directory and lower levels.

In this way all the .htaccess files between the default_docroot you set and the directory where the script runs will be parsed and the settings applied.

In my case, I have these settings :

Since all my vhosts are hosted using the /home/<username>/public_html structure, placing an .htaccess inside each <username> directory will let me set specific options for PHP based on the user’s vhost.

Where do I get your module ?

The module and the instructions on how to install and setup it are in its own github project page, reachable at the following address :


I hope this module can be useful to everyone and if you have any questions or concerns please let me know !

Working Varnish configuration for New Relic

Posted on : 26-09-2012 | By : Paolo Iannelli | In : Linux administration, Monitoring, Performance Engineering, System Administration

Tags: , , , ,


Enabling Request Queuing metric

If you ever wondered how to configure correctly varnish to work with New Relic; here is a quick snippet for you. Most of the code you find online doesn’t work, that’s the reason why I’m writing this post.

Just choose one of these versions, paste the code inside the first very lines of your vcl_recv sub and reload your configuration.

Compact version (spread across less lines)

Extended version (more readable but on more lines)

Reload your configuration file

Once you are done with the changes you will need to reload the configuration by triggering the following command:

If everything looks fine, then you have to restart varnish to apply the changes:

Working Varnish configuration for New Relic

If you don’t receive any error or warning message (and you shouldn’t) your job is done and you should be able to see the measurements on your New Relic interface. They will appear as “Request Queuing” metric.

Change status of Whatsapp via command line

Posted on : 13-01-2012 | By : Paolo Iannelli | In : Bugs, Security, System Administration

Tags: , , , ,


It is couple of days that whatsappstatus.net released a small app to update your status, proving the lack of security in the action.

RVDM claims in his post a way to do it via .NET and via CURL.

Since I am a command line lover, I recommend you to take a read of such post and, for very lazy people, this is the *nix command you have to issue to accomplish the task (thanks @bluesky_nl) :


Disk Nukem’s GUI is almost finished !

Posted on : 06-01-2012 | By : Paolo Iannelli | In : C, Linux administration, Software Development

Tags: , , , , , , , , ,


Hej !

Just a quick update about Disk Nukem :D

JSON and XML API’s are built around libmicrohttpd with support for HTTP Basic Authentication.

The GUI is very minimalistic but, hey, it looks nice !

Do you have any idea/improvements? Suggest them here or submit a pull request in GitHub ! (http://www.github.com/piannelli)

Here is how it looks like by now :