Skip to content

Instantly share code, notes, and snippets.

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
@romain-dartigues
romain-dartigues / mbox2csv.awk
Created July 24, 2015 17:32
extract email fields from mbox to CSV using awk
#!/usr/bin/awk -f
# usage: mbox2csv INBOX > result.csv
# tested with gawk and mawk
# attempt to generate a Microsoft Excel compatible CSV
function escape_cell(cell) {
gsub(/"/, "\"\"", cell)
return "\"" cell "\""
}
@romain-dartigues
romain-dartigues / doapi.sh
Last active August 29, 2015 14:19 — forked from elbuo8/doapi.sh
{
echo '{'
for endpoint in sizes regions images ssh_keys; do
echo -n '"'$endpoint'": '
curl -s "https://api.digitalocean.com/${endpoint}/?client_id=${DO_CLIENT_ID}&api_key=${DO_API_KEY}"
echo ','
done | sed '$s/,$//'
echo '}'
} | python -mjson.tool