Category: Uncategorized

  • SSL Commands

    I keep forgetting these one line OpenSSL commands – perhaps if they are here, I’ll remember — Create private key file : openssl genrsa -out server.key 2048 Create certificate signing request (to send to e.g. GoDaddy) – openssl req -new -key server.key -out server.csr  Verify a certificate – openssl verify file.name To convert a .crt…

  • Linux console dimming / screen saver

    Our work server seems to enjoy crashing (at the moment) about once a day – but when I go to look at the console I can’t see anything because the screen has dimmed to black – and as the computer has locked up, I can’t wake the screen up to see if there is a…

  • MySQL table defragmentation (python script)

    I’ve written the below Python script to defragment MySQL database tables. This should work with both InnoDB and MyISAM table formats, and is just calling “OPTIMIZE TABLE blah.foo”. It rummages through the information_schema for tables which may be defragmented. You should be able to run it on any Debian based system without making any alterations.…

  • Chocolate headed pirates

    My son woke up at 6am crying quite loudly this morning – he’d been having a nightmare involving a Chocolate Headed Pirate being mean and nasty to him. Personally I think a chocolate headed pirate would be quite tasty – although perhaps it’d be a bit more than I could eat in one sitting (or…

  • Spring trip to Barcelona

    Spring trip to Barcelona

    Well, sort of random. As I don’t normally bother to upload any pictures and so on, I thought I might as well for once – and I said I’d send my father a postcard, but then failed to …. perhaps this will make up for it. I didn’t notice any postcard selling shops either – perhaps…

  • WTFs per minute

    I’m currently refactoring some legacy third party PHP code, and as the old saying goes, the real metric is WTFs per minute. So, just to entertain any readers, how about : Writing pagination links for a search form, but if there are more than 20 pages of results, add 20 onto whatever the maximum number…

  • Solr and WordPress (instructions/howto)

    This is for Tomcat5.5 (on Debian Lenny), WordPress 3.1 and Solr 3.4. The intention is to use the solr-for-wordpress plugin (see github ). Lenny does include a Solr package (v1.2) which is somewhat outdated (and not supported by the upstream solr-for-wordpress wordpress plugin, hence we can’t use it). Install Tomcat (and Java) apt-get install sun-java6-jre…

  • wp-mobile-detector is insecure (wordpress plugin)

    It seems installing the wp-mobile-detector plugin on your wordpress site is a bad idea {tm} A customer’s web server has the following requests in it : [24/Aug/2011:02:10:47 +0100] “HEAD /wp-content/plugins/wp-mobile-detector/timthumb.php?src=http://superflickr.com.nu/index.php HTTP/1.1” 200 – “-” “Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.7.12) Gecko/20050919 Firefox/1.0.7” [24/Aug/2011:02:10:48 +0100] “GET /wp-content/plugins/wp-mobile-detector/cache/27a44a2d2bea4a693389c325a1125aa6.php HTTP/1.1” 200 52 “-” “Mozilla/5.0 (Windows; U;…

  • Slim Framework – using middleware for page caching in the front controller

    The SlimFramework is a ‘minimal’ PHP5 framework. We’re using it in one project, integrating with Smarty, Propel and the Zend Framework (as I don’t like Zend_View, it didn’t seem worth using Zend_Controller_Action, although what we do have is very similar to one). Anyway, when creating your front controller in Slim, you can define ‘middleware‘ (i.e.…

  • Ebuyer & ParcelForce – a story in how not to treat your customer

    5-6 weeks ago ago I ordered two 24″ widescreen monitors from EBuyer – when the ParcelForce guy delivered them I told him I expected 2, and there was only one delivered. He walked off. I presumed that the other would arrive the next day or something… but it didn’t. while(true) {      David.ContactsEBuyerViaStupidENoteSystem(‘rah rah rah…