Skip to content

Instantly share code, notes, and snippets.

@mrange
mrange / main.c
Last active February 24, 2026 12:50
Obfuscated C experiment: Nothing special
#define _GNU_SOURCE
#include<math.h>
#include<sys/ioctl.h>
#define V for(n=0;n<3;++n)
#define F c+=sprintf(b+c,
//////////////////////////////////////
// "Nothing Special"-Posix version ///
// by mrange 2026-02-22 ////
// // //
// Compile and run with: // //
@mrange
mrange / Program.cs
Created February 21, 2026 11:51
Spectre Playground Effect
// "Nothing Special" shader by Mårten Rånge
var terminal = new BrowserTerminal(
AnsiConsole.Console,
AnsiConsole.Profile.Width,
AnsiConsole.Profile.Height);
var renderer = new Renderer(terminal);
var writer = AnsiConsole.Profile.Out.Writer;
writer.Write("\x1b[?25l"); // Hide cursor
@mrange
mrange / main.cpp
Created January 27, 2026 11:16
pimpl
#include "pimpl.h"
int main() {
auto x = new pimpl();
x->the_method();
delete x;
return 0;
}
@mrange
mrange / units.fs
Last active October 7, 2025 19:56
F# measures
open LanguagePrimitives
// Units of measure are *compile-time* type tags on numeric types
// They prevent mixing incompatible dimensions (meters vs seconds) and have *no runtime cost*.
type [<Measure>] m // meter (length)
type [<Measure>] kg // kilogram (mass)
type [<Measure>] s // second (time)
type [<Measure>] A // ampere (electric current)
type [<Measure>] K // kelvin (thermodynamic temperature)
type [<Measure>] mol // mole (amount of substance)
type [<Measure>] cd // candela (luminous intensity)
@mrange
mrange / shadertoy.glsl
Last active September 3, 2025 18:27
Grid glow tracer
// CC0: Grid glow tracer
// Shadertoy compatible
float fbm_noise(vec3 P) {
float
a=.6
, d=0.
, k=0.
;
for(P*=.2;++k<4.;P=P.yzx) {
// Used Dot noise by XorDev as an example.
@mrange
mrange / FuleSnabel.glsl
Created August 18, 2025 20:04
FieldFX 2025-08-18
// -----------------------------------------------------------------------------
#version 430 core
// -----------------------------------------------------------------------------
uniform float fGlobalTime; // in seconds
uniform vec2 v2Resolution; // viewport resolution (in pixels)
uniform float fFrameTime; // duration of the last frame, in seconds
uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq
uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients
@mrange
mrange / FuleSnabel.glsl
Created August 4, 2025 20:13
Field-FX 2025-08-04
// -----------------------------------------------------------------------------
#version 430 core
// -----------------------------------------------------------------------------
uniform float fGlobalTime; // in seconds
uniform vec2 v2Resolution; // viewport resolution (in pixels)
uniform float fFrameTime; // duration of the last frame, in seconds
uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq
uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients
@mrange
mrange / FuleSnabel.glsl
Last active July 29, 2025 05:33
Field-FX 2025-07-28
// 2025-07-28 - DJ alkama - 126 BPM
// https://scenesat.com/videoarchive/FYBKI5?bs5#show-FYBKI5
// -----------------------------------------------------------------------------
#version 430 core
// -----------------------------------------------------------------------------
uniform float fGlobalTime; // in seconds
uniform vec2 v2Resolution; // viewport resolution (in pixels)
uniform float fFrameTime; // duration of the last frame, in seconds
@mrange
mrange / 0_main.glsl
Last active October 6, 2025 17:15
Bonzomatic Prelude
// -----------------------------------------------------------------------------
#version 430 core
// -----------------------------------------------------------------------------
uniform float fGlobalTime; // in seconds
uniform vec2 v2Resolution; // viewport resolution (in pixels)
uniform float fFrameTime; // duration of the last frame, in seconds
uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq
uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients
@mrange
mrange / program.cs
Last active March 15, 2025 14:06
Spectre
// This software is released into the public domain under the CC0 1.0 Universal license.
//
// You can copy, modify, distribute, and use it for any purpose, without any conditions,
// unless required by law.
//
// To the extent possible under law, the author(s) disclaim all copyright and related
// or neighboring rights to this work.
//
// See: https://creativecommons.org/publicdomain/zero/1.0/