June 2007

You are browsing the archive for June 2007.

it wasn’t me..

My mail server is going mad.. It looks like some spammer decided to use my domain and I am currently rejecting thousands of emails to the user ‘fidpbandjellyqid’ at my domain.. Sorry, but it wasn’t me.. update: (Thu Jun 21 18:18:27) – the mail traffic is slowly but surely tapering off, but total rejected messages [...]

epoch2local

Another little tidbit.. I use this frequently to translate epoch timestamps from a Postgres database log table: #!/usr/bin/perl # translate epoch time to human readable local time use strict; use warnings; my $epoch = $ARGV[0]; if ( $epoch ) { print “Epoch time: “.$epoch.”\n”; print “Local time: “.localtime($epoch).”\n”; } else { print “This script takes [...]

psql2csv

CSV Output from ‘psql’ – courtesy of Will R. #!/bin/bash FS=”‘|field_separator|’” RS=”‘|record_separator|’” HOST=”localhost” DB=”core” USER=”core_write” FILE=$1 psql -A -F$FS -R$RS -f$FILE -h$HOST -d$DB -U$USER \ | sed ‘s/”/”"/g’ \ | sed “s/$FS/\”,\”/g” \ | sed “s/$RS/\”\n\”/g” \ | sed ’1s/^\(.*\)$/”\1/’ \ | grep -v “^\”([0123456789]\+ row[s]\?)$” This script will properly escape commas, quotes, and newlines. [...]