Skip to content

Instantly share code, notes, and snippets.

View m1lkweed's full-sized avatar

m1lkweed

View GitHub Profile
@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; }
@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):
@harieamjari
harieamjari / 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)
@imaami
imaami / typeof_unqual.c
Created April 15, 2023 13:17
Backport of C23's typeof_unqual in plain C18
#define typeof_unqual(x) __typeof__(((void)1, *(__typeof__(x) *)(void *)0))
int main(void) {
const int ci = 1;
typeof_unqual(ci) i1 = ci;
typeof_unqual(const int) i2 = ci;
i1 = 0;
i2 = 0;
return i1 + i2;
}
@den-mentiei
den-mentiei / debounce.c
Created July 18, 2022 13:08
Digital input signal debouncing by Kenneth A. Kuhn
/******************************************************************************
debounce.c
written by Kenneth A. Kuhn
version 1.00
This is an algorithm that debounces or removes random or spurious
transistions of a digital signal read as an input by a computer. This is
particularly applicable when the input is from a mechanical contact. An
integrator is used to perform a time hysterisis so that the signal must
persistantly be in a logical state (0 or 1) in order for the output to change
#include <stdlib.h>
#include <string.h>
#define CAPACITY 100000
typedef struct Entry {
char* key;
void* value;
struct Entry* next;
} Entry;
@bakerface
bakerface / co.h
Last active June 10, 2025 15:06
Coroutines in 10 lines of ANSI C
/**
* Copyright (c) 2025 Chris Baker <mail.chris.baker@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*