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 past = new Map(); | |
let last = 'LRLRL'; | |
for (let i = 0; i < 1000; ++i) { | |
const stats = past.get(last) || {L: 0, R: 0}; | |
const choice = (stats.L >= stats.R) ? 'R' : 'L'; | |
console.log(choice); |
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 d3 = require('d3-array'); | |
const Combinatorics = require('js-combinatorics'); | |
const OddsCalculator = require('cardplayer-odds-calculator'); | |
const PromiseThrottle = require('promise-throttle'); | |
const oddsCalculator = new OddsCalculator({timeout: 30000}); | |
const odds = async (holes, dead = []) => { | |
switch(holes[0].length) { | |
case 2: return oddsCalculator.texasHoldem({holes, dead}); |
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
//////////////////////////////////////////////////////////////////////////////// | |
// Array helpers | |
const sum = arr => arr.reduce((a, b) => a + b, 0); | |
const mul = arr => arr.reduce((a, b) => a * b, 1); | |
const normalize = arr => { | |
const s = sum(arr); | |
return arr.map(x => x / s); | |
}; |
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
// ==UserScript== | |
// @name WhatsAppAlarms | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0 | |
// @description WhatsApp texts triggered by alarms in Israel | |
// @author Danny Leshem | |
// @match https://web.whatsapp.com/ | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=whatsapp.com | |
// @grant GM_xmlhttpRequest | |
// @connect www.oref.org.il |
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
// ==UserScript== | |
// @name Bypass Haaretz Paywall | |
// @namespace http://tampermonkey.net/ | |
// @version 0.2 | |
// @description Redirect paywalled haaretz.co.il articles to archive.is | |
// @author Danny Leshem | |
// @match https://www.haaretz.co.il/* | |
// @match https://www.haaretz.com/* | |
// @match https://www.themarker.com/* | |
// @grant none |
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 rand = (min, max) => min + Math.floor((max - min + 1)*Math.random()); | |
const maxOf = (min, max, n) => { | |
let m = min; | |
for (let i = 0; i < n; ++i) { | |
m = Math.max(m, rand(min, max)); | |
} | |
return m; | |
} |