GCPTGPPCDVJTNDVPWAT2ZGGVCR4GDAII4MJZVZRWTEASQPGBQDOAC
/*function datehour(s) {
let fuck = s.split(/\s+/);
return [fuck[0], Number(fuck[1].split(':')[0])];
}
function dumb(temp, idx) {
if(temp[1] === 12) {
shit[idx][0] = shit[idx][0].replace('12:', '00:');
} else {
console.error('what the fuck');
let usageStreams = new Map();
for(let i = shit.length - 1; i >= 0; --i) {
shit[i][0] = shit[i][0].replace(/^(\d{2})\/(\d{2})\/(\d{4})/, "$3-$2-$1");
let ym = shit[i][0].substring(0, 7);
if(shit[i][8] === 'MB') {
ym = shit[i][8] + '-' + ym;
}
if(!usageStreams.has(ym)) {
writeFileSync(`usage-${ym}.csv`, h1, {flag: 'wx'});
usageStreams.set(ym, [createWriteStream(`usage-${ym}.csv`, {flags: 'a'}), []]);
function gay(i) {
switch(drops.length) {
case 0:
break;
case 2:
let idx = drops[0] + 1;
let original = datehour(shit[idx][0]);
let temp = original;
dumb(temp, idx);
while(++idx < shit.length && original[0] === (temp = datehour(shit[idx][0]))[0]) {
usageStreams.forEach(v => {
function datehour(s) {
let fuck = s.split(/\s+/);
return [fuck[0], Number(fuck[1].split(':')[0])];
}
function dumb(temp, idx) {
if(temp[1] === 12) {
v[1][idx][0] = v[1][idx][0].replace('12:', '00:');
} else {
console.error('what the fuck', temp, idx, v[1][idx]);
}
}
function gay(i) {
switch(drops.length) {
case 0:
break;
case 2:
let idx = drops[0] - 1;
let original = datehour(v[1][idx][0]);
let temp = original;
}
case 1:
for(let j = drops[drops.length - 1]; j > i; --j) {
shit[j][0] = shit[j][0].replace(/(\d{1,2}):/, (match, p1) => Number(p1) + 12 + ':');
}
break;
default:
console.error('wtf');
while(--idx >= 0 && original[0] === (temp = datehour(v[1][idx][0]))[0]) {
dumb(temp, idx);
}
case 1:
for(let j = drops[drops.length - 1]; j < i; ++j) {
v[1][j][0] = v[1][j][0].replace(/(\d{1,2}):/, (match, p1) => Number(p1) + 12 + ':');
}
break;
default:
console.error('wtf', v[1][i], i, drops);
}
drops = [];
drops = [];
}
let dt = datehour(shit[shit.length - 1][0]);
let drops = [];
for(let i = shit.length - 2; i >= 0; --i) {
let dtt = datehour(shit[i][0]);
if(dtt[0] === dt[0]) {//same day
if(dtt[1] < dt[1]) {//new hour is less than (for example, 12 noon -> 1pm)
drops.push(i);
let dt = datehour(v[1][0][0]);
let drops = [];
for(let i = 1; i < v[1].length; ++i) {
let dtt = datehour(v[1][i][0]);
if(dtt[0] === dt[0]) {//same day
if(dtt[1] < dt[1]) {//new hour is less than (for example, 12 noon -> 1pm)
drops.push(i);
}
} else {//different day
gay(i);
dt = dtt;
}
gay(-1);*/
let usageStreams = new Map();
for(let i = shit.length - 1; i >= 0; --i) {
shit[i][0] = shit[i][0].replace(/^(\d{2})\/(\d{2})\/(\d{4})/, "$3-$2-$1").replace(/ (\d):/, " 0$1:");
let ym = shit[i][0].substring(0, 7);
if(!usageStreams.has(ym)) {
writeFileSync(`usage-${ym}.csv`, h1, {flag: 'wx'});
usageStreams.set(ym, createWriteStream(`usage-${ym}.csv`, {flags: 'a'}));
gay(v[1].length);
for(let i = 0; i < v[1].length; ++i) {
v[1][i][0] = v[1][i][0].replace(/ (\d):/, " 0$1:");
v[0].write(v[1][i].join() + '\n');