Tricky Apache configuration bug
When using Apache’s DirectoryIndex directive make sure you don’t separate the values with commas. If you do, Apache will be looking for filenames ending in commas!
Bad: DirectoryIndex index.html, index.php, index.cgi
Good: DirectoryIndex index.html index.php index.cgi
This took me longer to figure out than it should have. :\
Colorize log output with ack
Adding color to log files makes them a lot easier to understand, especially when tailing them. That’s why tools like MultiTail were created, and some logging tools can output in color. Last night I realized color could be added to any log file using ack, an awesome grep replacement that I recently found.
For example, to make 404s red in a standard Apache access log:
tail -f /var/log/apache2/access.log | ack --passthru --color-match=red "^.* 404 .*$"
The --passthru option makes it so no lines are discarded. You can use multiple colors by piping the output through ack multiple times. The --flush option is needed to prevent pipe buffering issues and the --color option is needed to pass colors through. Here’s an example:
tail -f /var/log/apache2/access.log | ack --flush --passthru --color --color-match=green "^.* 200 .*" | ack --flush --passthru --color --color-match=yellow "^.* 302 .*" | ack --flush --passthru --color --color-match=red "^.* 404 .*"

You can use more complex colors like --color="white on_red" to make errors stand out even more.
I wonder what other cool things ack can do…
Note: You could also do this with perl, but it looks a lot less maintainable.
Nice OSX app for testing regular expressions.
This looks like a great editor, or at least the start of one.
Another awesome tool I wish I’d found earlier.
mkscript - test script creator
I usually do something wrong when I create test scripts (typo in shebang, not executable, missing open PHP tag, etc) so I wrote a small tool called mkscript that can create them for me.
Basically, instead of doing:
echo '#!/usr/bin/python' > test.py
chmod a+x test.py
You just do:
mkscript test.py
It knows how to create scripts for bash, perl, php, python, and ruby based on the extension you provide. You can get it here.
Pair it with this vim function to execute the current file and you have a really quick way to create and run test scripts!
Not sure how I didn’t find this until now, but it seems very cool.
Hopefully we have a good natural snow year so I can make good use of that season pass!
MarIrssi is a great alternative to other Mac IRC clients.