Skip to content

Instantly share code, notes, and snippets.

@yyny
yyny / 0_reuse_code.js
Created December 27, 2015 20:36
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@yyny
yyny / dither.cl
Created May 9, 2020 16:18
arbitrary-palette positional dithering opencl implementation
// Dithering matrices.
// See https://en.wikipedia.org/wiki/Ordered_dithering
__constant float indexMatrix2x2[] = {
0.25, 0.75,
1.00, 0.50
};
__constant float indexMatrix4x4[] = {
0.0625, 0.5625, 0.1875, 0.6875,
0.8125, 0.3125, 0.9375, 0.4375,
@yyny
yyny / pulse-check.sh
Last active July 19, 2020 15:55
Managin a user-local pulseaudio daemon with runit in voidlinux
#!/bin/sh
# /home/user/runit/service/pulseaudio/check
. $(dirname $0)/common.sh
exec $pulse --check
@yyny
yyny / advanced_looping.c
Created April 3, 2021 19:04
Advanced Looping using `miniaudio` library
#define MINIAUDIO_IMPLEMENTATION
#include <miniaudio.h>
#include <stdio.h>
ma_uint32 first_frame; // frame to start looping
ma_uint32 last_frame; // frame to end looping (exclusive)
ma_uint32 num_frames; // number of frames to loop
void data_callback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount)
@yyny
yyny / a_minimal_example.c
Last active October 12, 2024 09:43
GDB JIT Interface -- Minimal Example
/* I spent an entire evening getting JIT debug symbols to work in GDB.
* Here is a minimal example to get you started.
* Have fun!
*/
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>