This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var execSync = require('child_process').execSync; | |
| var assert = require('assert'); | |
| var result = 'GOOD'; | |
| var results = { | |
| 'input1.dat': '[450,460,470,480,490,500,510,520,530,540,6225]', | |
| 'input2.dat': '[910,839,1120,1014,1126,900,974,866,1698,1384,10944]', | |
| 'input3.dat': '[0,108,0,0,0,0,0,0,0,0,0]' | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var readline = require('readline'); | |
| function myAssigner(item) { | |
| return (item >= 100)? 10: item % 10; | |
| } | |
| function BucketReport(count,assigner,scorer) { | |
| return { | |
| buckets: new Array(count).fill(0), | |
| add: function(i) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var execSync = require('child_process').execSync; | |
| var assert = require('assert'); | |
| var result = 'GOOD'; | |
| var results = { | |
| 'paritions': '{"sda":[8,0],"sda1":[8,1],"sda2":[8,2],"sda5":[8,5]}' | |
| }; | |
| try { | |
| for (var input of Object.keys(results)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const readline = require('readline'); | |
| const fs = require('fs'); | |
| function readLines(devs,callback) { | |
| var values = {}; | |
| var rs = fs.createReadStream('./partitions'); | |
| rs.on('error', function(e) { | |
| callback(e); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * groupBy | |
| * ======= | |
| * Given array of objects iter, group by object property prop and return | |
| */ | |
| function gb(iter,prop) { | |
| var r = {}; | |
| iter.map(function(e) { | |
| console.log(e); | |
| (r[e[prop]] = r[e[prop]] || []).push(e); |
NewerOlder