Skip to content

Instantly share code, notes, and snippets.

@benjamind
Created July 24, 2013 18:03
Show Gist options
  • Save benjamind/6072948 to your computer and use it in GitHub Desktop.
Save benjamind/6072948 to your computer and use it in GitHub Desktop.
This is a simple nodejs script that massages our stats data into separate files which we can use in OpenSCAD to produce 3d models.
var filename = 'response-times-15min',
fs = require('fs'),
out = [],
i = 0,
array = fs.readFileSync(filename + '.tsv').toString().split('\n');
for (i=0; i < array.length; i++) {
out.push(array[i]);
out.push(array[i]);
fs.writeFileSync(filename + '-' + i + '.txt', array[i].toString() + "\n");
fs.appendFileSync(filename + '-' + i + '.txt', array[i]);
}
for (i=0; i < out.length; i++) {
fs.appendFileSync('./' + filename + '-double.txt', out[i].toString() + "\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment