Disable WordPress Twemoji and Emoji scripts

Add the following two lines in your functions.php file.

function remove_emoji_scripts() {
// Dequeue the Emoji script
wp_dequeue_script( 'emoji' );
// Dequeue the Twemoji script
wp_dequeue_script( 'twemoji' );
}
add_action( 'wp_enqueue_scripts', 'remove_emoji_scripts' );

Build nginx from source

I use nginx as a webserver for my websites. When installed from aptitude, it comes with a lot of modules that I do not need, so I made a customized version of nginx, to make nginx the way I want it.

First, you have to download the latest version of nginx from the website. Version 1.7.10 is the latest version at this moment.

wget http://nginx.org/download/nginx-1.7.10.tar.gz

Then, you have to extract the files from the tar-archive

tar xzf nginx-1.7.10.tar.gz

Then, browse into the folder in which the files are extracted

cd nginx-1.7.10/

Execute the configure script

./configure \
--user=www-data \
--group=www-data \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-log-path=/var/log/nginx/access.log \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--lock-path=/var/lock/nginx.lock \
--pid-path=/var/run/nginx.pid \
--with-http_realip_module \
--with-ipv6 \
--with-cpu-opt=amd64 \
--with-http_ssl_module \
--with-http_spdy_module \
--without-select_module \
--without-http_browser_module \
--without-http_empty_gif_module \
--without-http_geo_module \
--without-http_map_module \
--without-http_limit_req_module \
--without-http_limit_conn_module \
--without-http_memcached_module \
--without-http_scgi_module \
--without-http_split_clients_module \
--without-http_ssi_module \
--without-http_userid_module \
--without-http_uwsgi_module \
--without-mail_pop3_module \
--without-mail_imap_module \
--without-mail_smtp_module \
--with-cc-opt=-O3

Then, stop nginx, make and install the custom compiled version of nginx, and start it.

service nginx stop && make && make install && service nginx start

To make sure it’s the new version, check the version number of the running version:

nginx -v

How to delete files with a certain extension from a folder and all of its subfolders

First, browse to the folder in which you want to delete files with a specific extension

cd /path/to/folder

Then delete the files with the extension .jpg

find . -type f -iname \*.jpg -delete
  • . tells to start searching in the current folder.
  • -type f tells find only to look for files.
  • -iname makes the search case insensitive.
  • -delete tells find to delete/remove all files found.

Change .jpg with the file extension you want to delete from a folder. I recommend running the command without -delete first to get a list of the files that will be removed when -delete is included in the command. This way a small typo won’t delete anything you didn’t intend to.

Source: http://askubuntu.com/a/104841

Optimaal gebruik maken van SPDY en SSL

SPDY is ontwikkeld door Google, om de huidige communicatie tussen browsers en servers te verbeteren, op verschillende vlakken. Nou had ik eerder twee domeinen voor de website van maartenvandekamp.nl.

Het hoofddomein maartenvandekamp.nl is voor de website zelf, en het domein staticcdn.nl werd gebruikt voor het aanleveren van PDF bestanden, Word documenten, en voornamelijk voor de vele afbeeldingen.

Dit omdat browsers eerder (ondanks wat nadelen zoals DNS aanvragen) voordelen hadden door bestanden van meerdere domeinen weg te halen, want dat kon parallel, wat het laden van de website versnelde.

Nu las ik ergens halverwege 2014 een artikel van The Theme Foundry, waarin zij vertelden waarom zij ervoor kozen om geen CDN te gebruiken. staticcdn.nl was voor mij eigenlijk een CDN. Maar in de laatste paar dagen ben ik bezig geweest om de bestanden weer terug te brengen naar maartenvandekamp.nl.

Dit omdat browsers dan maar 1 keer een verbinding hoeven te maken met mijn server, en alles door die ene verbinding kunnen downloaden. In de voorgaande situatie trok een browser eerst alle bestanden weg bij het domein maartenvandekamp.nl, en vroeg daarna de bestanden op bij staticcdn.nl.

Maar dat tweede gebeurde pas nadat de eerste aanvraag gedaan was. Daar boekte ik dus weinig voordeel. Vandaar dat vanaf vandaag de afbeeldingen weer allemaal vanaf het domein maartenvandekamp.nl worden aangeleverd.