Skip to content

Instantly share code, notes, and snippets.

@vielmetti
Created August 26, 2015 04:17
Show Gist options
  • Save vielmetti/85d5fba07b98e552c912 to your computer and use it in GitHub Desktop.
Save vielmetti/85d5fba07b98e552c912 to your computer and use it in GitHub Desktop.
#!/bin/sh
curl -s http://www.a2dda.org/map/AADDACount.json | \
jq '.countdata[] | \
{ timestamp: (.timestamp | strptime("%m/%d/%Y %I:%M:%S %p")| mktime | todate), \
facility: .facility, \
spacesavail: (.spacesavail | tonumber) }' | \
mongoimport -d test -c a2dda
@vielmetti
Copy link
Author

db.a2dda.aggregate( [ { $group: { _id: "$timestamp", total: { $sum: "$spacesavail" } } } ] )

@vielmetti
Copy link
Author

db.a2dda.aggregate( [ { $group: { _id: "$timestamp", total: { $sum: "$spacesavail" } } }, { $sort: { _id: 1 } } ] )

@vielmetti
Copy link
Author

ok, it's in crontab, let's let it run for a while

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