Skip to content

Instantly share code, notes, and snippets.

View ekeih's full-sized avatar

Max Rosin ekeih

View GitHub Profile
ekeih /
Last active November 17, 2018 01:44
hetzner invoices
#!/usr/bin/env bash
# Put all your Hetzner invoices in a 'pdf' directory and keep the original name.
for filename in pdf/*.pdf; do
date="$(date -d "$(sed 's,.*_\(.*\)_.*,\1,' <<< "${filename})")" '+%s000000000')"
value="$(pdftotext "${filename}" - | grep -A 2 Brutto | tail -n 1 | sed "s;\([0-9]*\),\([0-9]*\).*€;\1.\2;")"
payload="invoice value=${value} ${date}"
curl -i -XPOST '' --data-binary "${payload}"