Skip to content

Instantly share code, notes, and snippets.

View AberrantWolf's full-sized avatar

Scott Harper AberrantWolf

View GitHub Profile
@AberrantWolf
AberrantWolf / mc_toy_roller.py
Last active October 22, 2019 15:02
Brute force the average number of excess toys to expect from a whole McDonald's set if only half are offered at a time vs. all offered at once.
import secrets
from itertools import chain
NUM_TOYS = 10
NUM_TRIALS = 10000
def pick_toy(toys_set):
return secrets.choice(list(toys_set))
@AberrantWolf
AberrantWolf / password_gen.py
Last active October 16, 2019 11:27
Generate random passwords that meet some criteria
import random
import string
NUM_CHARS = 7
# pick types are "random", "first", and "last"
PICK_TYPE = "last"
# options are "allowed", "required", and "none"
UPPER_CASE = "required"
@AberrantWolf
AberrantWolf / media_keys.c
Last active July 14, 2018 12:07
Code to run my media keys controller project.
// Uses Consumer API for media keys: https://github.com/NicoHood/HID/wiki/Consumer-API
#include <HID-Project.h>
const int mutePin = 5;
const int prevPin = 15;
const int playPin = 14;
const int nextPin = 16;
const uint64_t debounce_delay = 5;
@AberrantWolf
AberrantWolf / main.rs
Created December 27, 2017 04:26
Rust raytracer with stack overflow error
use std::ops;
use std::f32;
use std::rc::Rc;
extern crate rand;
use rand::random;
#[derive(Copy, Clone)]
struct Vec3D {x:f32, y:f32, z:f32}
impl Vec3D {