Monday, December 03, 2012

perlbrew options that i use

perlbrew install perl-5.10.1 -Dusethreads -Duselargefiles -Dcccdlflags=-fPIC -Doptimize=-O2 -Duseshrplib -Duse64bitall

Saturday, September 15, 2012

tweaking psql in color

Merlin Moncure recently posted a blog entry about psql now in color.

I tried it but got some issues when run. man pages in particular were failing to show properly.

The solution was quite simple: unset LESS and PAGER variables *after* running psql.

so my .bashrc now has this nice function in it

psql() {
    YELLOW=$(printf "\e[1;33m" )
    LIGHT_CYAN=$(printf "\e[1;36m" )
    NOCOLOR=$(printf "\e[0m"    )

    export LESS="-iMSx4 -FXR"

    PAGER="sed \"s/\([[:space:]]\+[0-9.\-]\+\)$/${LIGHT_CYAN}\1$NOCOLOR/;" 
    PAGER+="s/\([[:space:]]\+[0-9.\-]\+[[:space:]]\)/${LIGHT_CYAN}\1$NOCOLOR/g;" 
    PAGER+="s/|/$YELLOW|$NOCOLOR/g;s/^\([-+]\+\)/$YELLOW\1$NOCOLOR/\" 2>/dev/null  | less"
    export PAGER

    env psql "$@"
    unset LESS PAGER
}

Monday, June 18, 2012

tar strip first directory

Thanks to http://www.marksanborn.net/linux/extract-without-first-directory) I have learned a new option to the venerable tar command.

I needed to extract the latest 1.x branch of the cakephp source code(1.3.15), but omit the initial  cakephp-cakephp-5e063d7. The --strip-components=1 option came in handy for this.

tar --strip-components=1 cakephp-1.3.15.tar.gz

:)