Skip to content

Instantly share code, notes, and snippets.

@qexat
qexat / TSM.ml
Last active August 12, 2026 11:08
if it typechecks, it runs
(* typed stack machine! *)
let ( <*> ) f g x = f (g x)
type 'a ty =
| Bool : bool ty
| Int : int ty
| String : string ty
type 'a value =
@qexat
qexat / README.md
Last active August 11, 2026 13:20
software I use

software I use

note: this is a living document.

this gist contains essential.txt, a (probably not exhaustive) list of software that I consider essential in the sense that I will not choose a linux distribution / operating system if its package repositories does not include all of these.

arch linux is an exception because of the existence of the AUR, however I would like to not use that repository at all.

this gist also contains extra.txt, a list of software that I can give up on, although it would make me very sad, and you don't want to make me sad do you :(

@qexat
qexat / tutorial.txt
Created March 27, 2026 20:07
how to make ascii art (twitch edition)
HOW TO MAKE ASCII ART (TWITCH EDITION)
================================================================
1. Save the image you want to transform into ASCII
2. Go to https://lachlanarthur.github.io/Braille-ASCII-Art/
3. Set width to 24 characters and Invert on
4. Copy the result
5. Replace newlines by spaces
================================================================
@qexat
qexat / Qe.ml
Created January 31, 2026 02:26
quickedit - a small, REPL-oriented DSL for quick string edition
let ( let*? ) = Option.bind
let ( let|? ) opt fn =
match opt with
| None -> fn ()
| Some value -> opt
let ( let@ ) = ( @@ )
let array_of_string s = Array.of_seq (String.to_seq s)
@qexat
qexat / runtime_size_error.ml
Created January 20, 2026 09:38
they differ by their runtime size :0
(* boilerplate *)
module type T = sig
type t
end
module type INT = module type of Int
(* the goofy type *)
type 'a t = What of < value : 'a; ty : 'c > constraint 'c = (module T with type t = 'a)
@qexat
qexat / list.py
Last active December 25, 2025 16:11
functional programmers when they are forced to use python (they are crying and seething)
# ruff: noqa: D100, D103, A001, A002
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from collections.abc import Callable
type List[T] = tuple[()] | tuple[T, List[T]]
@qexat
qexat / SGR_stack_machine_poc.ml
Created December 11, 2025 14:56
proof of concept for a basic SGR stack machine
(* SGR stack machine *)
module Color = struct
type t =
| Basic of int
| Rgb of int * int * int
end
module Style = struct
type t =
@qexat
qexat / symbols.txt
Last active December 10, 2025 20:12
A
ABC
ABCMeta
ACCESS_COPY
ACCESS_DEFAULT
ACCESS_READ
ACCESS_WRITE
ACK
ACTIVE
ADDITEMS
@qexat
qexat / Nilable.ml
Last active November 14, 2025 21:21
this is the future jane street wants. #NoToNil #protest #Option4Ever #foryou #foryoupage
type nil = Nil
(* This version is unsafe because it makes the assumption that index >= 0. *)
let rec get_unsafe : 'a. at:int -> from:'a list -> 'a | nil =
fun ~at:index ~from:list ->
match list with
| [] -> Nil
| first :: _ when index = 0 -> first
| _ :: rest -> get_unsafe ~at:(index - 1) ~from:rest
(* -*- Interfaces -*- *)
module type ORDERED = sig
type ('a, 'b) t
end
module type LINEAR = sig
include ORDERED
val exchange : 'a 'b. ('a, 'b) t -> ('b, 'a) t