Skip to content

Instantly share code, notes, and snippets.

View dan-german's full-sized avatar
😵‍💫

Dan German dan-german

😵‍💫
View GitHub Profile
@dan-german
dan-german / main.c
Created December 28, 2025 19:14
Visualize matmul with raylib
#include "stdio.h"
#include "raylib.h"
#define max(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; })
#define min(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
#define N 10
#define DIGIT_SIZE 50
#define BRACKET_THICKNESS 4
#define BRACKET_WIDTH 17
#define MAX_MATRIX_SIZE DIGIT_SIZE * N + 2*(BRACKET_THICKNESS+BRACKET_WIDTH)
set expandtab
set tabstop=2
set shiftwidth=2
set relativenumber
set smartcase
set ignorecase
set smartindent
set autoindent
set belloff=all
syntax on
@dan-german
dan-german / waveforms.h
Created February 16, 2021 17:19
cpp waveforms
#include <cmath>
/* https://en.wikipedia.org/wiki/Sawtooth_wave */
template<int length>
std::array<float, length> sawtooth(int harmonics)
{
std::array<float, length> waveform;
float period = length;
float f = 1 / period;