Twitter Weekly Updates for 2010-03-28

  • work meeting over; time to go shopping or something. #
  • Dear #Lazyweb I'm looking for 400-600sq feet of office space in/near Bromsgrove town centre (enough for 4 desks etc). #
  • Google Chrome Still The Unhackable Browser http://thenextweb.com/google/2010/03/28/google-chrome-remains-unscathed/ are ff's days numbered? #
  • the free @digg app is here for iphone! they're giving out 1 tricked ipad each day for 2 weeks to celebrate! http://bit.ly/diggapp #
  • Bromsgrove hockey 4ths. Won 2-0. Yey. My first real game in 13 years… #
  • It'll never cook if I keep stirring and watching… Apparently. #
  • RT @guardiantech News Int. starts paywall for Times and Sunday Times (UK) from June. £1/day, £2/week. Will you pay? — hahaha. No. #
  • Had 2 industrial year applicants so far; both with SQL injection flaws on their portfolio sites. #php #security #fun #
  • Why do I always want more peanut butter on toast? #
  • Just entered the Nottingham Marathon – http://www.experianfestivalofrunning.co.uk/ – September 12th 2010… #
  • I've just asked Harriet Harman to give the #debill a real debate. Please join in and RT http://bit.ly/bJ3HwF #38degrees #debill #
  • Soon it may be time to wake up. Soon. #
  • Firefox 3.5 was almost unusable on this acer aspire one; switched to google-chrome – netbook becomes usable and responsive. #
  • Patch enjoying the fruits of my labour http://twitpic.com/1aaiy8 #
  • The dog is eating better than the toddler. Shepherds pie – rejected. The dog and I enjoyed it at least. #
  • Anatomy education by colouring in parts of the dinosaur. Toddler style. #
  • Hmm. Had better not tell anyone I turned the oven on but wasted 10 mins as it wasn't turned on right 'oven' just 'light+fan+pretend' #fail #
  • Neighbour has what looks like a mountain bike with an engine. I tried not to stare #

Running routes

I’ve used http://www.favoriterun.com for years now (See e.g. http://favoriterun.com/account/public_user_profile/5369 ). However, today Chris pointed me at http://gb.mapometer.com/en – which does a far better job of plotting routes (e.g. auto-follow road; calorie guess-timation etc).

Unfortunately it doesn’t seem to allow the public to see who plotted a route – or see any other information about a route – apart from it being plotted on a map.

So, here’s a few of mine :

Bromsgrove to Kidderminster (21.94 miles)
Bromsgrove – Timberhonger – Droitwich – Canal – Finstall (19.48 miles)
Bromsgrove – Stourbridge Road – Swan Lane – Catshill (5.94 miles)

If only they had twitter / facebook or some means of ‘showing off your running routes’ …. silly people.

zencart security crapness

Today, I logged into one server to have a rummage and see if I could free up some disk space… on a whim I do an ‘ls’ of /tmp and find a file called ‘att1.txt’. Hmm. Lets take a look – ‘head att1.txt’ gave :

#!/usr/bin/perl
#  ShellBOT
#  0ldW0lf – oldwolf@atrix-team.org
#      – www.atrix-team.org
Ah, pants. Timestamp on the file matches a request to a Zen-cart instance :

... POST http://....../admin/record_company.php/password_forgotten.php?action=insert
... POST http://..../index.php?main_page=products_all/admin/record_company.php/password_forgotten.php?action=insert
... GET /index.php?main_page=products_all/images/6e072.php?site=http://...../index.php?main_page=products_all/images     /6e072.php

It turns out there was a security update for Zen-cart sometime ago – see http://www.zen-cart.com/forum/showthread.php?t=130161

Suffice to say the various attackers had left a few files on the filesystem; thanks to ‘find -user www-data’ these were easy to find and remove. Interestingly Zen-Cart suggests you rename the ‘admin’ directory – I wonder how many people don’t (in this case) or do it to e.g. ‘admin.old’ …

*sigh*

