Skip to content

Instantly share code, notes, and snippets.

View lynn's full-sized avatar
🐞

Lynn lynn

🐞
View GitHub Profile
@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); }

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 / gamegenie.py
Created February 22, 2018 20:26
Describe Game Genie codes
#!/usr/bin/env python3
import sys
def describe(code):
"""
Return a written description of what a Game Genie code does.
Args:
code (str): A 6- or 8-letter Game Genie code like 'SXIOPO' or 'PEVXIYGA'.
@lynn
lynn / ger2.tex
Last active February 28, 2018 11:59
Groepen & Ringen huistaak 2
\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[dutch]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{enumerate,microtype,parskip,mathpazo}
@lynn
lynn / smbpatch.py
Created March 9, 2018 17:18
Patching new music into Super Mario Bros.
########################################
# Utility functions
########################################
def cpu_to_rom(addr: int) -> int:
return addr - 0x8000 + 0x10
def rom_to_cpu(addr: int) -> int:
return addr + 0x8000 - 0x10
@lynn
lynn / cakla.rb
Created April 15, 2018 12:20
Cute little IRC bot
require 'socket'
server, port, name, channels = ARGV
bot = Hash.new { |hash, key| -> _ { 'Unknown command: ' + key } }
bot['sum'] = -> args { args.map(&:to_i).reduce(0, :+) }
bot['dice'] = -> args { args.map{|n| rand(n.to_i) + 1}.join(' ') }
bot['emoji'] = -> args { (1..5).map{rand(300) + 0x1f300}.pack('U*') }
TCPSocket.open(server, port) do |irc|
@lynn
lynn / corpus.txt
Last active May 9, 2018 17:11
Jelly corpus
2Ḷṗ4ḣ11Y
⁴r26BḊ€Y
2Bṗ4ṫ6Y
,Z;.ị$⁺€ḟ€"⁾-|Fḟ”+
ẆḊÐfZ€µ⁺€ẎÇÐḟL
9Bṁ×ḶṚÆ¡‘Œ?
ÆFḅÆdÆẸ
⁹ḶH+^ḶBḊ€Y
2*Ḷ^H$
“ḃ»ḟ
@lynn
lynn / lo-nu-se-zdani.txt
Created June 9, 2018 19:15
"lo nu se zdani" in English
"AT HOME"
A short, [???] story.
A) My house is so sturdy! It's got no trouble keeping me safe from the snow.
B) Did you hear about the snowfall in the nearby city?
A) Oh yeah, I heard, yikes. This blizzard is really too strong.
A) But, I tell you, it's no match for my lovely house! Not to mention it's got a fireplace, and there's tea... Ah, please, B, come inside!
B) Wow, sounds like it'll blow my socks off -- I'll gladly come in.
@lynn
lynn / kulni-valsi.md
Last active August 10, 2018 05:28
Lojban words for cultures based on ISO country codes

Lojban words for cultures based on ISO country codes

Many Lojbanists dislike the cultural gismu: merko, fraso, gento, etc. If some cultures get them, and others do not, they’re very direct evidence that Lojban doesn’t treat all cultures the same way, violating one of its own foundational principles (cultural neutrality)!

On the experimental rafsi page, a new system involving the rafsi -goi- is proposed:

-goi- is a proposed special rafsi, modifying the previous rafsi to indicate “cultural rafsi”. This allows rafsi with existing assignments to also be assigned to a culture, giving more space for each major culture to get a rafsi. e.g. -sfegoi- might be able to represent sfe'ero (Swedish), despite -sfe- already being assigned to sefta. In another part of this proposal, existing cultural rafsi will also be reassigned to also use -goi-, so as to be more culturally neutral.

Spheniscine made some suggested reassignmen

@lynn
lynn / tio-syntax-highlighting.user.js
Created October 22, 2018 13:06
TamperMonkey syntax highlighting userscript for https://tio.run/
// ==UserScript==
// @name TIO Syntax Highlighting
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Syntax highlighting for https://tio.run/
// @author Lynn
// @match https://tio.run/
// @require https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.2/codemirror.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.2/mode/haskell/haskell.min.js