Posts Tagged ‘geek’

Bash profile customisation

I have added aliases and other customisations to my bash shell over the last four years to reach a point I’m quite happy with.

Ultimately, I think everyone’s shell will be different as well perform different tasks and have different priorities. (more…)

Using awk to format strings

Awk is a programming language, which I only use in it’s most basic form. Quite often I need to format a few lines of text, as is the case with an OD password reset script I’m working on. (more…)

ARDAgent version

If you administrate a number of Mac clients you’ll no doubt be familiar with Apple’s Remote Desktop. As is the case with most software additional functionality becomes available in new release and ARD is no exception. Hence the ARD client version is a relevant piece of information and when I needed to get the information from a user without using Remote Desktop itself I came up with the following code. (more…)

lsotunes (List Open Tunes)

I’ve been using a shell script to list any tracks open with in iTunes for quite some time now; I’m doing this so I can work out what people are streaming over Bonjour. I’ve been piping the output to my desktop using GeekTool but recently decided the output was ugly and needed some reformatting. Ruby, I need you my darling! (more…)

Five star playlist in iTunes

If you’re anything like me you use all sorts of tricks to bounce tracks from playlist to playlist in iTunes with smart playlists picking up rated tracks that you haven’t listened to and pushing them to you iPhone etc. Well, today I decided to manually manage tracks on my iPhone and as a result started tinkering with iPhone only playlists. (more…)

Selectively emptying a Postfix mail queue

One of the mail servers I manage was blocked up to the hilt with sixteen thousand emails sent to a specific recipient. This meant no one could send or receive email in the office until Postfix had delivered the messages. Only problem was these messages weren’t going anywhere. To make matters worse, the queue contained important emails that had to be delivered! (more…)

New Terminal tab with pwd

Just a quick snippet I’m using to open a new tab in Terminal. It accepts a single, optional argument which will override cd’ing to the working directory.

#!/usr/bin/env bash
 
if [[ $# -eq 0 ]]; then
	dir=`pwd`
else
	dir=$1
fi
 
/usr/bin/osascript \
-e "tell app \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down" \
-e "tell app \"Terminal\" to do script \"cd $dir\" in front window" \
-e "tell app \"System Events\" to tell process \"Terminal\" to keystroke \"l\" using control down"

I’ve put the shell script in “/usr/local/bin” as this is in my $PATH. I’ve named the script “tab” so whenever in Terminal I can enter “tab” to open a new tab with the current working directory ready and waiting. Very useful when working with Rails and multiple shells.

Enabling Apache’s mod_deflate

If you’re running an Apache web server and you want to speed up your visitor’s browsing you can enable mod_deflate, which has replaced mod_gzip in Apache 2.

You’ll probably find your mod_default module is already installed and available with just a couple of lines of configuration. (more…)