Skip to content

Instantly share code, notes, and snippets.

@pranavrc
Last active December 16, 2015 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pranavrc/5516045 to your computer and use it in GitHub Desktop.
Save pranavrc/5516045 to your computer and use it in GitHub Desktop.
Example bash script using the QuickHist API.
#!/usr/bin/env bash
# Below is a one-liner that'll fetch you a histogram
# for the available filesystem spaces in your computer.
# You can run the command directly from your unix terminal.
curl $(echo "http://quickhist.onloop.net/Percentage=100,"$(df -h | awk '{print $1,$5}' | tail -n +2 | sed 's/%//g;s/G//g;H;${x;s/\n/,/g;s/^,//;p;};d;' | sed 's/\s\+/=/g;s/\//-/g;')) --silent | sed '1,2d;$d'
# The sed '1,2d;$d' is to remove HTML markup (first two lines and the last).
# You can ignore it; the histogram is
# distinctly visible amidst the markup anyway.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment