Skip to content

Instantly share code, notes, and snippets.

View maxencefrenette's full-sized avatar

Maxence Frenette maxencefrenette

View GitHub Profile
@maxencefrenette
maxencefrenette / main.py
Last active January 23, 2026 20:54
Card flip probability
from functools import cache
@cache
def p(black_cards_in_deck, red_cards_in_deck):
"""
You flip cards from a deck of cards.
At any point, you can stop and flip one last card.
If that card is black, you win. If it is red, you lose.
What is the probability of winning if you play optimally?
@maxencefrenette
maxencefrenette / main.js
Created June 6, 2022 00:02
Increlution Speedup Hack
// Insert this at the start of app/gniller.min.js
// This needs to be redone after any update
// Known issue: needs a game restart after restarting a new game+
const oldNow = Date.now;
const timestamp = Date.now();
Date.now = () => {
return timestamp + 1000 * (oldNow.call(Date) - timestamp);
}
interface Cat {
readonly name: string | undefined;
}
function catPrinter(cat: Cat) {
if (cat.name === undefined) {
return;
}
console.log(cat.name.trim());
@maxencefrenette
maxencefrenette / launch.json
Created February 13, 2018 23:28
Typescript + VSCode Debugging
{
"version": "0.2.0",
"configurations": [
// Taken from https://medium.com/spektrakel-blog/debugging-typescript-from-vscode-3cb3a182bf63
{
"type": "node",
"request": "launch",
"name": "Launch current file w/ ts-node",
"protocol": "inspector",
"args": ["${relativeFile}"],