This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct arc { | |
| int32_t rc; | |
| uv_mutex_t mutex; | |
| }; | |
| typedef void* moonbit_reference_t; | |
| struct arc_ref { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| ------------------------------------------------------------------------------ | |
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bl_info = {"name": "Zoetrope", "category": "Animation"} | |
| import bpy | |
| class Zoetrope(bpy.types.Operator): | |
| bl_idname = "anim.zoetrope" | |
| bl_label = "Zoetrope" | |
| def execute(self, context): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /****************************************************************************** | |
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdlib.h> | |
| #include <string.h> | |
| #define CAPACITY 100000 | |
| typedef struct Entry { | |
| char* key; | |
| void* value; | |
| struct Entry* next; | |
| } Entry; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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: | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // I have a plane of size A,B in 3D space. I have a camera, which is pointed dead-on at the plane. The camera is mapping the plane into a window of size X,Y. | |
| // How far Z should the camera be away from the plane for the *entire* plane to be visible? | |
| // | |
| // Find the minimum distance where the entire plane is in view | |
| float get_distance( float plane_width, float plane_height, float fov ) | |
| { | |
| float half_width = plane_width / 2.0f; | |
| float half_height = plane_height / 2.0f; | |
| float half_fov = fov / 2.0f; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This can grow a Robin Hood linear probing hash table near word-at-a-time memcpy speeds. If you're confused why I use 'keys' | |
| // to describe the hash values, it's because my favorite perspective on Robin Hood (which I learned from Paul Khuong) | |
| // is that it's just a sorted gap array which is MSB bucketed and insertion sorted per chain: | |
| // https://pvk.ca/Blog/2019/09/29/a-couple-of-probabilistic-worst-case-bounds-for-robin-hood-linear-probing/ | |
| // The more widely known "max displacement" picture of Robin Hood hashing also has strengths since the max displacement | |
| // can be stored very compactly. You can see a micro-optimized example of that here for small tables where the max displacement | |
| // can fit in 4 bits: Sub-nanosecond Searches Using Vector Instructions, https://www.youtube.com/watch?v=paxIkKBzqBU | |
| void grow(Table *table) { | |
| u64 exp = 64 - table->shift; | |
| // We grow the table downward in place by a factor of 2 (not counting the overflow area at table->end). |
NewerOlder