Skip to content

Instantly share code, notes, and snippets.

# public domain
# caio begotti
set -euo pipefail
wget --quiet -O ${CSVFILE}
caiobegotti /
Created January 5, 2015 00:01
Busca palavra no dicionário da ABL já pelo acordo ortográfico
#!/bin/bash -eu
# public domain
term=$(echo ${input} | xmlstarlet esc | sed -e 's/\&\#\x/\%/;s/\;//')
lynx -dump${term} | sed -e '1!d' -e 's/^.* \([a-z]\+\) .*/\1/g'
caiobegotti /
Created October 8, 2014 22:01
Log trapper, useful when you want to log all commands with a timestamp for further analysis (e.g. if your script echoes to a log file)
function logtrap() {
local last="${BASH_COMMAND}"
local exitcode=${?}
# any format is ok but this will be printed BEFORE all commands, not after
echo "TRAPLOG: [$(date +%T)] [${exitcode}] [${last}]"
caiobegotti / 1SE-hack
Created January 23, 2014 16:45
Hack to work around the limitations of for iOS
# an special function because it requires the IP of my iphone
rtw-backup-one-second-everyday () { rsync -avz --stats --progress --rsh=ssh root@${1}:/private/var/mobile/Applications/.../Documents/* ~/one-second-everyday/; }
# special case for the damn 1SE app on iphone
# which does not offer an option to disable overlays
# nor change the date format, nor hide its logos
function rtw-one-second-list() {
originalfile=$(find ~/one-second-everyday/ -iname '*STORED_ONE_SECOND_VIDEOS_ARRAY_FILE_PATH*' | head -1)
originallist=$(basename ${originalfile})
caiobegotti / gist:2307114
Created April 5, 2012 01:12
cat *.xml | sed 's/\([A-Z][[:alpha:]]\{0,\}\. [A-Z]\)/| \1/g' | tr '|' '\n' | sed 's/^\( .\{25\}\).*$/\1/g'
Cn. Octauii praecidi capu
P. Crassi
Sp. Albinus, homines cons
M. Antonii, omnium eloque
C. Caesaris, in quo mihi
C. Marius tum, cum Cimbri