Otaqui.Com

Pete Otaqui’s blog about web development and everything else

Archive for the ‘mac’ tag

Get a Forward Delete key on your Mac Book with Double Command

leave a comment

Since I switched to a Macbook Pro, I’ve felt the absence of the “Delete” key. It’s not the same as the Backspace key even in text-based applications, let alone in other things such as a web browser.

To the rescue comes Double Command, a Preference Pane add-in that will give you quite a number of options, including the somewhat obvious to my mind “Shift + Backspace acts as delete.”

It has quite a nice way of allowing a System setup, a User setup and a Current setup, and a pretty hefty number of altered key options, however I was happy to just stick to the one change (I’m a big fan of the extra “Enter” key next to the arrow keys, and somewhat miffed that it might disappear).

Written by pete

March 4th, 2008 at 3:51 pm

Posted in Professional

Tagged with

Listing files with the path in Bash

leave a comment

This little script will print a list of the current files in a directory, prefixed with the full path:

#!/bin/sh
curdir=`pwd`
if [ $# -eq 1 ]
then
usrdir="$1"
ls | xargs -I % echo `pwd`/% | sed -e s!$usrdir!!
else
ls | xargs -I % echo `pwd`/%
fi

You can optionally provide an initial part of the path to ignore. I use this when writing code change emails where I have to list the updated files within a codebase (and I’ve touched most files in a given directory) and I clip the local path up to the root of the codeset. Assuming the script is saved as “lspath”:

lspath /Users/pete/Sites/project/trunk

Even handier is piping it into the OS X clipboard for easy pasting:

lspath /Users/pete/Sites/project/trunk | pbcopy

Written by pete

March 1st, 2008 at 3:43 am

Posted in Professional

Tagged with ,

Split and Rename text files from the Bash command line

2 comments

I occasionally read text files (usually downloaded from the Gutenberg Project) on my mobile phone. This is not the best user experience, but bearable and very useful at times.

The most annoying issue is the incredibly slow management of very large text files (sometimes greater than 1Mb) that my phone displays – so i decided to rename them.

Using my mac, I came up with this couple of commands to do the work for me, between them they will split all text files into 1000 line chunks, and assuming an original filename of “somefile.txt” also rename them to “somefile_XX.txt” where XX is actually two letters denoting the part, starting at aa, ab, ac, etc.

The first command is dead easy and splits the files:

for file in *.txt ; do split $file $file ; done

This will split the files and turn “somefile.txt” into “somefile.txtaa”, “somefile.txtab”, “somefile.txtac” etc. which is obviously not great – so we need the next step:

for file in * ; do mv $file `echo $file |
sed 's/(.*).txt([a-z]{2})/1_2.txt/'` ; done

Now you should have all the files nicely named “somefile_aa.txt”, “somefile_ab.txt”, “somefile_ac.txt” etc.

You might prefer numbers rather than letters, in which case just check out the man page for the ‘split’ command.

Written by pete

February 26th, 2008 at 9:17 pm

Posted in Professional

Tagged with ,

Djay from algoriddim – How to become an OS X iTunes Djay in your bedroom

leave a comment

Djay from algoriddim.com is an awesome piece of software. It plugs into your itunes library and lets you spin and mix on two virtual record decks.

The application is intuitive and easy, and the best facsimile I’ve ever seen of actually spinning the wheels of steel on a computer. Combined with the fact that it’s free this is a brilliant application to play around with and to have up and running at parties.

Key features:

  • drag and drop straight onto the ‘decks’ from a searchable list of your itunes library;
  • manually tap out the bpm of your tracks and have djay automatically adjust the tempo of either playing track to the other;
  • cue points which let you specify three points of a record and jump back to them at the click of a button;
  • independent tempo and pitch adjustments – alter the pitch without affecting the tempo, or use both together to get a different tempo and the original pitch;
  • crossfader automation, independently affecting tempo, pitch, eq and pan;
  • easy recording of your masterpiece mixes.
  • pre cueing (if you have a multi-channel sound card or a USB iMic) to listen to one track on your headphones while playing the other through the speakers.

All in all an excellent application which takes seconds to start having fun with and offers enough features to let you lose yourself in the mix.

Found at MacApper

Written by pete

May 1st, 2007 at 2:19 pm

Posted in Professional

Tagged with , ,

And end to Safari InputManager Plugins in Leopard. Thank god for Firefox.

leave a comment

Hicksdesign reports that OS X Leopard will disable InputManagers, the technology behind plugins like Saft. Must admit I’m even less tempted away from my beloved Firefox now.

Written by pete

April 13th, 2007 at 6:27 pm

Posted in Professional

Tagged with ,