grep is a useful little *nix command line utility that makes it easy to search for strings in files. The real beauty comes when you start using it with pipes. One thing that kind of bothered me since I started using it, that it didn’t highlight the string you where searching for in it’s output.
Turns out, this can be accomplished very easily (should really just have reade the man page 😉 ).

Put the following in your shell startup script (/home/flo/.bashrc in my case)
export GREP_OPTIONS='--color=auto'
Now that was simple wasn’t it (though you’ll have to re-log in to make it work or at least spawn another shell process, so the startup file gets sourced) 🙂

But now if you followed my tip and started using pipes like mad, after applying this tip, you’ll quickly encounter that the colors are gone again. To hand over colors to say the often used less program you have to make an alias that hands grep the --color=always option (don’t put this in GREP_OPTIONS it tends to break things!) and call less with the -R option.
Or simpler, just add the following to your shell startup script:
export LESS=-R
alias cgrep='grep --color=always'

Yesterday I finally set up my good old iBook as juke box. It now sits on a shelf besides my working table and runs iTunes fullscreen wirelessly connected to the net and the stereo via my AirpotExpress. It’s working perfectly and I am really satisfied with it. The only downside was, that when I wanted to control anything on the iBook I had to reach over there.

I evaluated several different utilities for remote control but wasn’t really satisfied with any of them, then I remembered about Synergy. What it does is best quoted from it’s page:

Synergy lets you easily share a single mouse and keyboard between multiple computers with different operating systems without special hardware. It’s intended for users with multiple computers on their desk since each system uses its own display.

That’s exactly what I was going for and luckily setup was really easy (instructions for Mac OS X).

  1. Download Synergy from Sourceforge.net
  2. Unzip the archive and copy the resulting folder wherever you want (“Applications” might be a good idea 😉 )
  3. Decide on your “Server” (= the computer who’s keyboard and mouse will control all the other machines). On this machine you need to make a file named synergy.conf with the following contents
    section: screens
    screen1:
    screen2:
    end
    section: links
    screen1:
    left = screen2
    screen2:
    right = screen1
    end

    Substitute screen1 and screen2 with the hostnames of your computers (just punch in hostname in your Terminal and find out). Note that there is no implicit logic in the config file about the placement of the screens. So you have to tell Synergy that screen1 is right of screen2 and the opposite or you won’t be able to leave one of the screens with your mouse.
    The provided sample config is pretty well documented so you should be able to figure out the appropriate positioning for your particular set up very easily.
  4. When you’re done with the config, all there’s left to do is start Synergy. Just execute the following in your Terminal.
    First on the Server (alter the program path to match your system):
    /Applications/Synergy/synergys -c synergy.conf
    and then the client(s):
    /Applications/Synergy/synergyc screen1
    again substitute screen1 with the hostname of your server

If you didn’t make any mistakes in the config file you should be up and running by now and be able to move freely between all of your screens no matter to what machine they are connected.

The best thing about Synergy is that it is cross platform compatible, meaning you can connect Windows, Linux and Mac machines in a similar manner. To know more about the program consult the documentation provided in the installation directory.

UPDATE:
For the lazy, there is even a Mac OS X GUI Programm to do the configuring: SynergyKM 😉

Another entry in my virtual “braindump” category, so I don’t have to look it up somewhere else all the time.

If you want to periodically delete files in a specific directory the unix program find comes to the rescue. In my specific case I needed to delete all the movie files from a surveillance camera that where older than 30 days.

This is the crontab entry to accomplish that:
0 0 * * * /usr/bin/find /videos/ -type f -name '*.avi' -mtime +30 -exec rm {} \;
(everything in one line)

The code runs the program /usr/bin/find every day at midnight (0 0 * * *). It checks the directory called /videos for everything that is a file (-type f), has a name that ends in .avi (-name '*.avi') and is created 30 days ago or before that (-mtime +30).
The command then executes rm (remove) on all those files (-exec rm {} \;).