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 / homestuck.dot
Last active March 19, 2019 05:28
Homestuck shipping diagram
// neato -Tpng homestuck.dot > homestuck.png
digraph Shipping {
rankdir=LR;
sep="0.5";
overlap=scalexy;
//splines=true;
layout=neato;
subgraph {
edge [dir=none];
Rose -> Kanaya [label="♥"];
import Data.Fin
%language TypeProviders
%dynamic "./time.so"
%default total
epoch_seconds : IO Int
epoch_seconds = foreign FFI_C "epoch_seconds" (IO Int)
getTime : IO (Provider Int)
@porglezomp
porglezomp / meta.lua
Created February 2, 2019 21:29
Metatable on Metatables
local x = { value = 42 }
local index = {
__index = function(t, k)
print(k)
if k == "__add" then
return function(l, r)
return { value = l.value + r.value }
end
end
end
CODED = [
[12, 24, 15, 12, 3, 6, 24, 23, 2, 26, 22, 24, 6, 19, 21, 6, 4, 24, 1, 2, 10, 6, 24, 26, 22, 6, 2, 11, 24, 10, 13, 2, 9, 6, 4],
[4, 8, 15, 6, 19, 12, 18, 24, 2, 1, 1, 24, 16, 6, 24, 26, 22, 6, 24, 4, 22, 12, 0, 6, 24, 26, 22, 6, 18, 24, 23, 12, 13, 26, 24, 15, 6, 24, 26, 8, 24, 16, 6],
[16, 20, 26, 24, 2, 24, 19, 8, 13, 26, 24, 10, 13, 8, 23, 24, 22, 8, 23, 24, 15, 20, 25, 22, 24, 15, 8, 11, 6, 24, 26, 22, 6, 18, 1, 1, 24, 23, 12, 10, 6, 24, 12, 23, 12, 18, 24, 16, 6, 5, 8, 11, 6, 24, 26, 22, 6, 18, 11, 6, 24, 4, 12, 26, 2, 4, 5, 2, 6, 19],
[26, 22, 6, 18, 24, 22, 12, 9, 6, 24, 4, 1, 2, 25, 6, 19, 24, 12, 23, 12, 18, 24, 15, 18, 24, 5, 1, 6, 4, 22],
[4, 22, 8, 11, 13, 24, 8, 5, 24, 20, 13, 4, 2, 21, 22, 26, 1, 18, 24, 1, 2, 15, 16, 4, 24, 12, 13, 19, 24, 8, 11, 21, 12, 13, 4],
[15, 8, 11, 6, 24, 4, 26, 2, 26, 25, 22, 24, 12, 13, 19, 24, 4, 25, 12, 11, 24, 26, 22, 12, 13, 24, 22, 20, 15, 12, 13],
[2, 5, 24, 8, 13, 1, 18, 24, 15, 12, 11, 16, 1, 6],
[21, 11, 6, 23, 24, 16
@porglezomp
porglezomp / 00 add baseline
Created December 14, 2018 02:42
Eggman Scheme Bytecode Examples
function (+ a b) entry=bb0
bb0:
v0 = lookup 'assert
v1 = typeof v0
v2 = Binop.SYM_EQ v1 'function
brn v2 non_function
v3 = arity v0
v4 = Binop.NUM_EQ v3 1
brn v4 wrong_arity
v5 = lookup 'number?
@porglezomp
porglezomp / about.md
Created November 16, 2018 04:03
Allocator

An Allocator

This is a working memory allocator for C++! It was written as test code for an operating systems class project, we were implementing a virtual memroy system, and so I built an allocator on top of that. To work, it needs access to a vm_map call which will return a fresh 4KB page, and it needs to return consecutive addresses for consecutive calls (at least most of the time, or else we can't allocate large blocks).

It is based on a linear search through a free list, with a best-fit allocation scheme.

@porglezomp
porglezomp / SketchSystems.spec
Last active November 4, 2018 19:04
# Memory Eviction
# Memory Eviction
Start*
swap page -> NoRW
file page -> NoRW
NoRW
read -> Read
write -> ReadWrite
queue -> Start
@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 / Extrap.cs
Last active August 31, 2018 01:56
Provides some of Unity's interpolation methods without clamping to [0, 1]
using UnityEngine;
using System.Collections;
public class Extrap {
public static Quaternion Slerp(Quaternion q1, Quaternion q2, float t)
{
float angle;
Vector3 axis;