Bash: turn on case-insensitive tab completion

I always forget this one, but it's dead handy as it allows you to type "py" hit tab and it will auto complete for "Python" or "python" for example. Without this setting you'd have to type explicitly what you want. To enable run: echo…

Checking tarball contents before extraction

When you are about to unpack a tarball you didn't create it's a good idea to run the -t flag instead of just assuming it's been packed in a sensible way. tar -tzf foo.tar.gz This lists all of the files in the tarball so you can be sure…

Bash: Resolving Symlinks to Shellscripts

Here's a way to resolve symlinks that call a bash shellscript. The Problem I like to be able to use something like this in my bash scripts: SCRIPTDIR=$(dirname $0) Which is great for a reference to where the script is, but it suffers from the problem that if you…

Linux: Changing UIDs and GIDs for a user

Just had to do a quick switch over of UID and GIDs for a couple of users. I'm using Puppet to manage server configurations and it's got some nice features for automating the set-up of users. Unfortunately when I initially set-up the puppet directives, I overlooked setting the UID for…

Mac OSX tip: ls command color output

If you have OSX tiger simply grab the fileutils from fink with fink install fileutils Then add the following to your .profile: export LS_OPTIONS='--color=auto' eval "`/sw/bin/dircolors`" alias ls='ls $LS_OPTIONS' alias ll='ls $LS_OPTIONS -lah' alias l='ls $LS_OPTIONS -lA' In leopard…

Django: Switching between development branches

Cyril and I have been using new forms admin for some stuff we are working on for fun whilst we are here at SXSWi. One of the issues is that if you're developing several different Django sites you won't necessary want to migrate away from trunk to migrate everything to…

Extracting a single file from a tar backup

Like an idiot I accidentally overwrote a file for this blog when uploading some other stuff; accidents happen. Anyway, I have backups (you do have backups right?) and I needed to grab a single file out of the latest tar. Fortunately this is really straight forward and rather than unpacking…