Skip to content

Instantly share code, notes, and snippets.

View colmmacc's full-sized avatar

Colm MacCárthaigh colmmacc

View GitHub Profile
@colmmacc
colmmacc / shardcalc.py
Last active August 7, 2023 11:05
Calculate the blast radius of a shuffle shard
import sys
# choose() is the same as computing the number of combinations. Normally this is
# equal to:
#
# factorial(N) / (factorial(m) * factorial(N - m))
#
# but this is very slow to run and requires a deep stack (without tail
# recursion).
#

How many ways can we express "::"

Both IPv4 and IPv6 allow for some flexibility in how IP addresses are expressed as strings, but IPv6 really takes it to the max. How many ways can we express the all-zeroes IPv6 address, a.k.a. "::". Let's see.

The obvious

 ::

Running count: 1.

extern crate sha2;
extern crate nix;
extern crate libc;
use sha2::{Sha256, Digest};
use nix::request_code_write;
use std::os::unix::prelude::*;
use std::os::raw::c_int;
use std::fs::File;
use std::mem;
@colmmacc
colmmacc / wordle-cribs.md
Created January 3, 2022 01:12
Wordle Letter Frequency Cribs

Wordle Letter Frequency Table

If you're used to solving cryptic puzzles, or deciphering texts using crypt-analytical cribs, it can be useful to know the relative frequency of letters in the distribution of words. Wordle has a built-in list of 5-letter words. That list isn't the same as all of the five letter words in the dictionary, or even only the common ones. Perfectly common words like 'tudor' are omitted. This gist contains a few useful tables that are worth familiarizing yourself with if you want to solve wordle puzzles logically.

The raw frequency of each letter