Skip to content

Instantly share code, notes, and snippets.

View porglezomp's full-sized avatar
💖
GITHUB DROP ICE

Cassie Jones porglezomp

💖
GITHUB DROP ICE
View GitHub Profile
@porglezomp
porglezomp / makefile
Created January 20, 2020 02:25
Convert the "Item Block Heights" video into a summary image
# Convert the "Item Block Heights" video into a summary image
# Video: https://www.youtube.com/watch?v=JteRFzrF6U4
# Image: https://twitter.com/porglezomp/status/1219082110704791555
all: abcheight.png
input.mp4:
youtube-dl -f mp4 'JteRFzrF6U4' -o input.mp4
frames: input.mp4
-- This is a group with a set g, an operation *, and an identity e
record Group g ((*) : g -> g -> g) (e : g) where
constructor MkGroup
-- each of these fields provides a witness of one of the group laws
assoc : (a, b, c : g) -> (a * b) * c = a * (b * c)
ident : (a : g) -> (a * e = a, e * a = a)
inverse : (a : g) -> (b : g ** (a * b = e, b * a = e))
-- Given two groups g1 and g2, with identities e and e', e must be e'
uniquenessOfId : (g1 : Group g o e) -> (g2 : Group g o e') -> e = e'
@porglezomp
porglezomp / rose8.rs
Last active January 11, 2020 07:42
Rust instructions for ROSE-8
// Thanks to Jordan Rose: https://twitter.com/UINT_MIN/status/1215832790958100480
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Op1 {
Zero,
Lsl1,
Lsr1,
Asr1,
Incr,
Decr,
@porglezomp
porglezomp / transforms.md
Last active December 3, 2019 23:03
Lets do some proofs about how transforms should behave
@porglezomp
porglezomp / README.md
Last active March 3, 2022 09:26
Creating a Rust hello world in 0x a presses.

This is a Rust "Hello World" program in 0x A presses.

$ vim hello.rs
$ rustc --test hello.rs
$ ./hello --quiet
Hello, World!

If you don't know, [the A Button Challenge] is a Mario 64 speedrun category in which runners attempt to use the A button (the jump button!) as few times as possible. Make sure you watch the classic [Watch for Rolling Rocks - 0.5x A Presses][A Button Challenge] video linked above in order to understand.

@porglezomp
porglezomp / chopper.sh
Last active October 2, 2019 21:16
A tool to chop GIFs into 25 discord emoji.
#!/bin/bash
input=$1
output=$2
prefix=$3
if [ -z "$input" -o -z "$output" ]; then
echo "Usage: $0 <input> <output> [prefix]"
exit 1
fi
@porglezomp
porglezomp / Makefile
Created September 23, 2019 04:52
Multiple return types
all: union exn variant
%: %.cpp
clang++ -Wall -Wextra -Werror -std=c++17 -O3 $< -o $@
clean:
rm -f union exn variant
@porglezomp
porglezomp / FloatShiftBlend.swift
Created August 8, 2019 20:23
What does Int << Float mean? :3
extension Int {
subscript(bit bit: Int) -> Int {
guard (0..<Int.bitWidth).contains(bit) else { return 0 }
return (self >> bit) & 1
}
subscript(bit bit: Float) -> Float {
var whole = bit
whole.round(.down)
let fract = bit - whole
return Float(self[bit: Int(whole)]) * (1 - fract)
@porglezomp
porglezomp / Denotation.swift
Created June 7, 2019 23:49
Swift has MixFix operators, right?
// Colin Barrett - @cbarrett
// turning a big dial taht says "Mixfix operators like Agda" on it
// and constantly looking back at the audience for approval
// like a contestant on the price is right
// https://twitter.com/cbarrett/status/1137113289593413633
// Here define a mixfix interpreter operator spelled: _ ⊢ ⟦_⟧
prefix operator
postfix operator
@porglezomp
porglezomp / CompareChain.swift
Created June 7, 2019 20:45
Let's do horrible crimes with overloads, in order to get Python-style comparison chaining!
infix operator <: ChainComparison
infix operator >: ChainComparison
infix operator ==: ChainComparison
infix operator !=: ChainComparison
infix operator <=: ChainComparison
infix operator >=: ChainComparison
precedencegroup ChainComparison {
associativity: left
}