Twitter Weekly Updates for 2010-03-21

  • What a beautiful day. #
  • Need more sleep. 4am is not wake up time toddler. And just leave me be while you play with Lego. /please/ #
  • The dog has had bacon and mince for tea. I hope I eat as well. #
  • Looks like the funky new car park crap at asda #bromsgrove is failing. #
  • Time to run a new route… Longer and harder hopefully. #
  • Thank you Aubrey for http://www.mysupermarket.co.uk/ #
  • Bad memory day. Totally forgot about hockey until 15 mins ago. #gettingold #
  • "Yesterday – in just one day – 6,000 UK citizens emailed their MPs" from the Open Right Group it looks like people want to debate #debill #
  • I jumped into the river, too many times to make it home, I'm out here on my own, drifting all alone.. Gnr Estranged; time to find new music #
  • RT @Greenpeace: @Nestle's answer to our video was to have it removed? never heard of Streisand Effect http://greenpeace.org/kitkat #kitkat #
  • I think I'm in a weird mood this morning. Must be the dogs fault. #
  • Turn around b1tch I've got a use for you, besides you've got nothing better to do. And I'm bored! #gnr it's easy. #
  • Why are Bromsgrove pavements covered in dog poo? Why is Patch wee'ing on the door matt? All this + more won't be answered in the next tweet #
  • RT @38_degrees 38 Degrees | Don't rush through extreme web laws http://bit.ly/dBaMcg #
  • RT @doctorow: If 10K Brits ask MPs to debate Digital Economy Bill, it'll probably die! 1K did ystdy! http://tinyurl.com/yhnn9fj #debill #
  • I really ought to get up now and run. #
  • Yey; broadband works earlier than expected; 10mbit downstream too. *happy* #
  • Ooh expensive new parking thing in operation at asda #bromsgrove wish they'd spend the money on potholes and the high st. #
  • Will I ever tire of gnr's estranged ? Perhaps tomorrow… I just need a drum kit and guitar, oh and being ably to sing without causing GBH #
  • Rule number one: don't wake a toddler up early. Persuade them to sleep as long as possible. #
  • Neighbour with car alarm going off may either have no car or no friends tomorrow. #
  • Still no Internet. We're all playing games now. As we just *can't possibly* do anything without the 'net. Obviously. #
  • Still no Internet. Boo. #
  • Internet fail day. Grrr. (bad bethere) #
  • http://www.timberhonger10k.co.uk/ #running #bromsgrove – entries online etc. #
  • DAB radio++; not quite sure what the fuss about BBC Radio 6 Music was for though (they cost 26 quid in @asda) #

Python script to backup mysql databases on Debian

Here’s a short python script I must have knocked up some time ago – and totally forgotten – hopefully it’ll be of some use to others….

Purpose: backup all MySQL databases, one in each file with a timestamp on the end. You’ll probably want to have a secondary cron job which does something like :

find /backups/mysql -mtime +5 -print | xargs -r rm

to delete old copies… changing +5 to how ever many days history you wish to have.

Method: Read /etc/mysql/debian.cnf to get login details for MySQL, connect to MySQL and ask it for a list of all databases, go through this list calling mysqldump on each one.

Code:

(Last updated: 2012/10/10 – skip trying to backup the performance_schema).

#!/usr/bin/env python
import ConfigParser
import os
import time

# On Debian, /etc/mysql/debian.cnf contains 'root' a like login and password.
config = ConfigParser.ConfigParser()
config.read("/etc/mysql/debian.cnf")
username = config.get('client', 'user')
password = config.get('client', 'password')
hostname = config.get('client', 'host')

filestamp = time.strftime('%Y-%m-%d')

# Get a list of databases with :
database_list_command="mysql -u %s -p%s -h %s --silent -N -e 'show databases'" % (username, password, hostname)
for database in os.popen(database_list_command).readlines():
    database = database.strip()
    if database == 'information_schema':
        continue
    if database == 'performance_schema':
        continue
    filename = "/backups/mysql/%s-%s.sql" % (database, filestamp)
    os.popen("mysqldump -u %s -p%s -h %s -e --opt -c %s | gzip -c > %s.gz" % (username, password, hostname, database, filename))

Twitter Weekly Updates for 2010-03-14

  • Tcp over Dns seems a success – just slow, really slow. 33kbps old skopl slow. Hurry up bethere I want those 10mbps #
  • And no real golf involved either in last tweet. Not sure I'll visit all the watering holes. Getting to 3 holes would make me happy. #
  • Beer and running don't mix too well. At least I avoided the drinking games. 9 hole golf next weekend #bromsgrove #hockey #
  • Beer and skittles. Not too interested in the skittles part tbh. #hockey #bromsgrove #
  • What's with all the little hot air balloons people seen intent on launching at night? #lazyweb #
  • Nealry walked into some idiot who was too absorbed in his phone. Muppet….. *ahem* #
  • Dog picked up by someone and now in evenjobb. *sigh*. #
  • All aboard the toddler train! #
  • finds his dad drinking coffee on Google street view #
  • Set up http://analogbit.com/tcp-over-dns_howto -initial 'test' appears to show it working; hope it saves me from being screwed in the future #
  • Discovered perl's quotemeta() and php's preg_quote() …. Wondering how it's taken so long for me to realise they exist! #
  • Notes a darkening sky and that he has no coat. This could be sub optimal. #
  • I think patch wants to be nocturnal. #
  • Off to hockey #bromsgrove #
  • Congratulates @moobert on purchasing tolberone cookies from @asda nom nom nom nom #
  • Step 1: Chocolate, Beer and Pizza. Step 2: …. Step 3: Sleep #
  • Office game of the day – http://www.cantyouseeimbusy.com/games/breakdown/indexFS.php?cname=Your%20Company #
  • Today looks like it'll be busy. #
  • Today has been more productive… Next up #phpwm zend form etc #zf http://phpwm.org #
  • I think a long hard sweaty morning fu^h^hrun is needed. Toodle-pip. #
  • Despite sending essays via SMS lately (or so it seems) I've still got 292 left to cover 9 days. Now who do I annoy next…. :-> #
  • Most unproductive day ever. Meh. #
  • Wasted 2 minutes of my life – went to MySpace; eventually remembered login details; realised it's still crap -> closing the browser window. #

