Igor Moiseev Applied mathematician, Web Developer

Remove old kernels in Ubuntu

To remove old linux kernels and leave the current one

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

Be aware, the command uses uname -r to get the current kernel.

Clone repository from Subversion to Git

Here we discus how to migrate the Subversion repository into a new Git repository. We'll do it with a handy git svn utility. We will refer Gitlab/Github as the destination Git server.

Create a new project on Gitlab: http://\<gitlab-address\>/projects/new and clone it into your local machine

git svn clone http://<svn-address>/<projectname>
cd <projectname>
git remote add origin git@gitlab.newentity.it:newentity-sas/<projectname>.git
git push -u origin master

Now backup your SVN project folder

cp -raux <projectname> <projectname>.`date +'%Y%m%d'`

And remove .svn folders

cd <projectname>
rm -rf `find . -type d -name .svn`

Init GIT

git init

Config GIT

git config --global user.name "Full Name"
git config --global user.email "Email@example.com"

Check the remote url

git config remote.origin.url

Change the remote origin

git config remote.origin.url git@<gitlab-url>:<username>/<projectname>.git

Create a .gitignore file

echo "<projectname>.sublime*" > .gitignore

Add files

git add .

Commit il progetto

git commit -m "init <projectname>"
[master 820fe97] init <projectname>

Pull and merge from remote

git pull

Push into remote

git push -u origin master

Apache2: AH01630: client denied by server configuration

The Apache web server of the version 2.4 introduces a new style for <VirtualHost> configuration, in particular the <Directory> syntax is not compatible anymore with the previous one 2.2.

The old styled configuration valid in the Apache <= 2.2 version

<VirtualHost *:80>


    <Directory "/var/www/html/example.com/public">
        Options MultiViews FollowSymLinks
        AllowOverride all
        Order allow,deny
        Allow from all



the modification is introduced in the part

Order allow,deny
Allow from all

the new way to describe the access permitions is reduced to just one line

Require all granted

finally the correct <VirtualHost> configuration will look like the following

<VirtualHost *:80>
    ServerName  www.example.com
    ServerAlias example.com

    DirectoryIndex index.html index.php index.htm
    DocumentRoot /var/www/html/example.com/public

    <Directory "/var/www/html/example.com/public">
        Options MultiViews FollowSymLinks
        AllowOverride all
        Require all granted

    # Logfiles
    ErrorLog  /var/log/apache2/example.com/error.log
    CustomLog /var/log/apache2/example.com/access.log combined

Fail2Ban starting 200/error on Ubuntu 10.04 or older

If you get this sudden error in the fail2ban.log

2015-04-20 11:13:17,722 fail2ban.jail   : INFO   Jail 'apache-honeypot' started
2015-04-20 11:13:17,739 fail2ban.actions.action: ERROR  iptables -N fail2ban-apache-honeypot
iptables -A fail2ban-apache-honeypot -j RETURN
iptables -I INPUT -p tcp -m multiport --dports apache-honeypot -j fail2ban-apache-honeypot returned 200

most likely you have spotted the character length limitation on the chain name.

I've discovered that the limit is 16 for the chain name length, but Fail2Ban prefixes it with fail2ban- string which eats so precious 9 characters so the only 7 remaining.

To solve this issue you need to rename the iptables action to something like name=HONEY

$ cat /etc/fail2ban/jail.conf

enabled  = enable
filter   = apache-honeypot
action   = iptables-allports[name=HONEY, protocol=all]
logpath  = /var/log/asterisk/full
maxretry = 3
bantime  = 600

Thas it! The issue is observed on Fail2Ban ver. 0.8 or older.

My current projects

Elliptic functions for Matlab and Octave

Star  Fork

The Matlab script implementations of Elliptic integrals of three types, Jacobi's elliptic functions and Jacobi theta functions of four types.

The main GOAL of the project is to provide the natural Matlab scripts WITHOUT external library calls like Maple and others. All scripts are developed to accept tensors as arguments and almost all of them have their complex versions. Performance and complete control on the execution are the main features.


Email2DB for PHP

Star  Fork

Email2DB parses the email schema into the relational schema. It supports major SQL engines: MySQL, PostgreSQL, Microsoft SQL server and MongoDB support will be rolled down latter.

Build Status  Gitter

Tech Blog

Star   Fork

This is a public space for thoughts on MySQL and PostgreSQL. Ceph's Storage clustering and KVM virtualization. Programming with NodeJS and PHP. Hacking with RaspberryPI and Arduino. Please feel free to modify any text in it.

Build Status  Gitter