Archive for the ‘tips’ Category

Report space remaining on disk on unix login

Sunday, March 23rd, 2008

I get a kick out of stuff like this. Add this to your .bash_profile to be greeted with the remaining space on your disk. df -h | awk 'NR==2 {print "Space available " $4}' This will actually change depending on which version of df you're using (i think). I get ...

Western Digital Drive with Leopard - “File system formatter failed.”

Tuesday, February 26th, 2008

I just bought a 1TB Western Digital drive. I am stoked. However, I tried to format the drive on my Mac (Leopard) and got the error "File system formatter failed" when I tried to format the disk as MacOS Extended (Journaled). Not cool. I found this forum thread which suggested ...

Compiling Imagemagick on MacOS X - Not finding libjpeg

Thursday, November 1st, 2007

I ran into an issue trying to get Imagemagick (convert) working on OSX last night. I had compiled libjpeg and installed it, but when I would compile convert, it would not have jpeg support. I found this post on dzone, which I followed and was able to use libjpeg just ...

PHP compile error on CentOS Install

Sunday, July 15th, 2007

I installed CentOS 5 on my VMWare a few days ago. I installed gcc via yum, compiled and installed libxml2. I then tried to install PHP 5.2.3 and received this error: configure: error: installation or configuration problem: C++ compiler cannot create executables. It took me forever to figure this out, ...

Calculating the queries per second average in Mysql

Wednesday, May 30th, 2007

I didn't find any simple ways to determine how hard our mysql database was working, so I whipped this up. It uses a 10 second delay to figure out the queries per second average. time=10 orig=`mysql -e "show status" | awk '{if ($1 == "Questions") print $2}'` sleep $time last=`mysql -e "show status" ...

Helpful SVN Script For Adding all Unknown files to Repository

Wednesday, May 30th, 2007

I use SVN from the command line a lot. I also hate typing things over and over. I wrote this script to add all files to a repository that are not already in there. svn status | awk '{if ($1 == "?") print $2 }' | xargs svn add I ...

Public / private key set up but not working?

Wednesday, April 25th, 2007

When you set up public key authentication, make sure your authorized_keys2 file has the permissions set to 600. If you don't, it's likely that you will still be prompted for your password. chmod 600 authorized_keys*

How to roll back commits to an earlier version of a repository in SVN

Friday, April 6th, 2007

I've always wanted to know how to do this, and for some reason I always had a hard time finding out how. I needed to rollback a change I had committed to my SVN repository. The way you rollback to an earlier version of your repository is to do ...

10 (very) Basic Tips for PHP Web Application Security

Friday, February 23rd, 2007

Barebones list for the things you should be looking for when developing a web app in PHP. Some of it applies to all web apps, not just PHP. Use HTML_Safe (or a similar javascript stripping library) to check for and remove javascript when you're accepting data that will be output ...

Pretty URLs using Multiviews

Thursday, October 12th, 2006

I saw a post on digg.com about how it's nice to have "pretty urls" that are easy to tell people. While i'm not sure anyone would remember rustyrazorblade.com slash some ridiculous post name, it's nice to have for search engines. Unfortunately, it didn't really go into detail about ...