View filey.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
use std::{ | |
io::{self, Read, Seek, SeekFrom, Write}, | |
fs::File, | |
}; | |
use pyo3::{ | |
prelude::{Python, PyObject}, | |
}; | |
pub enum Filey { |
View plot_petra.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
use std::{ | |
env, | |
error::Error, | |
fs::File, | |
process::ExitCode, | |
}; | |
use plotters::prelude::*; | |
use petra_grid::{Grid, GridData}; |
View petra_grid.map
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
load petra_grid; | |
%% | |
%entry | |
%name header | |
%type Header | |
%offset 0x0#B | |
%entry |
View pop_char.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
#[inline] | |
fn pop_char(s: &str) -> Option<(char, &str)> { | |
let mut chars = s.chars(); | |
chars.next().map(|c| (c, chars.as_str())) | |
} |
View ziptree.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
# Language path: Haskell->Ocaml->Python, mypy typesystem [semantic loss ~31%] | |
# Subject: Zippers as the key insight | |
# what great fun! since mypy ~0.991 (?) we can finally, finally work with | |
# recursive types. this opens up Python to some traditional functional | |
# programming practices with a minimum of bullshit. | |
from typing import NamedTuple, TypeAlias | |
# let's walk amongst the trees for a bit. |
View queue.awk
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
function push(q, val) { | |
if (empty(q)) { | |
q["head"] = 0 | |
q["tail"] = 0 | |
q[0] = val | |
} else { | |
q[q["tail"] + 1] = val | |
q["tail"] = q["tail"] + 1 | |
} | |
} |
View good.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
{-# LANGUAGE DataKinds, GADTs, KindSignatures, TypeOperators #-} | |
{-# LANGUAGE TypeFamilies #-} | |
module Data.HList | |
( HList(..) | |
, TypeMap | |
) where | |
import Data.Kind (Type) | |
import Data.Maybe (fromJust, fromMaybe) |
View base26.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
base26 :: Integer -> String | |
base26 n = | |
let (m, n') = n `divMod` 26 | |
ones = [toEnum (fromEnum 'A' + fromInteger n')] | |
in case m of | |
0 -> ones | |
m -> base26 (m - 1) ++ ones |
View rev_ll.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 <stdio.h> | |
#include <stddef.h> | |
#include <stdlib.h> | |
typedef struct node { | |
int value; | |
struct node *next; | |
} node, *list; | |
void list_free(list l) |
View cpu.pony
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
use "collections" | |
interface Sendable | |
fun tag send(word: I64) | |
primitive Running | |
primitive Blocked | |
primitive Halted | |
primitive IllegalInstruction |
NewerOlder