maandag 25 oktober 2010

two mysql reminders

full text searches
http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html

REPLACE syntax
http://dev.mysql.com/doc/refman/5.0/en/replace.html

donderdag 21 oktober 2010

convert tweets into speech bash one-liner

This works on linux but the festival speech output is not very clear. You will need curl, xmlstarlet and festival binaries for this to work.

$curl "http://api.twitter.com/1/statuses/user_timeline.xml?count=1&screen_name=barackobama" | xmlstarlet sel -t -m "//status" -v "text" | festival --pipe --tts


Should work on OS X as well with the "say" command and some grep and sed magic:
$curl "http://api.twitter.com/1/statuses/user_timeline.xml?count=1&screen_name=barackobama" | egrep -w "(.*)" | sed -E "s/<\/?text>//g" | say

dinsdag 12 oktober 2010

tar directly to email

tar cvjf - folder/ | mailx email@address.com

tar to another host over ssh

tar zcvf - /home | ssh rhost "cat > /dev/tape"

maandag 4 oktober 2010

occurences of a line in a file, counting words

uniq -c is especially handy in combination with cut to get parts of csv files