Andrew McCombe

Full Stack Web Developer

Howto: Get the IP address of a domain in a one liner

I have a need in a bash shell to get the public ipaddress of a domain name.  Here’s how to achieve it: [email protected]:~$ dig +short A Cool huh?

Important cron gotcha: Cron not being updated.

I was recently caught out by a crontab running even after I had edited the crontab and commented out the line. I used VIM and edited the file followed by a :W command but the cron was not being updated. However, it turns out that the crontab isn’t updated until the editor is closed too. […]

Netbeans PHP Autocomplete stopped

I had an issue with Netbeans 6.8 where the auto-complete for PHP functions stopped working. It would work with functions and methods defined in my project but wouldn’t auto-complete any native PHP functions. The fix for this is to delete the var/cache/index folder contents  in the users Netbeans directory (in my case, ~/.netbeans/var/cache/index/ ). Close […]

CLI Autologin and autostart a program with Ubuntu 9.10 karmik

My old laptop is used as a music server and so I haven’t installed a desktop on it. I use MPD as my music server and ncmpd as the front-end.  However, I’m finding it a pain to enter my username, password, wait (its an old, slow lappy) and then enter ncmpd, so I looked for […]

Install Ubuntu from Grub over Network

I have an old Dell C400 Latitude at home and use it primarily as a music server.  It doesn’t have any built in drives such as floppy or CD and I don’t own an external Dell CD drive.  It won’t boot from an external USB device so my options for installing a new OS are […]

Rename files in bash

If you ever need to rename a batch of files using a regex or similar you can use the `rename` command: # Rename .wav to .mp3 rename -v ‘s/\.wav/\.mp3/g’ * # replace all hyphens in jpgs with a space rename -v ‘s/-/ /g’ *.jpg

Set Fixed IP Address on Ubuntu

I often find that I need to fix an IP address using Ubuntu Server and then have to search for the correct format for /etc/network/interfaces.  For record, here it is: auto lo iface lo inet loopback iface eth0 inet static address netmask gateway auto eth0

Share mouse and keyboard across computers

As a website developer I have a need to use multiple operating systems at the same time.  I have a laptop that dual boots Windows Vista and Ubuntu 9.04 and I use this to test websites in Internet Explorer and Safari on Vista. To save me from having to switch between the Linux Desktop and […]

Creative Zen and Rhythmbox (and Banshee)

I’ve never liked using Rhythmbox (Gnome’s default music player) as I found previous versions to be slow, buggy and crashed a lot.  I’m trying to keep my system as close as possible to the default install so I’ve given Rythmbox one more change to impress. I found the MTP plugin (in preferences > plugins)  and […]

Upload files with ncftpput

ncftp is a great set of command line ftp utilities.  It supports a fully fledged FTP client as well as utilities for putting, fetching and batching files. Here’s how to use ncftpput to upload a file: ncftp -u username -p password path/to/remote/file path/to/local/file