Skip to content

Instantly share code, notes, and snippets.

@richard-to
Created July 2, 2014 23:45
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 richard-to/eaa10f06f550a7ae4bf8 to your computer and use it in GitHub Desktop.
Save richard-to/eaa10f06f550a7ae4bf8 to your computer and use it in GitHub Desktop.
Quick and dirty script to generate fake sensor data for testing
function r(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
var type = 's';
var start_time = 1404313860;
var interval = 2;
var readings = 10;
for (var g = 0; g < 10; g++)
{
var message = type + " " + start_time + " " + r(50, 180) + " " + r(18,23);
for (var i = 1; i < readings; ++i)
{
start_time += (interval * 60);
message += ";" + (interval * i) + " " + r(50, 180) + " " + r(18,23);
}
start_time += (4 * 60)
console.log(message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment