Skip to content

Instantly share code, notes, and snippets.

@fcostin
fcostin / lds.py
Created October 16, 2017 08:20
simple demo low disrepancy sequence -- Halton sequence in 2d using bases (2, 3)
from itertools import izip
def decompose(b, n):
k = 0
while n:
r = n % b
q = (n-r)/b
yield (r, k)
k += 1
n = q
@fcostin
fcostin / example_output.txt
Last active June 12, 2019 12:01
attempted formalisation and optimisation of Christopher Alexander-ish "arrange the related design elements into a bunch of (overlapping?) subsystems" problem
<<< optimiser debug gibberish >>>
0000044880 ACCEPT 105 --> 104 (('grow', frozenset({1, 2, 14, 18, 26, 27}), 13))
{frozenset({33, 3, 6, 7, 8, 9, 10, 11, 19, 29}), frozenset({1, 2, 18, 26, 27, 13, 14}), frozenset({1, 2, 3, 12, 13, 20, 22, 23}), frozenset({16, 17, 21, 24, 25, 31}), frozenset({5, 15, 28, 29, 30}), frozenset({32, 17, 18, 4, 15})}
transation: on iteration 44880 i accepted the proposed move from a state with loss 105 to a new state with loss 104 via the move (('grow', frozenset({1, 2, 14, 18, 26, 27}), 13)) resulting in a new state containing the groups
{frozenset({33, 3, 6, 7, 8, 9, 10, 11, 19, 29}), frozenset({1, 2, 18, 26, 27, 13, 14}), frozenset({1, 2, 3, 12, 13, 20, 22, 23}), frozenset({16, 17, 21, 24, 25, 31}), frozenset({5, 15, 28, 29, 30}), frozenset({32, 17, 18, 4, 15})}
<<< results >>>
@fcostin
fcostin / git_trivia.sh
Created July 12, 2019 10:40
git_trivia.sh
#! /bin/bash
set -x -e
# In the beginning there was nothing, just hopes, dreams,
# a modest development budget.
mkdir -p demo
cd demo
git init .
@fcostin
fcostin / trash_can_state_machine_poc.ino
Last active September 1, 2020 12:28
hypothetical refactor of self-opening trash can state machine
// 2020/09/01 - this code is placed in the public domain.
//
// This is a hypothetical refactor of state machine code from
// ivanilves's fun self-opening trash can project.
//
// Ref: https://github.com/ivanilves/arduino-sketches/blob/d0e965ebae1b98fa23b833fed2e2e28b21ef8863/basurito/basurito.ino
//
// The code below is incomplete, has not been tested and will not work! it's a sketch of an idea.
//
// Rough principles of this refactor: