Plesk: Update PHP version on multiple sites

  • November 29, 2018
  • Plesk

cat doms.txt | while read i; do plesk bin domain -u $i -php_handler_id plesk-php70-fastcgi; done

Installing MONO on Linux Cent OS 6

First install the dependencies, you’ll likely have some of them, but this is the full list needed to install mono. yum install bison gettext glib2 freetype fontconfig libpng libpng-devel libX11 libX11-devel glib2-devel libgdi* libexif glibc-devel urw-fonts java unzip gcc gcc-c++ automake autoconf libtool make bzip2 wgetyum install bison gettext glib2 freetype fontconfig libpng libpng-devel libX11 […]

Mac OS X vhosts not working after yoemite / el capitan upgrade

This is because you forgot to back up your httpd.conf… – easily fixed: First, back up the current httpd.conf: (you’ll need to be root, so either su or run the following commands with sudo) cd /etc/apache2 mv httpd.conf httpd.conf.preUpgrade mv httpd.conf~previous httpd.conf and then restart apache: apachectl restart now your local vhosts will work again.

Move from Courier-imap to Dovecot on Cent OS6 running Plesk

First, install dovecot from the plesk panel. it will likely fail to start, and that’s due to the ssl cert not being present according to the defaults, the default config looks like this: #ssl_cert = #ssl_key = We will reuse the ssl cert used by courier, which lives in /usr/share/imapd.pem edit /etc/dovecot/dovecot.conf you’ll see the […]

Extend Date to get an ordinal suffix

  • January 13, 2016
  • C#

Added a simple extension to the Date object as to output an ordinal suffix. using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace StuartsPlayground.App_Code { public static class DateTimeExtensions { public static string ToStringWithOrdinal(this DateTime d) { var result = “”; bool gotOne = false; switch ( d.Day % 100 ) { case 11: case […]

Recursively counting files in a directory

find . -maxdepth 1 -type d -print0 | xargs -0 -I {} sh -c ‘echo $(find “{}” | wc -l) “{}”‘ | sort -n

Remove query string from filename after wget

  • July 30, 2014
  • Linux

After using wget to fetch multiple files, you end up with any query strings as part of the filename, remove them: for file in *.js\?*; do mv “$file” “${file%%\?*}”; done

Google map in hidden bootstrap tab fix

Fix google map rendering when showing bootstrap tabs $(‘a[data-toggle=”tab”]’).on(‘’, function(e) { if ( $(‘href’) == ‘#map’ ) { doMap(); // your map init function here google.maps.event.trigger(map, ‘resize’); } });

Python & MySQL on MAC OS X

Using Django. Get MySQL working with Python on Mac OS X Mavericks. The error: raise ImproperlyConfigured(“Error loading MySQLdb module: %s” % e) django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb I had previously used Pip to install PyMySQL, soon realised this was a mistake, so uninstalled that, and installed instead: Download the archive, […]