Skip to content

Instantly share code, notes, and snippets.

@bewest
Last active September 7, 2015 01:18
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 bewest/08dbe3c7589e4fe27246 to your computer and use it in GitHub Desktop.
Save bewest/08dbe3c7589e4fe27246 to your computer and use it in GitHub Desktop.
medtronic openaps nightscout entries
#!/bin/bash
HISTORY=${1-pumphistory.json}
OUTPUT=${2-pumphistory.ns.json}
TZ=${3}
cat $HISTORY | \
json -e "this.medtronic = this._type;" | \
json -e "this.dateString = this.timestamp + '$(TZ=TZ date +%z)'" | \
json -e "this.type = 'medtronic'" | \
json -e "this.date = this.date ? this.date : new Date(Date.parse(this.dateString)).getTime( )" \
> $OUTPUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment