Skip to content

Instantly share code, notes, and snippets.

View human_log.py
# 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 Jul 24, 2015
extract email fields from mbox to CSV using awk
View mbox2csv.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 "\""
}
View 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