Skip to content

Instantly share code, notes, and snippets.

@Garmelon
Garmelon / Camera.gd
Last active September 23, 2024 20:37
Godot perspecive projection shaders
extends TextureRect
export var sensitivity: Vector3 = Vector3(0.005, 0.005, TAU/4)
var euler: Vector3 = Vector3.ZERO
func _init() -> void:
sensitivity.x *= -1
func _input(event: InputEvent) -> void:
if event.is_action_pressed("ui_cancel"):
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module AddBytes where
import Control.Monad.Trans.State
data Bit = O | I
deriving (Show, Eq, Ord)
type Carry = Bit
@Garmelon
Garmelon / brainfuck.ps
Last active June 9, 2023 09:55
Brainfuck interpreter written in PostScript
% Brainfuck interpreter written in PostScript.
%
% Written in about 2 to 3 hours around midnight. This includes the time spent
% learning PostScript, which is now the first stack-based programming language
% I've actually used. Because of this, the code is pretty ugly (even for
% PostScript), but hey, it manages to correctly interpret the "Hello world"
% example from the Wikipedia page on Brainfuck.
%
% For best results, run via `ghostscript brainfuck.ps`. Enter your brainfuck
% code at the `brainfuck> ` prompt and your program input (if necessary) at the
#!/usr/bin/env python3
# A small script to collect the xkcd countdown frames from munvoseli's
# xkcd-countdown page or from explainxkcd and render them as a video.
# Requires beautifulsoup4 and requests
# Requires ffmpeg to be installed
import argparse
from pathlib import Path
#let proof(
name: none,
line: line(length: 100%),
above,
below,
elem_padding: 1.5em,
line_padding: .3em,
name_padding: .4em,
) = style(styles => {
// Make reassignable
class CursedInt:
def __init__(self, expr):
self.__expr = str(expr)
# "Not exactly like numbers"
# Most other functions depend on this function being available, since
# CursedInt should behave like int in most cases.
def __int__(self):
return eval(self.__expr)