{{ message }}

Instantly share code, notes, and snippets.

# Leon Sorokinleeoniya

😕
shaving bytes and milliseconds. dependencies: {}
Last active May 11, 2020
View uplot-ws.js
 let u; const ws = new WebSocket("ws://127.0.0.1:6789/"); ws.onmessage = function(event) { const data = JSON.parse(event.data); switch (data.type) { case 'ohlc': let ohlc = [data.ts, data.o, data.h, data.l, data.c];
Created Apr 19, 2020 — forked from bellbind/binom-test.js
[javascript] [statistics](both welch's and student's) t-test implementations
View binom-test.js
 /* // binomial coefficient nCk function binom(n, k) { k = n - k < k ? n - k : k; const b = .concat(Array.from(Array(k), _ => 0)); for (let i = 1; i <= n; i++) { for (let j = i < k ? i : k; j > 0; j--) b[j] += b[j - 1]; } return b[k]; }
Created Apr 19, 2020 — forked from bluesmoon/README.md
Pseudo-Random number generator that follows a Normal or Log-Normal distribution.

## Marsaglia-polar.js

This script generates random numbers along a Normal or Log-normal distribution using the Marsaglia polar method.

### There are four functions you can use:

• `normalRandom`: Generate random numbers that follow a Normal distribution.
• `normalRandomInRange`: Generate random numbers that follow a Normal distribution but are clipped to fit within a range
• `normalRandomScaled`: Generate random numbers that follow a Normal distribution with a given mean and standard deviation
• `lnRandomScaled`: Generate random numbers that follow a Log-normal distribution with a given geometric mean and geometric standard deviation
Created Feb 18, 2020 — forked from tomhicks/plink-plonk.js
Created Jan 25, 2020 — forked from IanColdwater/twittermute.txt
Here are some terms to mute on Twitter to clean your timeline up a bit.
 Mute these words in your settings here: https://twitter.com/settings/muted_keywords ActivityTweet generic_activity_highlights generic_activity_momentsbreaking RankedOrganicTweet suggest_activity suggest_activity_feed suggest_activity_highlights suggest_activity_tweet
Created Dec 21, 2019 — forked from shobotch/key.md
View key.md

``````type:            PIN
Consumer key:    3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys
``````

``````type:            PIN
Consumer key:    IQKbtAYlXLripLGPWd0HUA
``````
Created Dec 13, 2019
View server.js
 const http = require('http'); const port = 5000; const fetch = require('node-fetch'); const requestHandler = (request, response) => { fetch('http://localhost:3000/').then(r => r.text()).then(text => { // console.log(text); response.end(text); }); }
Created Aug 7, 2018
View stats.js
 function stats(arr) { arr = arr.slice().sort(); var n = arr.length; var sum = arr.reduce((acc, val) => acc + val, 0); var prod = arr.reduce((acc, val) => acc * val, 1); var amean = sum / n; var gmean = Math.pow(prod, 1 / n); var median = n % 2 === 0 ? (arr[n / 2 - 1] + arr[n / 2]) / 2 : arr[(n - 1) / 2]; var variance = 0; var stddev = 0;
Created Dec 31, 2017 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)
View letsencrypt_2017.md

# How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called `Certbot`):

• Standalone: replaces the webserver to respond to ACME challenges
• Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up `mydomain.com`. HTML is served from `/var/www/mydomain`, and challenges are served from `/var/www/letsencrypt`.

Created Aug 10, 2017
View domvm-memleak-reduced.html

You can’t perform that action at this time.