Skip to content

Instantly share code, notes, and snippets.

@cahna
Last active December 31, 2015 02:29
Show Gist options
  • Save cahna/7920811 to your computer and use it in GitHub Desktop.
Save cahna/7920811 to your computer and use it in GitHub Desktop.
Clever: avg students/section (one-liner demo)
# Dependency: http://stedolan.github.io/jq/
jq '{total_districts: .[].count, students: [ .[][].data.students | length ]} | .total_students = reduce .students[] as $i (0; . + $i) | .total_students / .total_districts' <(curl -s -u DEMO_KEY: https://api.getclever.com/v1.1/sections) 2>/dev/null
@cahna
Copy link
Author

cahna commented Apr 1, 2014

looks like demo api has been changed/updated. result is now 5.75197889182058

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment