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
# brew install gnuplot | |
histfile=histogram-bytes.png | |
# histfile=histogram-random.png | |
psql -p5432 -h localhost -d happy_dev -U happy_dev << EOF 2>&1 | head -n -1 | cut -d' ' -f3 | gnuplot -p -e "n=100;max=9999.;min=1000.;width=(max-min)/n;hist(x,width)=width*floor(x/width)+width/2.0;set term png;set output '$histfile';set xrange [min:max];set yrange [0:];set offset graph 0.05,0.05,0.05,0.0;set xtics min,(max-min)/5,max;set boxwidth width*0.9;set style fill solid 0.5;set tics out nomirror;set xlabel 'x';set ylabel 'Frequency';plot '-' u (hist(\$1,width)):(1.0) smooth freq w boxes lc rgb'green' notitle;" | |
DO | |
\$do\$ | |
DECLARE | |
i INT; | |
BEGIN |
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 createMultidimensionalArray = (dimensions, defaultValue = undefined) => { | |
if (dimensions < 1) { | |
throw new Error('Dimensions must be greater than 0'); | |
} | |
return new Proxy([], { | |
get(target, prop) { | |
if (!(prop in target)) { | |
if (dimensions === 1) { | |
return defaultValue; | |
} |
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 stream = new class { // Mock event stream | |
handler = null; | |
async start() { | |
while (true) { | |
const ms = Math.random() * 100; | |
await new Promise(resolve => setTimeout(resolve, ms)); | |
if (this.handler) this.handler(ms); | |
if (ms < 10 && this.handler) this.handler(ms); | |
} | |
} |
OlderNewer