Skip to content

Instantly share code, notes, and snippets.

@powerdot
Last active January 21, 2018 22:32
Show Gist options
  • Save powerdot/1064a03aee9e476004aad055d78fcb1a to your computer and use it in GitHub Desktop.
Save powerdot/1064a03aee9e476004aad055d78fcb1a to your computer and use it in GitHub Desktop.
//inject moment.js
$('body').append("<script src='https://momentjs.com/downloads/moment.js'></script>")
//script
var last_ts = 0;
var mid = 0;
var mid_q = 0;
var mid_h = 0;
var count = 0;
var long = 0;
var short = 99999999999999999;
$('tr').each(function(i, val){
var v = $(this).find('td').eq(2).text();
if(v.indexOf('201')<0){return 1;}
v = v.replace('.','-').replace('.','-').replace('.','-').replace(',','');
y = v.split(' ');
x = y[0].split('-');
v = x[2]+"-"+x[1]+"-"+x[0]+" "+y[1];
var m = moment(v).format("X");
if(last_ts != 0){
mid += last_ts - m;
mid_q += Math.pow(last_ts-m, 2);
mid_h += 1/(last_ts-m);
if(last_ts-m<short){short = last_ts-m;}
if(last_ts-m>long){long = last_ts-m;}
}
last_ts = m;
count++;
v = v+": "+m+" / ";
console.log( v, "LASTTS:"+last_ts, "M:"+m )
})
mid = mid/count;
mid_q = Math.pow(mid_q/count, 1/2);
mid_h = count/mid_h;
console.log( "MID:"+mid, "MID(h):"+((mid/60)/60), "MID(d):"+((mid/60)/60)/24, "LONG(h):"+long/60/60, "SHORT(h):"+short/60/60, "LONG(d):"+long/60/60/24, "SHORT(d):"+short/60/60/24 );
console.log( "MIDQ:"+mid_q, "MIDQ(h):"+((mid_q/60)/60), "MIDQ(d):"+((mid_q/60)/60)/24 );
console.log( "MIDH:"+mid_h, "MIDH(h):"+((mid_h/60)/60), "MIDH(d):"+((mid_h/60)/60)/24 );
@powerdot
Copy link
Author

powerdot commented Jan 21, 2018

2018-01-21 11:21:47: 1516522907 / LASTTS:1516522907 M:1516522907
VM309:26 2018-01-18 9:42:31: 1516257751 / LASTTS:1516257751 M:1516257751
VM309:26 2018-01-11 7:39:31: 1515645571 / LASTTS:1515645571 M:1515645571
VM309:26 2018-01-09 11:47:59: 1515487679 / LASTTS:1515487679 M:1515487679
VM309:26 2018-01-05 3:59:08: 1515113948 / LASTTS:1515113948 M:1515113948
VM309:26 2017-12-29 5:04:29: 1514513069 / LASTTS:1514513069 M:1514513069
VM309:26 2017-12-29 1:19:22: 1514499562 / LASTTS:1514499562 M:1514499562
VM309:26 2017-12-24 0:32:48: 1514064768 / LASTTS:1514064768 M:1514064768
VM309:26 2017-12-23 8:28:30: 1514006910 / LASTTS:1514006910 M:1514006910
VM309:26 2017-12-22 15:32:24: 1513945944 / LASTTS:1513945944 M:1513945944
VM309:26 2017-12-18 20:11:44: 1513617104 / LASTTS:1513617104 M:1513617104
VM309:26 2017-12-13 18:19:51: 1513178391 / LASTTS:1513178391 M:1513178391
VM309:26 2017-12-07 2:40:28: 1512603628 / LASTTS:1512603628 M:1512603628
VM309:26 2017-12-06 21:22:34: 1512584554 / LASTTS:1512584554 M:1512584554
VM309:26 2017-12-05 15:11:37: 1512475897 / LASTTS:1512475897 M:1512475897
VM309:26 2017-12-03 7:25:12: 1512275112 / LASTTS:1512275112 M:1512275112
VM309:26 2017-11-24 12:16:43: 1511515003 / LASTTS:1511515003 M:1511515003
VM309:26 2017-11-17 16:36:16: 1510925776 / LASTTS:1510925776 M:1510925776
VM309:26 2017-11-16 22:34:49: 1510860889 / LASTTS:1510860889 M:1510860889
VM309:26 2017-11-16 2:47:23: 1510789643 / LASTTS:1510789643 M:1510789643
VM309:26 2017-11-16 2:05:24: 1510787124 / LASTTS:1510787124 M:1510787124
VM309:26 2017-11-11 10:36:17: 1510385777 / LASTTS:1510385777 M:1510385777
VM309:26 2017-11-11 7:42:30: 1510375350 / LASTTS:1510375350 M:1510375350
VM309:31 MID:267285.0869565217 MID(h):74.2458574879227 MID(d):3.093577395330113 LONG(h):211.14138888888888 SHORT(h):0.6997222222222222 LONG(d):8.79755787037037 SHORT(d):0.029155092592592594
VM309:32 MIDQ:357886.4350168737 MIDQ(h):99.41289861579824 MIDQ(d):4.142204108991593
VM309:33 MIDH:31610.299852120374 MIDH(h):8.780638847811215 MIDH(d):0.36585995199213395

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment