Skip to content

Instantly share code, notes, and snippets.

@lynn
lynn / ji.py
Last active February 21, 2024 11:46
play just-intonation chord progressions in your terminal
#!/usr/bin/env python
#
# python3.8 ji.py --help
# python3.8 ji.py CEGBb CE-GBbL | aplay -r44 -f S16_LE
# python3.8 ji.py CEGBb CE-GBbL | ffmpeg -f s16le -ar 44.1k -ac 1 -i - ji.mp3
"""
Play chord progressions in just intonation.
Raw PCM audio is written to stdout (signed, 16-bit, LE, mono).
@lynn
lynn / ji.py
Created December 26, 2019 03:52
#!/usr/bin/env python
#
# Listen to justly-tuned progressions.
#
# python3.8 ji.py 1+5:4+7:4 1+4:3+5:3 1+5:4+6:4 1+5:4+7:5 3:4+9:8+4:3 1:2+3:4+5:4 | aplay -r44 -f S16_LE
# python3.8 ji.py 1+5:4+3:2 15:16+9:8+3:2 1+5:4+3:2 | ffmpeg -f s16le -ar 44.1k -ac 1 -i - out.mp3
#
import struct
import sys
@lynn
lynn / lynnglish.md
Last active February 21, 2024 11:46
lynn's internet english idiolect

lynn's internet english idiolect

I wanted to write this little document explaining how "the English I use on the Internet" differs from the English you might read in a newspaper.

I should note: these rules apply in a "direct messaging" or "chatroom" kind of scenario, and also on Twitter. Elsewhere, especially in long-form forum-style environments where I have paragraphs and Markdown, I tend to tone it down. I'll still use emoticons and abbreviations, but try to capitalize and punctuate in a standard way. (This seems kind of common when I compare, say, StackExchange posts versus chatrooms: plenty of members capitalize in the former but not the latter.)

capitalization and punctuation

  • Sentences don't start with a capital letter.
  • I almost always capitalize the word I, because I think it looks weird otherwise. I sometimes lowercase it for effect, as sort of a "hushed voice" thing.
// ==UserScript==
// @name annotate twitter usernames
// @namespace https://twitter.com/chordbug
// @version 0.1
// @description annotate twitter usernames
// @author lynn
// @match https://twitter.com/*
// @grant GM_addStyle
// ==/UserScript==
@lynn
lynn / patch-deinflect.py
Last active February 21, 2024 11:47
Inject rules into the rikaichan/rikaikun `deinflect.dat` file
# usage: python patch-deinflect.py
# (reads deinflect.dat in same folder, writes to new-deinflect.dat)
import fileinput
# Bitmask values
CONJ_RU_VERB = 0x0001
CONJ_U_VERB = 0x0002
CONJ_I_ADJ = 0x0004
@lynn
lynn / deinflect.dat
Created May 5, 2019 21:40
rikaikun deinflect file. Put in "%LOCALAPPDATA%\Google\Chrome\User Data\Default\Extensions\jipdnfibhldikgcjhfnomkfpcebammhp\0.9.1_0\data" or similar.
Deinflect Rules 20081220-0509 | by Jonathan Zarate | http://www.polarcloud.com
polite past negative
polite negative
polite volitional
-chau
-sugiru
-nasai
polite past
-tara
-tari
This file has been truncated, but you can view the full file.
100106029 !!WHOLE_CORPUS !!ANY 4124
6187267 the at0 4120
2941444 of prf 4108
2682863 and cjc 4120
2126369 a at0 4113
1812609 in prp 4109
1620850 to to0 4115
1089186 it pnp 4097
998389 is vbz 4097
923948 was vbd 4005
@lynn
lynn / test.ps1
Last active February 21, 2024 11:47
param (
[switch]$windows_update = $false,
[switch]$install_audio = $false,
[switch]$second_stage = $false
)
echo "gotcha: $windows_update $install_audio $second_stage"
number | (() => string) | { (...items: ConcatArray<never>[]): never[]; (...items: ConcatArray<never>[]): never[]; } | ((searchElement: never, fromIndex?: number) => number) | ((searchElement: never, fromIndex?: number) => number) | ((start?: number, end?: number) => never[]) | ((searchElement: never, fromIndex?: number) => boolean) | (() => string) | (() => never[]) | (<U>(callbackfn: (value: never, index: number, array: never[]) => U, thisArg?: any) => U[]) | { <S extends never>(callbackfn: (value: never, index: number, array: never[]) => value is S, thisArg?: any): S[]; (callbackfn: (value: never, index: number, array: never[]) => any, thisArg?: any): never[]; } | ((value: never, start?: number, end?: number) => never[]) | { (start: number, deleteCount?: number): never[]; (start: number, deleteCount: number, ...items: never[]): never[]; } | (() => IterableIterator<never>) | (() => IterableIterator<[number, never]>) | (() => never) | ((...items: never[]) => number) | (() => never) | ((separator?: string) =>
{-# LANGUAGE DataKinds #-}
-- cabal install fin lens
import Data.Char (toLower, isUpper, ord, chr)
import qualified Data.Fin as F
import qualified Data.Type.Nat as N
import Control.Lens
type Nat13 = N.Plus N.Nat4 N.Nat9
type Nat26 = N.Plus Nat13 Nat13