Skip to content

Instantly share code, notes, and snippets.

View frostburn's full-sized avatar

Lumi Pakkanen frostburn

View GitHub Profile
@frostburn
frostburn / guide-by-cs.txt
Created February 8, 2024 13:29
Guide generator by CS size
=== CS size 5 ===
209 scales in total: 9, 243, 2187, 3^5/2, 3^2/3, 3^4/3, 3^3/4, 3^5/4, 3^3/5, 3^6/5, 3^7/6, 3^4/7, 3^5/7, 125, 15625, 5^1/2, 5^5/2, 5^7/2, 5^4/3, 5^5/3, 5^5/4, 5^7/4, 5^2/5, 5^4/5, 5^5/6, 5^3/7, 5^6/7, 36, 7776, 279936, 6^3/2, 6^7/2, 6^1/3, 6^7/3, 6^3/4, 6^2/5, 6^4/5, 6^6/5, 6^5/6, 6^7/6, 6^3/7, 6^5/7, 7, 16807, 117649, 7^5/2, 7^7/2, 7^1/3, 7^2/3, 7^3/4, 7^7/4, 7^2/5, 7^7/5, 7^2/7, 7^5/7, 9/4, 243/32, 2187/128, 3/2^3/2, 3/2^7/2, 3/2^1/3, 3/2^5/3, 3/2^1/4, 3/2^7/4, 3/2^1/5, 3/2^7/5, 3/2^1/6, 3/2^1/7, 3/2^2/7, 125/8, 15625/64, 5/2^3/2, 5/2^2/3, 5/2^7/3, 5/2^3/4, 5/2^4/5, 5/2^7/5, 5/2^5/6, 5/2^1/7, 5/2^5/7, 5/2^6/7, 7/2, 16807/32, 117649/64, 7/2^1/2, 7/2^5/3, 7/2^7/4, 7/2^3/5, 7/2^6/5, 7/2^7/6, 7/2^4/7, 16/9, 1024/243, 16384/2187, 4/3^5/2, 4/3^1/3, 4/3^7/3, 4/3^1/4, 4/3^1/5, 4/3^2/5, 4/3^1/6, 4/3^1/7, 4/3^2/7, 4/3^3/7, 625/81, 78125/2187, 5/3^3/2, 5/3^5/2, 5/3^4/3, 5/3^1/4, 5/3^5/4, 5/3^1/5, 5/3^6/5, 5/3^7/5, 5/3^1/6, 5/3^7/6, 5/3^1/7, 2401/81, 16807/243, 7/3^3/2, 7/3^5/2, 7/3^2/3, 7/3^5/3, 7/3^
// commit f6fa7fcc809d2952d4cb3b991e0c6b8c6c559371 of https://github.com/xenharmonic-devs/sonic-weave
import {
Interval,
evaluateExpression,
hasConstantStructure,
subtensions,
} from '../src';
const obtained = [
@frostburn
frostburn / tagged-vector-adder.pegjs
Created December 3, 2023 18:49
Peggy proposition: Tagged template parser with auto-vectorization of template arguments
{{
function add(left, right) {
if (typeof left === 'number') {
if (typeof right === 'number') {
return left + right;
} else {
return right.map(r => left + r);
}
} else {
if (typeof right === 'number') {
@frostburn
frostburn / sw2-ast.js
Last active December 3, 2023 09:30
Scale Workshop 2 grammar with error generating examples
// Generated by Peggy 3.0.2.
//
// https://peggyjs.org/
"use strict";
function PlainLiteral(value) {
return {
type: 'PlainLiteral',
@frostburn
frostburn / sob.py
Created June 8, 2022 07:38
Turning drawings from SOB into audio
from numpy import arange, linspace, where, maximum, sqrt, floor, clip, concatenate
from matplotlib.pyplot import plot, legend, show
import scipy.io.wavfile
# --- Helpers ---
def sqrt0(x):
return sqrt(maximum(0, x))
def triangle(x):
x = x - floor(x)
@frostburn
frostburn / square_adding.py
Created September 23, 2020 09:16
Find numbers that have long "square adding" chain lenghts
from math import *
import random
__author__ = "Lumi Pakkanen"
__licence__ = "Public domain"
__version__ = "1.0.0"
# See https://youtu.be/hGQdsibB2is for context.
@frostburn
frostburn / quaternion_density_cloud.py
Created September 9, 2018 13:37
Visualizing a quaternion density cloud
import numpy as np
import quaternion
import scipy.misc
import multiprocessing
t = 0
def project_cloud(seed):
np.random.seed(seed)
cloud = np.random.randn(1000000, 4) * 0.2
#!/usr/bin/env python3
import argparse
BAILOUT = 16
MAX_ITER = 56
def escape_time(c):
z = 0j # Squaring accumulator
@frostburn
frostburn / complex_rationals.py
Created November 28, 2015 21:12
Plot complex rational numbers grouped by the absolute value of the denominator in reduced form.
from __future__ import division
from argparse import ArgumentParser
from itertools import cycle
from pylab import *
tau = 2 * pi
if __name__ == '__main__':
parser = ArgumentParser(description='Plot complex rational numbers')
@frostburn
frostburn / mirror.d
Last active August 29, 2015 14:22
The diagonal mirror routine for the 11x10 board in my go toolkit
void mirror_d() pure nothrow @nogc @safe
in
{
assert(valid);
assert(can_rotate);
}
out
{
assert(valid);
assert(can_rotate);