Skip to content

Instantly share code, notes, and snippets.

View leeoniya's full-sized avatar
😕
shaving bytes and milliseconds. dependencies: {}

Leon Sorokin leeoniya

😕
shaving bytes and milliseconds. dependencies: {}
View GitHub Profile
@leeoniya
leeoniya / LICENSE
Created January 20, 2022 08:16 — forked from jjrv/LICENSE
SRLAB2 and OKLAB
Copyright (c) 2020- Juha Järvi
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
@leeoniya
leeoniya / sortArrays.js
Created July 2, 2021 03:18 — forked from boukeversteegh/sortArrays.js
Sorting multiple arrays in Javascript
/**
* Sorts all arrays together with the first. Pass either a list of arrays, or a map. Any key is accepted.
* Array|Object arrays [sortableArray, ...otherArrays]; {sortableArray: [], secondaryArray: [], ...}
* Function comparator(?,?) -> int optional compareFunction, compatible with Array.sort(compareFunction)
*/
function sortArrays(arrays, comparator = (a, b) => (a < b) ? -1 : (a > b) ? 1 : 0) {
let arrayKeys = Object.keys(arrays);
let sortableArray = Object.values(arrays)[0];
let indexes = Object.keys(sortableArray);
let sortedIndexes = indexes.sort((a, b) => comparator(sortableArray[a], sortableArray[b]));
@leeoniya
leeoniya / st4-changelog.md
Created April 8, 2021 22:48 — forked from jfcherng/st4-changelog.md
Sublime Text 4 changelog just because it's not on the official website yet.

Converted via https://domchristie.github.io/turndown

Sublime Text/Merge 中文 Telegram 交流群組: https://t.me/sublime_tw

About Sublime Text 4

ST 4 is currently under private alpha for power users to test and report issues to let the dev team make it polished before it gets publicly announced. It has been under alpha for over 1 year already and it's actually kind of stable for daily use now. If you have a ST 3 license, you can join the offical ST Discord chat server to download and test it. And the most important thing, report issues you encoutered so ST 4 can become better. I hope people can interact with the dev team more so I don't directly put download links here but maybe you are smart enough to guess them :)

Dev Channel Changelog

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];
@leeoniya
leeoniya / binom-test.js
Created April 19, 2020 20:44 — forked from bellbind/binom-test.js
[javascript] [statistics](both welch's and student's) t-test implementations
/*
// binomial coefficient nCk
function binom(n, k) {
k = n - k < k ? n - k : k;
const b = [1].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];
}
@leeoniya
leeoniya / README.md
Created April 19, 2020 20:34 — 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
@leeoniya
leeoniya / plink-plonk.js
Created February 18, 2020 07:27 — forked from tomhicks/plink-plonk.js
Listen to your web pages
@leeoniya
leeoniya / twittermute.txt
Created January 25, 2020 01:22 — 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
@leeoniya
leeoniya / key.md
Created December 21, 2019 14:16
Twitter (un)official Consumer Key

Twitter Official Consumer Key

Twitter for Android

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

Twitter for iPhone

type:            PIN

Consumer key: IQKbtAYlXLripLGPWd0HUA

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);
});
}