Skip to content

Instantly share code, notes, and snippets.

View m1lkweed's full-sized avatar

m1lkweed

View GitHub Profile
@Eczbek
Eczbek / as.hpp
Last active July 15, 2026 14:34
as
struct as{template<class T>operator T(){throw;};template<class T>struct x{T x;template<class U>constexpr decltype(static_cast<U>((T)x))operator->*(U(as::*)())noexcept(noexcept(static_cast<U>((T)x))){return static_cast<U>((T)x);}};template<class T>friend constexpr x<T&&>operator->*(T&&x,as)noexcept{return{(T&&)x};}};
#define as ->*::as()->*&::as::operator
@BlobTheKat
BlobTheKat / a.h
Last active July 20, 2026 11:36
a.h - C11 Atomics & threads complement library
/**
* Atomics & threads complement library
* Matthew Reiner, 2026
* Available under the GPL 3.0 license
* Targeting: Windows, Linux, FreeBSD, NetBSD, OpenBSD, MacOS
* Implements the following:
* - Wait/Notify functionality for simple types up to 64 bit
* - Arbitrary condition wait
* - Fine-grained memory ordering
* - Thread management
@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 v4.0 — Full Architecture Rewrite
* License: Public Domain (following original ISAAC license)
*
* Euman = integral(optimization/time) delta performance
*
* Based on Bob Jenkins' ISAAC (1993) — Public Domain algorithm.
* This implementation: Proprietary optimizations, C23, Euman IFP.
*
* =======================================================================
@BorisTestov
BorisTestov / he_utils.h
Last active April 5, 2026 22:20
Hall Effect Utilities for QMK Keychron Keyboards
#pragma once
/*
* Hall Effect Utilities for QMK
*
* DISCLAIMER:
* This code was written by Boris Testov for personal use on K6 HE keyboard.
* You are free to use, modify, and distribute this code for any purpose, including
* commercial use. However, this code is provided "AS IS" without any warranty of
* any kind, express or implied. The author makes no guarantees about its
@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 July 5, 2026 04:37
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):