Skip to content

Instantly share code, notes, and snippets.

@snowclipsed
snowclipsed / CyberpunkLorenz.tsx
Last active January 2, 2025 06:40
3D Lorenz System Simulation rendered using ASCII/UTF-8 in React
import React, { useState, useEffect, useCallback, useRef } from 'react';
/**
* Represents a point in 3D space within the Lorenz system.
*/
interface Point {
x: number;
y: number;
z: number;
}
@snowclipsed
snowclipsed / CyberpunkPerlin.tsx
Created December 31, 2024 22:20
Perlin Noise and Terrain Generation using ASCII/UTF-8
import React, { useState, useEffect, useCallback, useRef } from 'react';
type ColoredChar = {
char: string;
color: string;
};
const defaultConfig = {
scale: 0.05,
@snowclipsed
snowclipsed / resize.zig
Created November 20, 2024 16:24
Resize Kernel using Bicubic Interpolation
const std = @import("std");
const c = @cImport({
@cInclude("stb_image.h");
});
fn cubic(x: f32) f32 {
const a = -0.5;
const abs_x = @abs(x);
if (abs_x <= 1.0) {
return (a + 2.0) * abs_x * abs_x * abs_x - (a + 3.0) * abs_x * abs_x + 1.0;
@snowclipsed
snowclipsed / matmul_FP32.zig
Last active October 28, 2024 18:43
Fast Matrix Multiplication in ZIG in FP32.
const std = @import("std");
// Can also try:
// 8 x 64
// 16 x 64
// Top GFLOPs/s on an Intel® Core™ i7-13620H Processor = 300.9 GFLOPs/s
// Comments were added using Claude.
// To run simply run zig build-exe -O ReleaseFast matmul_FP32.zig, then run the binary ./matmul_FP32
// To test simply run zig test -O ReleaseFast matmul_FP32.zig
// To test performance on a generated binary, run : sudo perf stat -e cache-misses,cache-references,instructions,cycles ./matmul_FP32