Skip to content

Instantly share code, notes, and snippets.

@booyaa
Last active August 29, 2015 14:26
Show Gist options
  • Save booyaa/792bbe95d0ad9d73b215 to your computer and use it in GitHub Desktop.
Save booyaa/792bbe95d0ad9d73b215 to your computer and use it in GitHub Desktop.
#!/bin/bash
# thanks to #A&A
# based on https://github.com/sammachin/databurndown/blob/master/burndown.py
# awk floating code http://math-blog.com/2012/07/23/floating-point-arithmetic-in-the-bourne-again-shell-bash/
set -e
if [ -z "$AAUSER" ] || [ -z "$AAPASS" ]; then
echo set AAUSER and AAPASS environment variables
echo 'AAUSER needs to be your clueless account (ends with @a)'
exit
fi
RAW=$(curl -s --user $AAUSER:$AAPASS https://chaos.aa.net.uk/info?JSON | json_pp | grep quota_left | cut -f2 -d':' | sed 's/[", ]//g')
GB=$(echo - | awk '{print '$RAW' / 1024 ^ 3}')
printf "you have %0.2f GB left\n" $GB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment