GEEK: prune directories, files from find output

Sometimes you want to exclude a directory and/or files from a search. This alias:

cfind=’find . \( -type d -name .svn -prune -o -path ./stock-data/tests/data -prune \) -o \( -type f \! -name “*.csv” -print0 \) | xargs -0 grep’

…means:

“Recursively loop through all of the files and directories in the current directory and below. If it’s a directory named .svn or it’s in the stock-data path, or it ends in .csv ignore it. Otherwise, search for your keyword in the file.”

GEEK: how to add a user to the admin group on Mac OS X

Here’s how to add a user to the admin group using dscl:

dscl . append /Groups/admin GroupMembership crasch

Remove a user:

dscl . delete /Groups/admin GroupMembership crasch

Reading the membership of the admin group:

dscl . read /Groups/admin GroupMembership