Skip to content

Instantly share code, notes, and snippets.

🔮
hella cute

Lynn lynn

🔮
hella cute
Block or report user

Report or block lynn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lynn
lynn / frac.rs
Last active Mar 19, 2020
A bitwise-magic fractional part function
View frac.rs
/// A "fractional part" function on f32s that does bitwise magic
/// on the representation of its argument.
pub fn frac(f: f32) -> f32 {
f32::from_bits(_frac(f.to_bits()))
}
/// A "fractional part" function that operates on a signed integer
/// representation of an IEEE single-precision floating point number.
fn _frac(i: u32) -> u32 {
// A floating point number consists of a sign bit,
View mod1.c
#include <stdint.h>
#include <stdio.h>
typedef float f32;
typedef int32_t i32;
f32 mod1(f32 f) {
i32 i = *(i32*)&f;
i32 e = (i >> 23) & 0xff;
i32 m = i & 0x7fffff;
@lynn
lynn / now-i-am-an-arsonist
Last active Feb 23, 2020
"Now I Am An Arsonist" by Jonathan Coulton (feat. Suzanne Vega) chords for soprano ukulele
View now-i-am-an-arsonist
"Now I Am An Arsonist"
by Jonathan Coulton (feat. Suzanne Vega)
chords for soprano ukulele
Capo on 1st fret, or tune up a semitone to G# C# E# A#.
────────────────────────────────────────────────────────
Pattern 1 (C lydian)
A│––––––––––––––––│
View simplewords_tokipona.py
# To use this, you need Python 3.5+ and pip.
#
# 1. Make a new Discord app with a bot. https://discordapp.com/developers/applications/
#
# 2. Set environment variable SIMPLEWORDS_TOKEN on your computer to the bot's Token.
# Unix/Mac: export SIMPLEWORDS_TOKEN=MzABCDefghIJKLmnopQRSTuv.EnZ3kg.b5bdD74CKCr3du679hkemGJ7R7N
# PowerShell: $env:SIMPLEWORDS_TOKEN='MzABCDefghIJKLmnopQRSTuv.EnZ3kg.b5bdD74CKCr3du679hkemGJ7R7N'
#
# 3. Invite the bot to your server: https://stackoverflow.com/a/37743722/257418
#
@lynn
lynn / ji.py
Last active Feb 5, 2020
play just-intonation chord progressions in your terminal
View ji.py
#!/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).
View ji.py
#!/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 Jul 29, 2019
lynn's internet english idiolect
View lynnglish.md

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.
View annotate-twitter-usernames.user.js
// ==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 May 5, 2019
Inject rules into the rikaichan/rikaikun `deinflect.dat` file
View patch-deinflect.py
# 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
rikaikun deinflect file. Put in "%LOCALAPPDATA%\Google\Chrome\User Data\Default\Extensions\jipdnfibhldikgcjhfnomkfpcebammhp\0.9.1_0\data" or similar.
View deinflect.dat
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
You can’t perform that action at this time.