Skip to content

Instantly share code, notes, and snippets.

View m1lkweed's full-sized avatar

m1lkweed

View GitHub Profile
@BlobTheKat
BlobTheKat / a.h
Last active March 10, 2026 11:21
a.h - C11 Atomics & threads complement library
/**
* Atomics & threads complement library
* Matthew Reiner, 2026
* Available under the GPL 3.0 license
* Targeting: Windows, Linux, *BSD, MacOS
* Implements the following:
* - Wait/Notify functionality for simple types up to 64 bit
* - Arbitrary condition wait
* - Thread management
* - Relax, yield & sleep
@citizen428
citizen428 / Makefile
Created February 26, 2026 18:10
C preprocessor abuse
CC ?= clang
CFLAGS = -std=c23 -Wall -Werror
run: clean abuse
@./abuse
abuse:
@$(CC) $(CFLAGS) -I. -o abuse abuse.c
clean:
@s1as3r
s1as3r / bezier.c
Last active January 22, 2026 09:07
cubic bezier curves thingy in raylib
// clang-format off
// cubic bezier curves thingy in raylib
// gcc -Og -std=c11 -o bezier ./bezier.c -lraylib -lm -lpthread -ldl -lX11 -lGL -lrt
#include <stdbool.h>
#include <stdint.h>
#include <raylib.h>
// clang-format on
#define global static
@dlOuOlb
dlOuOlb / main.c
Last active January 22, 2026 06:58
An example of C23 function properties: effectless, idempotent, independent, and stateless.
#if !__STDC__ || __STDC_VERSION__ < +202311L
# error "This code is written in standard C23."
#else
static bool ψ = true;
static bool non_independent( void ) { return ψ; }
static void non_effectless( register const bool ζ ) { ψ = ζ; return; }
static bool non_stateless( register const bool ζ ) { static bool φ = true; return φ = φ && ζ; }
static void non_idempotent( register bool ξ[ const restrict static sizeof "" ] ) { *ξ = !*ξ; return; }
/**
* ISAAC CSPRNG High-Performance Implementation v2.0.0
*
* Based on Bob Jenkins' ISAAC algorithm (1993) - Public Domain
*
* Version: 2.0.0 - H.Overman <opsec.ee@pm.me>
* Date: 2025-01-13
* License: Public Domain (following original ISAAC license)
*/
@mattiasgustavsson
mattiasgustavsson / bass_and_treble.h
Created January 30, 2025 13:06
Audio filters for a stereo widening effect and for simple bass/treble eq
/*
------------------------------------------------------------------------------
Licensing information can be found at the end of the file.
------------------------------------------------------------------------------
bass_and_treble.h - v1.0 - Simple audio filter to boost bass and treble.
Do this:
#define BASS_AND_TREBLE_IMPLEMENTATION
before you include this file in *one* C/C++ file to create the implementation.
@namandixit
namandixit / std.h
Last active January 23, 2026 02:33
Personal C Standard Library
/*
* Creator: Naman Dixit
* Notice: © Copyright 2024 Naman Dixit
* License: BSD Zero Clause License
* SPDX: 0BSD (https://spdx.org/licenses/0BSD.html)
*/
#if !defined(STD_H_INCLUDE_GUARD)
/* Compiler **************************************************************************/
bl_info = {"name": "Zoetrope", "category": "Animation"}
import bpy
class Zoetrope(bpy.types.Operator):
bl_idname = "anim.zoetrope"
bl_label = "Zoetrope"
def execute(self, context):
@mmozeiko
mmozeiko / MagicRingBuffer.h
Last active March 10, 2026 11:21
Magic RingBuffer for Windows, Linux and macOS
#pragma once
//
// Magic Ring Buffer
// https://gist.github.com/mmozeiko/3b09a340f3c53e5eaed699a1aea95250
//
// Sets up memory mapping so the same memory block follows itself in virtual address space:
//
// [abcd...xyz][abc...xyz]
//
@emu-san
emu-san / rgb2vga.c
Created June 13, 2023 17:22
Converts RGB values to VGA 256
/* rgb2vga.c - converts rgb values to vga 256. */
/* Copyright (c) 2023 Al-buharie Amjari */
/* Released under MIT License */
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#define F(x) ((float)x)