Skip to content

Instantly share code, notes, and snippets.

@v-rob
v-rob / sdlscankey.c
Created October 24, 2023 19:33
SDL keycodes vs scancodes
// Can be compiled on Linux with the command:
// gcc -Wall -Wextra -std=c99 sdlscankey.c -o sdlscankey $(pkg-config --cflags --libs sdl2) -lm
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <SDL2/SDL.h>
@v-rob
v-rob / bubbles.py
Created May 21, 2021 01:36
A Python program for showing plots of the thickness of bubbles based on their color patterns.
# Computes bubble thickness refraction colormaps according to the paper
# <https://www.physics.mun.ca/~cdeacon/publications/Soap%20Bubbles%20-%20AJP%20Oct%202011.pdf>.
# License: MIT
# For this to run, matplotlib and numpy must be installed.
import matplotlib.pyplot as plt
import numpy as np
from math import pi
# Good enough; we only have one instantiation anyways
@v-rob
v-rob / any.cpp
Last active September 15, 2020 04:33
An attempt to make a C++11 alternative to C++17 std::any
/*
Copyright (C) 2020 Vincent Robinson <robinsonvincent89@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of