Skip to content

Instantly share code, notes, and snippets.

Avatar
🕳️

Jan De Wilde JanDW

🕳️
View GitHub Profile
View monty-hall.js
function shuffleArray(arr) {
for (let i = arr.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[arr[i], arr[j]] = [arr[j], arr[i]];
}
}
const montyHall = (n) => {
let wins = 0;
let doors = ["goat", "goat", "car"];
@JanDW
JanDW / boonie_Monte_Carlo.m
Created Aug 31, 2020
Runs a Monte Carlo experiment of the Boonie simulation
View boonie_Monte_Carlo.m
% Runs a Monte Carlo experiment of the Boonie simulation
%
%
% Input(s)
% nMC: Number of Monte Carlo iterations
%
% Output(s)
% Days: Vector of days until Boonie gets caught
%
% Example:
@JanDW
JanDW / boonieSim.m
Created Aug 31, 2020
Simulates the Boonie Conundrum
View boonieSim.m
% Simulates the Boonie Conundrum
%
%
% Input(s)
% DispOn: Displays the graph of student and teacher rumor knowledge
% Modify simulation parameters in the code below
%
% Output(s)
% studentFraction: Fraction of student population that knows the rumor
% teacherFraction: Fraction of teacher population that knows the rumor
@JanDW
JanDW / .eleventy.config.js
Created Aug 15, 2020 — forked from danielpost/.eleventy.config.js
Eleventy: Purge CSS for each html file
View .eleventy.config.js
const { PurgeCSS } = require('purgecss');
/**
* Remove any CSS not used on the page and inline the remaining CSS in the
* <head>.
*
* @see {@link https://github.com/FullHuman/purgecss}
*/
eleventyConfig.addTransform('purge-and-inline-css', async (content, outputPath) => {
if (process.env.ELEVENTY_ENV !== 'production' || !outputPath.endsWith('.html')) {
@JanDW
JanDW / optPoolSize.py
Created Aug 10, 2020
The mathematics of COVID-19 pool testing
View optPoolSize.py
# -*- coding: utf-8 -*-
"""
Estimates the optimal pandemic testing pool size
Ref: https://asm.org/Articles/2020/July/COVID-19-Pool-Testing-Is-It-Time-to-Jump-In
https://www.statnews.com/2020/06/26/pool-testing-covid-19/
Created on Sun Aug 2 20:29:23 2020
@author: johnx
"""
@JanDW
JanDW / bass.md
Created Mar 18, 2019
Double bass—fingerboard octave
View bass.md

Bass fingerboard octave

E A D G position
F A♯/B♭ D♯/E♭ G♯/A♭ ½
F♯/G♭ B E A 1
G C F A♯/B♭ 2
G♯/A♭ C♯/D♭ F♯/G♭ B
A D G C 3