svn ignore

January 20th, 2007

How do you get subversion to ingnore certain files? It can be done globally or on a per directory basis.

For global ignores find your subversion config file. For me this was here ~/.subversion/config then edit the following line, here I’ve added *.tmproj to ignore any file which ends with .tmproj (the * being a reg exp for any prefix).

global-ignores = *.o *.lo *.la #*# .*.rej *.tmproj

To ingnore files on a per directory basis cd to the directory in question and use the following.

svn propset svn:ignore "*.cache" .

This will apply the ignore to the file or files specifed by the pattern. In this case all files ending with .cache. The trialing . applies the ignore to the current directory, but can be the path to any subversion directory. The command above creates a .svn/dir-props file with the following contents in the specified directory.

K 10
svn:ignore
V 8
*.cache

END

Here’s a useful snippet to enable you to securely store passwords in OS X’s keychain and use them in a shell scripts.

#!/bin/bash

PASSWORD=`exec osascript <<EOF | tr "\r" "\n"

    (*
     To use the Keychain to store the admin password then 

     Open /Applications/Utilities/Keychain Access.app
     Add a new keychain called "TM"
     Add a Key with the name "test" and store your password in it.

     I'd recommend learning how keychains work then tailoring
     the process to your security needs.
    *)

    tell application "Keychain Scripting"
        set myKeyChain to keychain "TM.keychain"
        set theKeyList to every key of myKeyChain
        set thePassword to ""
        repeat with x from 1 to (length of theKeyList)
            set theKey to item x of theKeyList
            if the name of theKey is "test" then
                set thePassword to password of theKey
                --exit repeat leaves us without
                --a value returned to the shell script...
            end if
        end repeat
    end tell

EOF`

echo "$PASSWORD"

exit 0;

Download:

Update: As of Leopard it is now possible to do this via the command line tool security

That Dictionary File,

January 11th, 2007

the one i’m always forgetting where it hides, with the 234,936 english words in, is here

/usr/share/dict/web2

as the readme says “it makes a dandy ‘grep’ vicitim”. Want a random word?

perl -e 'rand($.) < 1 && ($line = $_) while <>; print $line’ \
/usr/share/dict/web2

Change “Welcome to Darwin!”

January 11th, 2007

Here’s how to change the “Welcome to Darwin!” message when you open a new terminal. Simply open:

/etc/motd

and change the contents to whatever you like. I favour “Welcome to Hell!”

Update: As of Leopard you may find that the motd (Message of the Day) file no longer exists. If this is the case then you just need to create it. The contents will then be displayed each time you open a new Terminal window.

I wrote the following shell script a while back for use with TextMate as part of my build process. TextMate’s great as it easily allows you to bind scripts to custom commands (and key combinations). However you’d easily be able to adapt it to your set up. It will allow you to cleanly change all the flash players available for OS X, as well as being able to Uninstall the player, and optionally restart open browsers (FireFox and Safari) afterwards.

You’ll need to download the players, install and move the files into archived folders the contents of which the script will copy to the default internet plug-ins folder. It shouldn’t be too difficult to work out how this happens and alter the script for your needs.

Download the script here

To install the FP 7.0.14 without restarting any open broswers:

changePlayer.sh 7.0.14 false

To uninstall the flash player:

changePlayer.sh uninstall_flash_player

To install FP 6.0.49, restarting open browsers:

changePlayer.sh 6.0.49

If there’s anyone out there using TextMate and would like a the above wrapped up in a bundle then please email me and I’ll send a copy over.

Recursively remove .svn files

December 16th, 2005

Here’s a quick shell script to recursively remove all the the .svn files starting in the current directory and working down.

find . -type f -name "*.svn" -exec rm '{}' \; -print

Change .svn to look for different types.

Shell to Clipboard

December 13th, 2005

I figured it’d be nice to be able to print output from the terminal/shell to OS X’s general clipboard. So after a little digging I found these two commands:

pbcopy - copy to the clipboard.
pbpaste - paste from the clipboard.

Piping output should come in handy, ie:

pwd | pbcopy

will print the full path of the current directory directly to the cliboard. Or :

ls | pbcopy

for a list on the contents of the current directory.

Found over at Ted’s Ted’s Macintosh Tips and Tricks, which is well worth a butchers.

By eck.

December 13th, 2005

Suprise. Suprise. I completely forgot about setting this up… It’s bound to go in fits and starts. The plan is to start posting techy tips and tricks I come across in an effort to collect them in once place. They’ll be covering flash, os x, terminal etc. Ohh and to try and build a collection of inspiring sites I find. Let’s see if I mange that…

hell-o-blog

May 22nd, 2005

Things start somewhere. And here I am starting 10 minutes before I’m due at the cinema…