Replacing a keyboard on a Lenovo G460

Keyboards these days seem to be cheaply manufactured, and break easily. I've seen several friends' computers break in the last year, and a broken keyboard means the entire thing is unusable. If its under warranty, great, but if not, then you might end up having to replace it yourself. I couldn't find this information online, so I thought I'd post it here. Guide with pictures, after the break …

Read more

Dos Boot Disks Under Linux

Sometimes you have no choice and you need to boot into a DOS boot disk — to upgrade your BIOS for example, or to run Seagate's SeaTools, as I had to recently. This can be a headache when you're using Linux. I was having issues with the SeaTools' own boot disk, as I wanted to … Read more

Viewing heavily commented config files

Just a quick one, as I haven't posted for a while. This is a cool trick for getting the juice out of heavily commented files. In particular I used this on /etc/samba/smb.conf, but also good for apache2.conf, php.ini etc. The magic is this. grep -v -e "^#" -e "^;" -e "^$" /etc/samba/smb.conf Basically, ignore all … Read more

Joomla and mysterious memory usage

I've been running a server which has a fairly busy Joomla site on it. The server has 2Gb RAM, and is running nginx, php5-fpm and mysql, and not much else. However it would run for a while and then the disk would start swapping out. Not a lot, but enough to cause a few issues. If I restarted the server, memory usage would start at something like this

>$ free
 total       used       free
 Mem:       2048036    1024048     1023988
 Swap:      4192960          0    4192960

After about a day it would look like this

>$ free
             total       used       free    
Mem:       2048036    1924048      73988   
Swap:      4192960          0    4192960

And eventually it would have a flurry of activity which would make it look like this

>$ free
             total       used       free    
Mem:       2048036    1924048      23988   
Swap:      4192960       4567     4188393

Read more

Summarizing dig Info with a bash script.

Dig is a great tool, but most of its output is not very interesting. There are a bunch of command line options that I can never remember without a quick 'man dig' which always sounds a bit odd. So I whipped up a quick script. It takes a domain name as the argument, and then pumps out the Reverse IP lookup, Nameservers, and Mail servers with reverse lookup of their IPs.

#!/bin/bash
QUERYDOMAIN=$1
echo "Reverse IP:"
 echo "    " `dig x +short $QUERYDOMAIN`
 echo "Nameservers"
 NAMESERVERS=`dig ns +short $QUERYDOMAIN | sed "s/^[0-9]* //g"`
 for SERVER in $NAMESERVERS;
 do
 echo "    " $SERVER " = " `dig x +short $SERVER`;
 done
 echo "Mail Servers:"
 MAILSERVERS=`dig mx +short $QUERYDOMAIN | sed "s/^[0-9]* //g"`
 for SERVER in $MAILSERVERS;
 do
 echo "    " $SERVER " = " `dig x +short $SERVER`;
 done

The output looks like this:

Read more