Twitter Weekly Updates for 2010-03-07

  • Sweet. The now show is back. Good times. #nowshow #radio4 #BBC #
  • Lovely run up Lickey hill; http://favoriterun.com/294345 – 7:45mins/mile; 12.57 miles. Now to eat breakfast and visit/annoy @carolinegoodwin #
  • Congratulations Rowan. You've slept well. Don't rush to get up; I don't mind. When you do wake, we'll eventually go and have Lots of fun. #
  • My ankle seems worse this morning. Time to wear boots :-/ #
  • Hockey good. Left ankle not so good. Feels f–ked and swelling. Boo. #
  • Hockey time. #bromsgrove At least it's dry #
  • I seem to be in a good mood today; a welcome change. Hockey tonight, Dead mech podcast to listen to, new ear phones and a sunny day. #
  • I seem to be in a good mood today; a welcome change. Hockey tonight too #
  • Interesting day. Hyper toddler. Poor patch. #
  • Signed up to the #dyfienduro – #474 Perhaps I need to do some cycling now. Or not. #
  • fixed http://www.whoateallthepies.tv – silly rinetd and so on. Perhaps I ought to do some /paying/ work today…. #
  • It's probably a good thing i haven't got last.fm recording what I listen to on my iPhone. Guns and roses estranged would be top. #
  • Surprise surprise galaxy chocolate is now the same price in @asda as poundland. £1 for 125g. Was £1.26 in asda. #
  • Lovely sunny morning in bromsgrove – one of the rare times I miss farming. #

Twitter Weekly Updates for 2010-03-07

  • Sweet. The now show is back. Good times. #nowshow #radio4 #BBC #
  • Lovely run up Lickey hill; http://favoriterun.com/294345 – 7:45mins/mile; 12.57 miles. Now to eat breakfast and visit/annoy @carolinegoodwin #
  • Congratulations Rowan. You've slept well. Don't rush to get up; I don't mind. When you do wake, we'll eventually go and have Lots of fun. #
  • My ankle seems worse this morning. Time to wear boots :-/ #
  • Hockey good. Left ankle not so good. Feels f–ked and swelling. Boo. #
  • Hockey time. #bromsgrove At least it's dry #
  • I seem to be in a good mood today; a welcome change. Hockey tonight, Dead mech podcast to listen to, new ear phones and a sunny day. #
  • I seem to be in a good mood today; a welcome change. Hockey tonight too #
  • Interesting day. Hyper toddler. Poor patch. #
  • Signed up to the #dyfienduro – #474 Perhaps I need to do some cycling now. Or not. #
  • fixed http://www.whoateallthepies.tv – silly rinetd and so on. Perhaps I ought to do some /paying/ work today…. #
  • It's probably a good thing i haven't got last.fm recording what I listen to on my iPhone. Guns and roses estranged would be top. #
  • Surprise surprise galaxy chocolate is now the same price in @asda as poundland. £1 for 125g. Was £1.26 in asda. #
  • Lovely sunny morning in bromsgrove – one of the rare times I miss farming. #

Google News Sitemap + WordPress

Annoyingly the current version of the google-news-sitemap plugin for WordPress (v1.4) doesn’t work with some silly XML namespace error reported by google.

See http://wordpress.org/support/topic/364929 and effectively the ‘patch’ on the Google Support forum thing which works fine (there are two bits of the plugin which need updating – whcih correlate to the two parts mentioned in the posting etc)

Bit annoyed that the fix is so easy – yet the plugin hasn’t been updated yet. Grr.

Silly SoapClient

Sam made some changes to a SOAP service one customer has – and suddenly our automated tests kept failing. “WTF?” we thought.

We persistently got the same error (e.g. Fatal error: SOAP-ERROR: Encoding: object hasn’t ‘SortResults’ property in ….) yet the generated WSDL file (when viewed through a web browser etc) no longer has SortResults in it.

We checked :

  • Proxy settings,
  • Apache configuration (and restarted Apache)
  • svn reverted files
  • DNS and more.

Then it turned out the SoapClient PHP object caches the WSDL file by default in e.g. /tmp/wsdl-blahblahblah. (Where blahblahblah looks very much like an md5). And it doesn’t make much of an effort to check it’s validity. Obviously the documentation does state this, but it does seem like the wrong default behaviour to me.

Solution: Add something to the automated tests to delete /tmp/wsdl-*. OR pass into the SoapClient constructor an array of options like :

$client = new SoapClient('http://somewhere/blah.php?wsdl", array(cache_wsdl => WSDL_CACHE_NONE)

Time wasted: Too much.