Monthly Archives: May 2013

Create div with rounded borders and gradient

To create a HTML DIV with rounded borders and a gradient background use the folowing CSS style:

border: 1px solid #696;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
-webkit-box-shadow: #666 0px 2px 3px;
-moz-box-shadow: #666 0px 2px 3px;
box-shadow: #666 0px 2px 3px;
background: #3388c9;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#3388c9), to(#256494));
background: -webkit-linear-gradient(#3388c9, #256494);
background: -moz-linear-gradient(#3388c9, #256494);
background: -ms-linear-gradient(#3388c9, #256494);
background: -o-linear-gradient(#3388c9, #256494);
background: linear-gradient(#3388c9, #256494);

On you can generate different CSS styles with this kind of “boxes”.


WordPress Optimization

Edit your .htaccess file and add the line

Options All -Indexes

To optimize your WordPress installation add the following to your theme (not the WordPress) Functions.php at the very top:

remove_action( 'wp_head', 'wp_generator' ) ; 
remove_action( 'wp_head', 'wlwmanifest_link' ) ; 
remove_action( 'wp_head', 'rsd_link' ) ;
remove_action( 'wp_head', 'feed_links', 2 ); 
remove_action( 'wp_head', 'feed_links_extra', 3 );

Line 1 will remove the WordPress identifier

<meta name="generator" content="WordPress 3.5.1" />

Line 2 will remove the Windows Live Writer support for downloading css

<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://localhost/wp-includes/wlwmanifest.xml" />

Line 3 will remove

<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://localhost/xmlrpc.php?rsd" />

Line 4 and 5 will remove the secondary WordPress feeds

<link rel="alternate" type="application/rss+xml" title="bjdejong.NL &raquo; Feed" href="http://localhost/feed/" />
<link rel="alternate" type="application/rss+xml" title="bjdejong.NL &raquo; Comments Feed" href="http://localhost/comments/feed/" />


WordPress keeps track of your post revisions. To disable this feature place the following line in your wp-config.php

define( 'WP_POST_REVISIONS', false);

To keep at most three revisions use

define( 'WP_POST_REVISIONS', 3);



Install sublime text 2 package control

Install sublime text 2 package control to easily download and install plugins for the sublime text editor. First open up the console window: view -> show console.

Then past the following command into the console and press enter:

import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen(''+pf.replace(' ','%20')).read()); print('Please restart Sublime Text to finish installation')

For Sublime Text 3

import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( '' + pf.replace(' ','%20')).read())



Restart sublime and show the command pallet with Ctrl+ Shift + P. Type “package contol” and select “install package”. A list of installable packages will show up. Choose your packages for installation.

If you are behind a proxy you should add it to your Sublime settings. Goto Preferences -> Settings User and add the following line (add a ‘,’ to the line above if needed):

"http_proxy": "http://username:password@your.proxy.tld:port"

tar and untar

Create archive

  • -z: Compress archive using gzip program
  • -c: Create archive
  • -v: Verbose i.e display progress while creating archive
  • -f: Archive File name
tar -zcvf archive.tar.gz /home/dir_to_archive


Untar archive

  • -x: Extract files
tar -zxvf archive.tar.gz


List content of archive

tar -tvf file.tar



mount webdav folder

To mount a webdav folder (for example your drive) use the following command:
mount -tdavfs /mnt/box/
Type username and password when asked and voila; your drive is available!

You could also add your username and password to the /etc/davfs2/secrets file and they
will be used by the mount command.


perl locale warning

When execute, for example, the perl command the message below could be shown:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = (unset),
LC_PAPER = "nl_NL.UTF-8",
LC_TIME = "nl_NL.UTF-8",
LC_NAME = "nl_NL.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

To get rid of this message compile the language locale as shown at “LC_NAME=” text. Compile the nl_NL.UTF-8 locale:

If the message persists check that all locale related environment variables have a valid value (ie they are not (unset)).

Valid values for example:

locale-gen nl_NL.UTF-8



Ubuntu Apache + MySQL + WordPress

Install devenv with Ubuntu + Apache + MySQL

Create a new virtual machine and mount your Ubuntu ISO as CDROM drive. Startup the new virtual machine and install Ubuntu with default options.

After Ubuntu installation is complete be sure to add the guest additions to your system (keep your original configuration when asked):

$>apt-get install virtualbox-guest-x11

Ubuntu windows appearing slow? See this url:

Upgrade and update your system to make sure you have the latest and the greatest software:

$>apt-get update
$>apt-get upgrade

Mandatory components for your development environment

$>apt-get install apache2
$>apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
# Enter root password and press OK (twice)
# Install MySQL system tables:
# Secure your MySQL installation
# Enter the root password choosen above
# Choose n (already have a password)
# Enter four times (everything default)
$>apt-get install php5 php5-xdebug libapache2-mod-php5 php5-mcrypt php5-cli php5-curl php5-gd
# Install your favorite editor for quick edits....
$>apt-get install vim

Optional (but useful tools)

WebMin server administration

apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python
dpkg --install webmin_1.610_all.deb

When you want to mount an external CIFS filesystem (for example your NAS) install the CIFS utility package.

$>apt-get install cifs-utils

Mount a cifs remote file system:

$>mkdir /mnt/share
$>mount.cifs //SERVER/share /mnt/share -o user=USER,uid=1000,gid=1000
# Enter your password
# Install netbeans
$>apt-get install netbeans
# Install chromium-browser
Install chrome browser
$>apt-get install chromium-browser
# Install the Gimp
$>sudo apt-get install gimp
# Install VIM
$>sudo apt-get install vim

Setup WordPress installatie

For pretty URL’s to work make sure the rewrite module is enabled in Apache. You can do this with the WebMin tool; in Webmin goto “Servers”, “Apache Webserver”, select the “Global configuration” tab, select “Configure Apache modules”, check the “Rewrite” module.

Changes take effect immediately.

$>cd /var/www/
$>mkdir demo
$>cd demo
$>tar -xzvf latest.tar.gz
$>mv wordpress www
$>rm latest.tar.gz
$>cd /var/www
$>chown -R www-data:www-data .

Setup the MySQL database

$>mysql -uroot -pXXXXXXX
mysql>create database wp_demo;
mysql>create user 'wp_demo'@'localhost' IDENTIFIED BY 'XXXXXXXXXX';
mysql> grant create,drop,select,insert,update,delete on wp_demo.* to 'wp_demo'@'localhost';

SSH OpenSSH Keys

Generating RSA Keys
The first step involves creating a set of RSA keys for use in authentication.
This should be done on the client.
To create your public and private SSH keys on the command-line:

mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa

Default the private key is stored in a file called id_rsa  and the public key is stored in a file called . It is the pub key that you send to other servers!

Transfer Client public key to Host
The key you need to transfer to the host is the public one. If you can log in to a computer over SSH using a password, you can transfer your RSA key by doing the following from your own computer:

ssh-copy-id <username>@<host>

Log in to your host
Log in to your host as usual; you should be prompted for your passphrase. After that the next connection will be made based on your private key.

If the host is configure to only use public key authentication then you have to disable this for a while (or copy the key via another account to the server).

To temporarily disable public key authentication edit your /etc/ssh/sshd_config  file and set the value for passwordauthentication  to yes .

Execute the ssh-copy-id and reset the passwordauthentication value in your sshd_config.


When no connection could be made check the ssh log at


When you encounter something like

Authentication refused: bad ownership or modes for directory /root

Try changing your home folder permissions:

chmod go-w ~/
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys