Comment And Uncomment All Lines in a Linux File with Sed

Posted by & filed under Professional.

Just a couple of sed one-liners for adding and removing comments in the form of # marks (in the case of my ~/.ssh/config file). I use this to toggle proxy settings (with connect.c) and it’s run by the awesome MarcoPolo location-aware app for OS X. Both of these are safe to run repeatedly (you won’t… Read more »

Cucumber with Webrat and Mechanize on CentOS 5

Posted by & filed under Professional.

Thanks to Chris for this one. The trick is to use JRuby and its gems, and also to install libxml2-devel $ cd ~ $ wget http://jruby.kenai.com/downloads/1.4.0/jruby-bin-1.4.0.tar.gz $ tar -C /usr/local/ -xzvf jruby-bin-1.4.0.tar.gz You should now have Jruby. Add it’s bin directory to your path, presumably in your ~/.bash_profile file: $ export PATH=$PATH:/usr/local/jruby-1.4.0/bin $ jruby -v… Read more »

Listing files with the path in Bash

Posted by & filed under Professional.

This little script will print a list of the current files in a directory, prefixed with the full path: #!/bin/sh curdir=`pwd` if [ $# -eq 1 ] then usrdir=”$1″ ls | xargs -I % echo `pwd`/% | sed -e s!$usrdir!! else ls | xargs -I % echo `pwd`/% fi You can optionally provide an initial… Read more »