Skip to content

Instantly share code, notes, and snippets.

View lynn's full-sized avatar
🐞

Lynn lynn

🐞
View GitHub Profile
@lynn
lynn / toaq-summary.md
Last active November 20, 2019 18:45
Toaq summary

(under construction)

The Esperanto I speak

(Okay, I don't speak much of it. But everyone has to reform Esperanto at some point. Here is my mild take on it:)

Gender

  • gender-neutral third person singular pronoun “ri”
  • most words unmarked for gender; -iĉ- suffix for “male” (i.e. bovo, boviĉo, bovino)
  • avo, edzo, fianĉo, nepo, nevo, onklo, vidvo, kuzo: become gender-neutral, with optional -iĉ- and -in- suffix to mark gender.
  • filo, filino → ido, idiĉo, idino
  • frato, fratino → frato, soro
  • patro, patrino → patro, matro
@lynn
lynn / hm.hs
Last active July 2, 2024 09:52
A Haskell implementation of Hindley–Milner (including unification) using STRefs
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
import Control.Monad
import Control.Monad.Except
@lynn
lynn / ithkuil.txt
Last active December 25, 2019 14:21
Ithkuil notes
1. Phonology
============
why dh and xh in the transliteration? but not th??? just use ð and χ, quijada
3. Basic Morphology
===================
Configuration:
@lynn
lynn / fm.cc
Created January 12, 2018 22:22
very simple FM synthesis!
// clang++ -std=c++14 fm.cc && ./a.out | aplay -r44 -f S16_LE
#include <cstdint>
#include <cmath>
#include <cstdio>
using s16 = std::int16_t; // signed 16-bit samples
const auto rate = 1.0 / 44000.0; // 44 kHz
const auto τ = 3.14159265 * 2;
s16 to_sample(double x) { return s16((x<-1?-1:x>1?1:x) * 0x7fff); }
@lynn
lynn / quadrics.nb
Created December 7, 2017 18:19
Mathematica quadric normalizer
K := 5 x^2 + 4 x y + 2 y^2 + 2 x - 4 y + 3 (* Input quadric *)
X := Variables[K]; n := Length[X]
(* Mathematica's Coefficient[3x+2xy,x] gets us 3+2y. We just want the free term, 3. *)
FreeTerm[p_] := p /. Map[# -> 0 &, X] (* p with all variables substituted by 0 *)
Co[m_] := FreeTerm[Coefficient[K, m]] (* So Co[x^2] is 5, Co[y] is -4... *)
A := Table[Co[X[[i]] * X[[j]]] / If[i==j, 1, 2], {i, 1, n}, {j, 1, n}]
B := Table[Co[X[[i]]], {i, 1, n}]
@lynn
lynn / bf.ni
Last active November 30, 2017 12:53
brainfuck interpreter in Inform 7
"Brainfuck Interpreter" by "Lynn"
[ Such language in a high-class establishment like this! ]
Chapter 1 - Implementation
[ These inputs are queried before execution starts: ]
The code is a text that varies.
The program input is a text that varies.
[ These global values describe the state of our machine: ]
@lynn
lynn / vimanim.py
Last active April 16, 2024 15:14
make animated GIFs out of vim commands!
#!/usr/bin/env python3
r"""vimanim - make animated GIFs out of vim commands!
Usage:
vimanim <code> <output.gif> [<input>] [options]
<code> should contain the exact bytes to feed to vim.
This means: raw newlines for <Enter>, raw \x1b bytes for <Esc>, etc.
Some UTF-8 codepoints have special meaning, though:
@lynn
lynn / followers-graph.py
Last active October 18, 2017 00:11
Generate Twitter followers graph from webarchive crawl data
#!/usr/bin/env python3
# Example:
#
# % python3 followers-graph.py 0xlynn chordbug
# 2017/04/21 224
# 2017/04/22 238
# 2017/04/27 288
# 2017/05/07 328
# 2017/05/08 329
@lynn
lynn / miscellany.v
Created October 7, 2017 15:19
Old Coq proofs from my hard drive
(* CanHalveEven.v *)
Inductive Even : nat -> Prop :=
| Even_base : Even 0
| Even_step : forall n, Even n -> Even (S (S n)).
Check Even_ind.
Theorem can_halve_even :
forall n, Even n -> (exists k, k + k = n).