command line history – me too

I’ve seen this on a couple of blogs recently so I thought I’d give it a go on the VPS this site is hosted on:

steve@decaf:~$ history | awk '{a[$2]++} END {for(i in a)print a[i] " " i}' | sort -rn | head -10                                                                
190 ls                                                                          
80 cd                                                                           
24 cp                                                                           
22 sudo                                                                         
19 rm                                                                           
14 svn                                                                          
12 history                                                                      
11 tar                                                                          
10 wget                                                                         
10 vi

And as root:

172 ls                                                                          
59 vi                                                                           
56 cd                                                                           
22 apt-get                                                                      
20 less                                                                         
20 apache2ctl                                                                   
17 apt-cache                                                                    
15 cp                                                                           
10 pwd                                                                          
10 ps

I’m kinda suprised that ls comes out on top each time ;)

I wonder which commands Matt, Aidan and Philip have been using most?

$BIG_CORP rides the snake – my first Python script

In between support tasks at $BIG_CORP I’ve been slowly reading through O’Reilly’s Learning Python and trying a few things out with the command-line interpreter.

The first script I’ve written that actually does something useful is countdown.py:

#!/usr/bin/env python
# countdown to 5pm
# 2008 SJW
import datetime
now = datetime.datetime.now()
home = datetime.datetime(now.year, now.month, now.day, 17, 0, 0, 0)
total_secs = (home - now).seconds
hours = total_secs / (60 * 60)
minutes = (total_secs - (hours * 60 * 60)) / 60
print hours, " hours and ", minutes, " minutes until 5pm"

Very simple I know but I just had to share it ;)

Thanks to Clinton for the GeSHi WordPress plugin.

Updating WordPress via Subversion: it works!

The last time a new version was released I decided to update my WordPress installation with Subversion with the idea being that this would make future updates easier.

Well, the good news is that this technique works :)

All it took was 3 simple steps:

  1. $ cd /var/www/sickbiscuit.com/blog
  2. $ svn switch http://svn.automattic.com/wordpress/tags/2.5/ .
  3. launch wp-admin/upgrade.php via web-browser

To be safe I backed up the database prior to the update and so far everything seems good, job’s a good ‘un!