All posts by Daniel Șerbănescu

How to fix xdg-open in Mate DE

Users of Linux Mint or other GNU/Linux distributions that use MATE Desktop environment have surely encountered this problem where xdg-open does not work properly.

This is most often seen when using Chromium  browser and trying to open a downloaded file. Almost every time it fails to open the file with the right software. To fix this you have to fix xdg-open.

Here is a quick fix:

  1. Go to Menu > Terminal
  2. Enter gksu pluma /usr/bin/xdg-open
  3. Search for detectDE(), then above this line else DE=””, insert a new line:
    elif [ x"$MATE_DESKTOP_SESSION_ID" != x"" ]; then DE=mate;
  4. Search for open_gnome(), then after the section of open_gnome() {…}, insert a new section:
    if gvfs-open --help 2>/dev/null 1>&2; then
    gvfs-open "$1"
    mate-open "$1"
    if [ $? -eq 0 ]; then
  5. Search for this line case “$DE” in, and after this line, add a new section:
    open_mate "$url"
  6. Save the file and retry the download links.

Create thumbnails for any size image with CSS

Today I have been trying hard to make nice thumbnails out of some full sized pictures. The main problem was that the pictures were of different orientations and the thumbnails needed to be squared and dynamically made. So in order to have nice centered thumbnails hard-coded measurements were out of question.
This solution takes every picture resizes it to fit the lowest width or height value, then crops the central area of the picture resulting in nice-looking squared thumbnails. And the plus is that they work nicely on any kind of pictures, even the odd-sized ones.

In order to pull this of one will need a container that will hold the thumbnails as background.
Here is a quick example code:

<div class="thumb"></div>
Full image:
<img src="" alt="">;


