Skip to content

Instantly share code, notes, and snippets.

View Demonstrandum's full-sized avatar

Samuel Demonstrandum

View GitHub Profile
@Demonstrandum
Demonstrandum / Iceberg Light.json
Created July 10, 2024 19:08
Iceberg Themes for Zed Editor
{
"id": "iceberg-light-theme",
"$schema": "https://zed.dev/schema/themes/v0.1.0.json",
"name": "Iceberg Light Theme",
"author": "S Knutsen <[email protected]>",
"description": "Un-official port of (Neo)Vim Iceberg theme. Credits for https://github.com/cocopon/iceberg.vim",
"themes": [
{
"name": "Iceberg Light",
"appearance": "light",
@Demonstrandum
Demonstrandum / macros.tex
Last active April 17, 2024 17:38
Basic macros.
\newcommand{\cat}[1]{\mathscr{#1}}
\newcommand{\fcat}[1]{\mathbf{#1}}
\newcommand{\FF}{\mathbb{F}}
\newcommand{\CC}{\mathbb{C}}
\newcommand{\RR}{\mathbb{R}}
\newcommand{\QQ}{\mathbb{Q}}
\newcommand{\ZZ}{\mathbb{Z}}
\newcommand{\NN}{\mathbb{N}}
\newcommand{\II}{\mathbb{I}}
\newcommand{\C}{\cat{C}}
@Demonstrandum
Demonstrandum / vec.py
Created October 4, 2022 19:36
Vector class from Python tuple.
class Vec(tuple):
def __new__(cls, x, y=None, z=None):
if y is None:
return super(Vec, cls).__new__(cls, x)
if z is None:
return super(Vec, cls).__new__(cls, (x, y))
return super(Vec, cls).__new__(cls, (x, y, z))
def dot(self, other):
return sum(x0 * x1 for (x0, x1) in zip(self, other))
def __add__(self, other):
@Demonstrandum
Demonstrandum / raster.py
Last active March 13, 2022 14:11
Rasterisation implementation for primitive shapes.
import numpy as np
class NormalPoint:
"""
Normalised Cartesian coördinates
in the space [-1; 1]×[-1; 1] ⊆ ℝ²
"""
def __init__(self, x, y):
self.x, self.y = x, y
def polar(t):
@Demonstrandum
Demonstrandum / cube.rb
Created June 5, 2021 22:11
Cube in the terminal (old).
WIDTH = `tput cols`.to_i - 1 || 80
HEIGHT = `tput lines`.to_i - 1 || 40
FPS = 60
include Math
class Array
def x; self[0]; end
def y; self[1]; end
def z; self[2]; end
@Demonstrandum
Demonstrandum / door.link.ts
Last active November 17, 2024 14:30
door.link.ts: download mixtapes
@Demonstrandum
Demonstrandum / tacit.py
Created June 3, 2020 20:16
Tacit programming with Currying and Composition in Python.
# # Exaple:
# ```py
# from tacit import *
#
# @fn
# def f(x, y):
# return 2 * (x + y)
#
# @fn
# def g(x): return x + 3
@Demonstrandum
Demonstrandum / simp-deps.svg
Created March 21, 2020 03:14
Simp'O'Matic Dependencies
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Demonstrandum
Demonstrandum / init
Created March 12, 2020 15:33
Sinatra Now Test
init
@Demonstrandum
Demonstrandum / catbread.gif
Last active December 22, 2021 17:52
Bread
catbread.gif