Skip to content

Instantly share code, notes, and snippets.

View damienstanton's full-sized avatar

Damien Stanton damienstanton

View GitHub Profile
@damienstanton
damienstanton / cloth.gd
Created June 25, 2026 10:07
Cloth Simulation
extends Node2D
"""
c/o @martijnfolmer.bsky.social
source: https://github.com/martijnfolmer/Folmer_godot_samples
Small sample of what it looks like to simulate lines and cloth using verlet integration,
using 2 classes located in scripts/classes/class_verlet_cloth and /class_verlet_line.
Note that if you want to make it interact with the rest of the game, you would need
@damienstanton
damienstanton / gcd_alt.rs
Last active June 24, 2026 15:19
GCD useful for RSA & Quantum (CSCA 5454)
fn gcd1(mut m: i32, mut n: i32) -> i32 {
let mut t = 0;
while n != 0 {
t = n;
n = m % n;
m = t;
}
m
}
structure Box α where
val: α
namespace Box
def extract (b : Box α) := b.val
end Box
def a := Box.mk 42
@damienstanton
damienstanton / thorsten_tt.lagda.md
Last active May 1, 2025 23:33
thorsten TT course notes

Type theory (Thorsten Altenkirch)

Functions

Unlike in set theory, functions in type theory are by definition computable.

open import Data.Nat

f :
@damienstanton
damienstanton / .zshrc
Last active July 16, 2026 09:22
ZSH Profile 2026
# ╔════╗
# ║ DS ║
# ╚════╝
# version: 2025.07
# section: config
eval "$(/opt/homebrew/bin/brew shellenv)"
COMPLETION_WAITING_DOTS="true"
KEYTIMEOUT=1
plugins=(git
@damienstanton
damienstanton / virtual_threads.clj
Created June 20, 2023 12:38 — forked from mikeananev/virtual_threads.clj
Java 19 virtual threads and Clojure
(ns user
(:import (java.util.concurrent Executors)))
;; Thread factory for virtual threads
(defn thread-factory [name]
(-> (Thread/ofVirtual)
(.name name 0)
(.factory)))
;; Define an executor which just produce a new virtual thread for every task
@damienstanton
damienstanton / typed.go
Created February 24, 2023 23:45
Typed DSL in Go (Aram Hăvărneanu)
// This file implements a deep embedding of a typed-DSL in Go. The
// representation is type-safe (we cannot construct ill-typed terms)
// and accepts multiple interpretations. The type system of the target
// language is identity-mapped to the Go type system such that type
// checking of the DSL is hoisted up to type-checking the Go code that
// contains the target language expression.
//
// Normally this requires either GADTs or higher-rank types. I show
// that it is possible to encode it in Go, a language which doesn't
// have GADTs (nor regular ADTs for that matter), nor higher-rank
@damienstanton
damienstanton / coc-settings.json
Last active March 7, 2025 21:12
dot2 exports
{
"diagnostic.virtualText": true,
"diagnostic.errorSign": "💣",
"diagnostic.warningSign": "🚧 ",
"diagnostic.infoSign": "📘 ",
"diagnostic.hintSign": "🔎 ",
"python.linting.mypyEnabled": true,
"haskell.liquidOn": true,
"languageserver": {
"go": {
@damienstanton
damienstanton / lambda.log
Last active April 27, 2022 13:55
Lambda as JS by Glen Lebec (test outputs)
I := λx.x
✅ I tweet = tweet
✅ I chirp = chirp
✅ I I = I
Idiot := I
Mockingbird := M := ω := λf.ff
@damienstanton
damienstanton / dependent_types.md
Last active December 6, 2022 23:37
Dependent Types
// Either is an example of a sum type.
enum Either<Left, Right>
{
    Ok(Right),
    Err(Left)
}

// Point is an example of a product type.
type Point = (i64, i64, String);