Skip to content

Instantly share code, notes, and snippets.

View badly-drawn-wizards's full-sized avatar

Reuben Steenekamp badly-drawn-wizards

  • Whirly Labs
  • Cape Town
View GitHub Profile
@badly-drawn-wizards
badly-drawn-wizards / weirdly_concrete.py
Last active October 17, 2021 05:02
An implementation for experimenting with the weirdly concrete problem of https://xkcd.com/2529
#!/usr/bin/env python3
from itertools import chain
from math import atan2, pi as PI
from random import choice
# A point is (y, x)
def angleDiff(t1, t2):
if t2 < t1:
sudo nixos-rebuild switch --upgrade --show-trace
[sudo] password for reuben:
unpacking channels...
building Nix...
building the system configuration...
error: while evaluating the attribute 'config.system.build.toplevel' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix:275:5:
while evaluating 'foldr' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:52:20, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix:139:12:
while evaluating 'fold'' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:55:15, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:59:8:
while evaluating the attribute 'assertions' at undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:84:45, called from undefined position:
@badly-drawn-wizards
badly-drawn-wizards / juliphone_set.ipynb
Created November 4, 2019 11:34
Fractals from images (inspired by GoldPlatedGoof's video)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@badly-drawn-wizards
badly-drawn-wizards / dynamics.py
Created November 4, 2019 11:13
Interactively plotting trajectory of test charge.
# Background
# This was from a while back when I was playing around with exercises in Nonlinear Dynamics and Choas.
# This is an interactive plot that shows the trajectory of a test particle in an electric field
# starting from where the cursor is.
# Both euler and rk4 integration was implemented
from itertools import count, product
import numpy as np
from numpy.linalg import norm
@badly-drawn-wizards
badly-drawn-wizards / spectral_radius.ipynb
Created November 4, 2019 11:10
Visualizing power sequence theorem of spectral radius.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@badly-drawn-wizards
badly-drawn-wizards / Makefile
Created January 2, 2017 20:59
Makefile for icestorm
$(shell mkdir -p dist sim syn)
SRC=
.PRECIOUS: dist/%_syn.v dist/%.blif dist/%.asc dist/%.bin
.PHONY: clean upload-% build-% wave-% run-%-sim
clean:
-rm -rf dist
-rm -rf sim
-- Exercise: prove Peirce’s law <=> law of excluded middle in Haskell
{-# LANGUAGE Rank2Types #-}
import Data.Void
type Not a = a -> Void
type Peirce = forall a b. ((a -> b) -> a) -> a
type LEM = forall a. Either (Not a) a