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 / bowser.txt
Last active October 3, 2018 18:10
pictures of bowser and others
Bowser:
https://twitter.com/ayyk92/status/1042465252221181954
https://twitter.com/GurepyonArt/status/1044287471226441729
https://twitter.com/Matilda_Fiship/status/1044311156930818049
https://twitter.com/spacegarbage/status/1044332916929712133
https://twitter.com/Pan_Neji/status/1044212272346918912
https://twitter.com/barachan/status/1044326502228275200
https://twitter.com/iDoodlerz/status/1044302585790959616
https://twitter.com/ZA1F0N/status/1044268102005874689
https://twitter.com/lazymimium/status/1044001136636825601
@porglezomp
porglezomp / passdiff.py
Last active September 7, 2018 13:11
View LLVM optimizer pass diffs, inspired by John Regehr's blog post https://blog.regehr.org/archives/1603
import sys
import subprocess
import tempfile
if len(sys.argv) < 2:
print(f"Usage: {sys.argv[0]} <llvm args...>")
sys.exit(1)
script = sys.argv[1:]
result = subprocess.run(
@porglezomp
porglezomp / About.md
Last active August 30, 2018 02:24
Proving reverse correct with Idris, following the challenge at https://twitter.com/arntzenius/status/1034919539467677696

Proving About reverse in Idris

I saw a challenge on Twitter from @arntzenius, in response to some discussion about the limits of dependent types.

Hey Agda fans! In the spirit of @Hillelogram's verification challenges: How would you prove that reversing an ascending list produces a descending one?

(Also accepting answers in other languages/systems.)

@porglezomp
porglezomp / Turing.idr
Last active August 14, 2018 19:05
A constructive proof that Idris is Turing complete.
%default total
data Direction = L | R
record Machine state halt alphabet where
constructor MkMachine
initial : state
transition : state -> Maybe alphabet -> Maybe (Either halt state, Maybe alphabet, Direction)
data Tape : (a : Type) -> Type where
// ==UserScript==
// @name Animal Crossing Twitter Rating
// @description Display the rating of tweets using the Animal Crossing letter rating system
// @version 1
// @grant none
// @include https://twitter.com/*
// ==/UserScript==
// Notes via https://twitter.com/jamchamb_/status/1025977659522789376
@porglezomp
porglezomp / errorulp.rs
Created July 19, 2018 00:05
Sin/Cos error ULPs
//
// Sin functions
//
const S1: f64 = -0.166666666416265235595; /* -0x15555554cbac77.0p-55 */
const S2: f64 = 0.0083333293858894631756; /* 0x111110896efbb2.0p-59 */
const S3: f64 = -0.000198393348360966317347; /* -0x1a00f9e2cae774.0p-65 */
const S4: f64 = 0.0000027183114939898219064; /* 0x16cd878c3b46a7.0p-71 */
pub fn k_sinf(x: f64) -> f32 {
let z = x * x;

Making the same joke, over and over.

  • lattice minimum/maximum elements
  • function domains
  • secondary headings/titles
  • html subscripts
  • nintendo's newest console
  • nontermination
  • FRC 2018 field elements
  • compiler control flow graph analysis
@porglezomp
porglezomp / AllTicTacToe.idr
Last active May 10, 2018 21:13
Every possible game of Tic Tac Toe! This was a bit hard to prove total…
import Data.Vect
%default total
||| A player in the Tic Tac Toe game
data Move = X | O
implementation Eq Move where
X == X = True
O == O = True
@porglezomp
porglezomp / Leftpad.idr
Last active October 7, 2023 23:25
Taking on Hillel's challenge to formally verify leftpad (https://twitter.com/Hillelogram/status/987432181889994759)
import Data.Vect
-- `minus` is saturating subtraction, so this works like we want it to
eq_max : (n, k : Nat) -> maximum k n = plus (n `minus` k) k
eq_max n Z = rewrite minusZeroRight n in rewrite plusZeroRightNeutral n in Refl
eq_max Z (S _) = Refl
eq_max (S n) (S k) = rewrite sym $ plusSuccRightSucc (n `minus` k) k in rewrite eq_max n k in Refl
-- The type here says "the result is" padded to (maximum k n), and is padding plus the original
leftPad : (x : a) -> (n : Nat) -> (xs : Vect k a)
@porglezomp
porglezomp / Cargo.toml
Created April 5, 2018 17:37
Quickcheck Exploration
[package]
name = "modelqc"
version = "0.1.0"
authors = ["Caleb Jones <code@calebjones.net>"]
[dependencies]
rand = "*"