nix, shell, perl, php, mysql and mac os x tips and tricks

Monday, August 30, 2004

Update the ports sources on FreeBSD

sudo cvsup -g -L 2 /usr/share/examples/cvsup/ports-supfile.good

Friday, August 20, 2004

"save down" an mp3 to 64kpbs (warning, this overwrites the original mp3)

for i in *.mp3; do lame --decode $i `basename $i .mp3`.wav; lame -b 64 `basename $i .mp3`.wav $i; rm -f `basename $i .mp3`.wav; done

Burn a directory to CD (data)

mkisofs -r -J -v -V $(echo "$1" | cut -c 0-32) $1 | cdrecord -v -dev=0,0,0 fs=6m -eject -

Sunday, August 1, 2004

Encode all .wav files in a directory (at 96), and delete them

for i in *.mp3; do lame -b 96 $i `basename $i .wav`.mp3; rm -f $i; done

Start the gdm on debian

/etc/init.d/gdm start

MySQL query for selecting records that originated at a non-paid referer

SELECT websource, referer_host, referer_keywords, my_referer
FROM orders
WHERE referer_host <> ''
AND websource IS NULL
Use this to exclude people searching for you specifically
SELECT websource, referer_host, referer_keywords, my_referer
FROM orders
WHERE referer_host <> ''
AND websource IS NULL
AND referer_keywords NOT LIKE '%[domain]%'