Skip to content

Instantly share code, notes, and snippets.

@johnrees
Created April 27, 2015 07:54
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 johnrees/ac5fd13ee8c96fade3af to your computer and use it in GitHub Desktop.
Save johnrees/ac5fd13ee8c96fade3af to your computer and use it in GitHub Desktop.
smartcitizen debug table to curl
$('table#log_table tr').each(function(index, tr) {
var a = $('td', tr).map(function(index, td) {
return $(td).text();
});
console.log("curl -v -X POST -H 'Host: sc.dev' -H 'User-Agent: SmartCitizen' -H 'X-SmartCitizenMacADDR: " + a[1] + "' -H 'X-SmartCitizenVersion: "+ a[2]+"' -H 'X-SmartCitizenData: [{\"temp\":\""+a[4]+"\",\"hum\":\""+a[5]+"\",\"light\":\""+a[6]+"\",\"bat\":\""+a[7]+"\",\"panel\":\""+a[8]+"\",\"co\":\""+a[9]+"\",\"no2\":\""+a[10]+"\",\"noise\":\""+a[11]+"\",\"nets\":\""+a[12]+"\",\"debug_push\": 1,\"timestamp\":\""+a[13]+"\"}]' sc.dev/add")
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment