Skip to content

Instantly share code, notes, and snippets.

@Slayer95
Slayer95 / set-clone.js
Created August 5, 2017 17:02
Set shallow clone
const assert = require('assert');
const fs = require('fs');
const vm = require('vm');
const iterateSetElems = set => Set.prototype.keys.call(set);
const Builtin = require('proposal-istypes/polyfill'); // Git dependency
const SetPolyfillSource = fs.readFileSync(require.resolve('es6-shim'), 'utf8');
// Get a good polyfill for Set.
// We achieve this by loading the Set implementation from es6-shim.
@Slayer95
Slayer95 / set-clone-broken.js
Last active August 5, 2017 17:22
Set shallow clone
const assert = require('assert');
const fs = require('fs');
const vm = require('vm');
const iterateSetElems = set => Set.prototype.keys.call(set);
const Builtin = require('proposal-istypes/polyfill'); // Git dependency
const SetPolyfillSource = fs.readFileSync(require.resolve('es6-shim'), 'utf8');
// Get a good polyfill for Set.
// We achieve this by loading the Set implementation from es6-shim.
@Slayer95
Slayer95 / harness-v10-leak.js
Created March 31, 2019 17:50
Node.js v10 memory leak when looping readable sync streams with await
/**
* Random Simulation harness for testing and benchmarking purposes.
*
* Refer to `HARNESS.md` for detailed usage instructions.
*
* Pokemon Showdown - http://pokemonshowdown.com/
*
* @license MIT
*/
@Slayer95
Slayer95 / node-v10-promise-race-sync-stream-async-leak.js
Last active April 1, 2019 00:27
Node.js v10 memory leak when looping readable sync streams with await
'use strict';
/* global gc */
const RESULT_OBJECT = new Array(128).fill(0).map(x => ~~(Math.random() * 128));
const STREAM_LENGTH = 10;
const SUITE_SIZE = 10000;
function deepCloneInner(obj) {
@Slayer95
Slayer95 / osu-dual-difficulty-player.csv
Created April 27, 2019 22:44
Dataset for graph 2aaPczF
109 98.38
111 99.52
121 96.46
91 99.52
115 96.30
107 98.49
113 97.44
120 98.00
110 97.93
113 96.42
@Slayer95
Slayer95 / osu-user-accuracy-stats.csv
Created May 2, 2019 08:09
Several stats useful to report the accuracy of users, some treating it as a dependent variable of map difficulty
osu! username pp Diff. range W. Mean Mean Median IQM IQR Split median Split IQM LSQ Theil-Sen W. Theil-Sen Data
Death 9418 [375, 682] 98.89% 98.80% 99.04% 99.04% 99.48% -> 98.50% 99.40% -> 98.68% 99.38% -> 98.62% y = 98.80(0.84)% - 1.051E-4(x - 467.95) (R2=0.32) y = 99.06(0.87)% - 7.991E-5(x - 459.35) y = 99.05(0.87)% - 7.741E-5(x - 459.35) 681.7 97.33%;653.5 93.73%;645.5 98.48%;585.1 97.08%;556.1 99.12%;555.5 98.61%;551.9 98.76%;548.9 98.77%;544.0 95.48%;530.1 98.48%;526.4 99.02%;525.9 98.13%;523.2 98.52%;523.1 98.88%;521.0 96.98%;518.6 98.93%;516.0 98.83%;513.3 97.98%;511.9 98.94%;510.2 99.56%;507.5 95.42%;505.4 99.57%;501.0 97.98%;500.0 99.39%;498.4 99.45%;495.5 98.70%;488.7 98.07%;487.1 98.11%;483.0 97.60%;481.1 98.53%;480.2 98.69%;480.1 98.67%;479.4 99.33%;478.9 99.01%;477.4 98.31%;476.9 99.13%;475.8 99.21%;473.9 98.97%;470.5 99.20%;470.2 98.23%;470.1 97.12%;469.4 98.63%;468.8 98.07%;465.6 97.51%;465.4 99.00%;464.8 99.76%;463.9 99.51%;462.1 98.80%;460.6 98.00%;460.1 99.57%;458.6 97.47%;456.6 99.43%;456
'use strict';
/* global gc */
const RESULT_OBJECT = new Array(128).fill(0).map(x => ~~(Math.random() * 128));
const STREAM_LENGTH = 10;
const SUITE_SIZE = 10000;
function deepCloneInner(obj) {