Skip to content

Instantly share code, notes, and snippets.

@natowi
natowi / audio2midi.md
Last active March 11, 2026 23:11
List of open source audio to midi packages

Upload images to GitHub

  1. Create a new issue on GitHub.

  2. Drag an image into the comment field.

  3. Wait for the upload process to finish.

  4. Copy the URL and use it in your Markdown files on GitHub.

@cswiercz
cswiercz / reference_wrappers.md
Last active May 11, 2020 21:13
C++11 Reference Wrappers

My Problems (There Are Many)

The C++ standard library containers are nice. Like, really nice. As the kind of person who worries about performance to the point that they were shy of anything other than a raw data array I've come to appreciate the usability (and speed!) of ye olde std::vector. Does that many me sound like a wannabe oldie?

Recently I came across a situation where I had, say, a vector [a, b, c, d] and wanted to create the vectors [a, b, c], [a, b, d], [a, c, d], and [b, c, d]. I didn't want to actually allocate O(N(N-1)) additional memory but learned that std::vector didn't support holding references. That's when I came across std::reference_wrapper.

Reference Wrappers

From the Cppreference page:

@Hebali
Hebali / GlslSobel.frag
Created January 12, 2017 17:25
GLSL Fragment Shader: Sobel Edge Detection
// Sobel Edge Detection Filter
// GLSL Fragment Shader
// Implementation by Patrick Hebron
uniform sampler2D texture;
uniform float width;
uniform float height;
void make_kernel(inout vec4 n[9], sampler2D tex, vec2 coord)
{
@gpiantoni
gpiantoni / vispy_custom_visual.py
Created September 3, 2015 16:03
3D mesh rendering in vispy
from numpy import float32, load
from vispy.geometry import MeshData
from vispy.gloo import VertexBuffer
from vispy.io.image import write_png
from vispy.plot import Fig
from vispy.scene.visuals import create_visual_node
from vispy.visuals import Visual
# download https://dl.dropboxusercontent.com/u/66601/fsaverage.npz
surf = load('fsaverage.npz')
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active March 16, 2026 18:34
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@shoooe
shoooe / any.hpp
Last active July 5, 2021 02:19
A simple implementation of Boost's any, as an exercise.
#pragma once
#include <exception>
#include <memory>
#include <typeinfo>
#include <type_traits>
class any;
template<class Type> Type any_cast(any&);
@shaunlebron
shaunlebron / angleLerp.js
Created February 5, 2014 20:41
The best way to interpolate 2D angles
/*
2D Angle Interpolation (shortest distance)
Parameters:
a0 = start angle
a1 = end angle
t = interpolation factor (0.0=start, 1.0=end)
Benefits:
1. Angles do NOT need to be normalized.
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active March 12, 2026 12:41
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@kolauren
kolauren / heap
Created January 30, 2013 06:19
Simple heap with heapsort
// Heapsort with Java
// Heap properties:
// Left child of h[i] is h[2i + 1] (given 2i + 1 < h.size)
// Right child of h[i] is h[2i + 2] (given 2i + 2 < h.size)
// parent of h[i] is h[(i-1)/2] (given i > 0)
public class Heap {
int[] heap;
int size;