Skip to content

Instantly share code, notes, and snippets.

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)
#let proof(
name: none,
line: line(length: 100%),
above,
below,
elem_padding: 1.5em,
line_padding: .3em,
name_padding: .4em,
) = style(styles => {
// Make reassignable
#!/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
@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
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module AddBytes where
import Control.Monad.Trans.State
data Bit = O | I
deriving (Show, Eq, Ord)
type Carry = Bit
@Garmelon
Garmelon / Camera.gd
Last active October 24, 2022 12:15
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"):
@Garmelon
Garmelon / WegaBorad.hs
Created January 9, 2020 23:35
Ouija board bot
{-# LANGUAGE OverloadedStrings #-}
module Haboli.Euphoria.WegaBorad where
import Control.Monad
import Control.Monad.Trans.Class
import Control.Monad.Trans.State
import Data.Char
import Data.Foldable
import Data.List
@Garmelon
Garmelon / bunny_fourier_coefficients
Last active September 20, 2019 23:01
Fourier coefficients of a bunny's outline. c(0) was omitted because it isn't really useful in this case.
Calculate bunny like so:
f(t) = \sum_{n=1}^{\infty} \left( c(n) e^{i n t} + c(-n) e^{- i n t} \right)
{n, c(n), c(-n)}
{1, 85.2475 - 169.755 I, 28.0975 - 9.90891 I}
{2, 6.29048 - 2.67816 I, -0.746606 + 22.7351 I}
{3, -26.7847 - 11.3627 I, -6.43327 - 2.05265 I}
{4, 4.23445 + 7.35356 I, 10.1179 + 4.58626 I}
{5, -6.41438 - 7.65797 I, -6.39548 - 11.585 I}
{6, -7.0104 - 0.501367 I, -3.28289 - 4.8017 I}
extends Camera
"""
Space/Enter - capture cursor
Escape - free cursor
WASDQE - move
Shift - fast movement
Ctrl - slow movement
"""
#!/usr/bin/env python3
import argparse
import re
import subprocess
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"output_file",