.thumb {
width: 200px;
height: 200px;
background-position: center center;
background-size: cover;
background-image: url('');

Thumbnail Preview:

Original image:

A live JSFiddle can be previewed here:

Setup XDebug with XAMPP and NetBeans in GNU/Linux

Here is a quick step by step guide on how to get XDebug running with NetBeans IDE.

After you have setup XAMPP and Netbeans it’s time to install XDebug.

Firstly I’ll recommend using the wizard provided by XDebug. Just open your xampp web control panel and go to the phpinfo() tab then select the whole output and copy it. Paste the information about the php setup into the wizard provided by XDebug.

Then follow the steps provided by the wizard with a slightly change. Namely whenever asked to run the phpize command you’ll have to use xampp’s phpize command:   /opt/lampp/bin/phpize

So, to sum up the required steps:

  1. download XDebug (latest version at the time of writing is 2.2.4)
  2. extract XDebug : tar -xvzf xdebug-2.2.4.tgz
  3. navigate to the XDebug folder: cd xdebug-2.2.4
  4. run  /opt/lampp/bin/phpize
  5. check if the API numbers match the ones provided by XDebug Wizard. The following applies for xdebug-2.2.4
    Configuring for:
    Zend Module Api No:      20121212
    Zend Extension Api No:   220121212
  6. Run ./configure then make in order to compile XDebug
  7. After compiling is done, copy the compiled extensions into xampp libraries folder: cp modules/ /opt/lampp/lib/php/extensions/no-debug-non-zts-20121212
  8. Then edit the xampp’s php.ini file: /opt/lampp/etc/php.ini
  9. Append the following at the end of the file:
  10. Then append the XDebug configuration for working with Netbeans:
    xdebug.profiler_enable = 1
    xdebug.profiler_enable_trigger = 1
    xdebug.remote_host = ""
    xdebug.remote_mode = "req"
    xdebug.trace_output_dir = "/opt/lampp/tmp"

And now you can start debugging your PHP code in NetBeans. Have fun!

Setting up Key-based SSH login in CentOS

For this tutorial I’ll be using the latest CentOS version, which is CenOS 6.4.

The first step is to generate a key if you don’t already have one. This can be achieved running:


and following the on-screen instructions.

If you already have a pair of keys, just append your public key in the


Now make the authorized keys readable only to the user:

chmod 600 ~/.ssh/authorized_keys

Now test your key-based login, and if it works then proceed to disabling password login.

Edit the sshd config file and change the following:

nano /etc/ssh/sshd_config

Protocol 2
PasswordAuthentication no
UsePAM no

Now save the config file and restart the sshd server to apply the new settings. service sshd restart Now enjoy key-based authentification

service sshd restart

Install TinyMCE in MovableType

The process of installing TinyMCE text editor in MovableType is quite easy and it does not take more than 2 minutes.

The easyest way to do it is to download the TinyMCE plugin from here:

Then extract the archive and upload the contents of mt-static in your static mt folder and the folder plugins in your home folder for movable type installation.

All done, next time you choose Rich Text format to edit your entries you’ll have TinyMCE at your disposal.

Export RSA Private keys from Putty to OpenSSH

If you want to move your access keys generated with putty to OpenSSH you probably noticed that they are in a different format. In order to convert them follow the steps:

puttygen supports exporting to an OpenSSH compatible format.

  1. Open PuttyGen
  2. Click Load
  3. Load your private key
  4. Go to Conversions->Export OpenSSH and export your private key
  5. Copy your private key to ~/.ssh/id_dsa (or id_rsa).
  6. Create the RFC 4716 version of the public key using ssh-keygen

    ssh-keygen -e -f ~/.ssh/id_dsa > ~/.ssh/

  7. Convert the RFC 4716 version of the public key to the OpenSSH format:

    ssh-keygen -i -f ~/.ssh/ > ~/.ssh/

Source: Stack question

OpenVPN setup on VPS

I will quickly describe how I managed to get a VPN ready for my needs.
Note: at this point I was not able to bypass NAT setups but I will find some tweaks for that.

First if your fainthearted you should probably not mess that much with config files and try the solution explained here which provides a more user friendly approach.

The journey starts by installing the server on your VPS, from now on I assume you have a yum-based server (I run CentOS 6).
First enable RMP Forge repo, to get the latest OpenVPN packages:

yum localinstall –nogpgcheck (for x86)

Then trigger the installation

yum install openvpn

Enable TUN/TAP from your VPS Control Panel and check if it’s working by:

# cat /dev/net/tun

You should get:

# cat: /dev/net/tun: File descriptor in bad state

Now go ahead and take the key and certificate generators and start building keys and certificates:

# cd /usr/share/doc/openvpn-2.0.9
# cp -av easy-rsa /etc/openvpn/
# cd /etc/openvpn/easy-rsa/

Fill the requested info or type a dot (".") to leave it empty:
# . ./vars # sh clean-all # sh build-ca # sh build-key-server server

Now that you have the server key and the certificate, build some client keys:

# sh build-key client1 # sh build-key client2

And fire up the security policies:

# sh build-dh

When you have the certificates and keys generated get the client .crt and .key plus the ca.crt files and transfer them to your clients.

Now take a configuration template and edit the configuration file:

# cd /etc/openvpn/ # cp /usr/share/doc/openvpn-2.2.2/sample-config-files/server.conf . // be aware of the version number as it will increase in the future # nano server.conf

My working configuration is as follows:

local <public IP of the local server>
port 80
proto tcp
dev tun
ca ca.crt
cert server.crt
key server.key # This file should be kept secret
dh dh1024.pem
ifconfig-pool-persist ipp.txt
push "route"
push "dhcp-option DNS"
push "dhcp-option DOMAIN <domain name>"
keepalive 10 120
user nobody
group nobody
status openvpn-status.log
log openvpn.log
verb 3
mute 10

Adjust the configuration to your needs.

My Linux workstation setup

I made this article to gather a list of the tools I use, and I strive to update it as often as possible. It’s main purpose is for me to have a quick reference over the tools and configurations I need to setup whenever I have to get a new system customized.

Since I was mostly around Gnome-based environments I use quite a few Gnome-based software.
Internet & Browsing:
LibreOffice Pack usually I need just Writer, Impress and Calc
PDF Shuffeler
Multimedia: – VLC
Gnome Subtitles
Server Maintance:
Eclipse IDE,
Eclipse + PDT,
MySQL Workbench
Chat & Communication:
GcStart Collection Manager

Enable remote access to your MySQL Database on CentOS 6

Often you’ll need some remote access to your database in order to retrieve or manage data.

This can be set up quite easy.
First step would be to allow the network to access the mysql service. This is done by editing the /etc/my.cnf configuration file.
nano /etc/my.cnf
Now look for the line which contains # skip-networking and uncomment it.
Save the configuration file and restart the mysql service.

service mysqld restart

Now that you just allowed network access to your MySQL server you probably need to assign some credentials for remote access.
First login to your db:

mysql -u root -p mysql

Then you’re ready to create a database:

mysql> CREATE DATABASE database;

create a username for remote access:

mysql> GRANT ALL ON database.* TO user@’host’ IDENTIFIED BY ‘PASSWORD’;

or grant access to an already existing database:

mysql> update database set Host=’′ where Db=’database’;
mysql> update user set Host=’′ where user=’admin’;
Note: to grant access to any host use the wildcard ‘%’ instead of a host name/ host ip.