View uxn_animation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image, ImageDraw | |
sprite_data = bytes.fromhex(''' | |
00 00 3c 06 1c 06 3c 00 00 7f c3 f9 e3 f9 c3 ff | |
00 00 68 2c 78 2c 34 00 00 fe ff ff ff ff ff ff | |
00 01 19 07 0f 1f 07 0f ff ff e7 fb fd fe ff ff | |
00 80 f0 e0 c0 f0 f8 f8 ff ff ff ff ff ff 7f 7f | |
0f 0e 0c 00 80 ff ff 7f ff ff ff ff 7f 00 00 00 | |
e8 e0 e0 60 01 ff ff fe 7f ff ff ff fe 00 00 00 | |
''') |
View cassini.lean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import data.nat.fib | |
import data.matrix.basic | |
import data.matrix.notation | |
import linear_algebra.matrix.determinant | |
theorem matrix.map_pow {m α β : Type*} [fintype m] [decidable_eq m] [semiring α] | |
{M : matrix m m α} {n : ℕ} [semiring β] {f : α →+* β} : | |
(M ^ n).map ⇑f = (M.map ⇑f) ^ n := | |
begin | |
induction n, |
View accord.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Discord bot for playing ABC notation music. | |
# | |
# ### Installation | |
# - Get the dependencies: abc2midi, timidity, ffmpeg, and lame. | |
# - `pip install discord.py` | |
# - `ACCORD_TOKEN=(your bot token) python3 accord.py` | |
# | |
# ### Usage | |
# In any channel where the bot is, say: $play (abc notation) | |
# The input may be multiple lines long, and may be in a ```code block```. |
View PrettyParseError.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module PrettyParseError ( | |
prettyParseError, | |
PrettyParseErrorOptions(PrettyParseErrorOptions), | |
prettyParseErrorDefaults | |
) where | |
import Data.List (intercalate, nub) | |
import Text.Parsec | |
import Text.Parsec.Error | |
import Text.Parsec.Pos |
View frac.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
View now-i-am-an-arsonist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
# |
View ji.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
NewerOlder