Skip to content

Instantly share code, notes, and snippets.

View paulfrische's full-sized avatar
🍕

Paul paulfrische

🍕
View GitHub Profile
@paulfrische
paulfrische / anymap.rs
Created April 13, 2025 18:31
personal version of lib.rs/anymap for fun and profit
#[derive(Debug, Default)]
struct AnyMap {
map: HashMap<TypeId, Box<dyn Any>>,
}
impl AnyMap {
fn new() -> Self {
Default::default()
}
#include <iostream>
#include <memory>
#include <unordered_map>
class GameObject;
class Component
{
public:
virtual void OnSetup() {}
@paulfrische
paulfrische / devenv.nix
Created November 24, 2024 13:01
devenv.nix for winit-rs
{
pkgs,
lib,
...
}: let
libs = with pkgs; [
libGL
xorg.libX11
xorg.libXi
libxkbcommon
@paulfrische
paulfrische / devenv.nix
Created November 23, 2024 12:25
using raylib-rs on nixos via devenv
{
pkgs,
lib,
...
}: let
libs = with pkgs; [
llvmPackages.libclang
libGL
xorg.libX11
{
pkgs,
lib,
...
}: {
packages = with pkgs; [
pkg-config
alsa-lib
udev
#include <iostream>
struct S {
explicit S() { std::cout << "S()\n"; } // basic constructor
S(const S& other) { std::cout << "S(const S&)\n"; } // copy constructor
S(const S&& other) { std::cout << "S(const S&&)\n"; } // move constructor
S& operator=(const S& other) { std::cout << "S& operator=(const S&)\n"; return *this; } // copy assignment operator
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
typedef struct Pair {
struct Pair *next;
const char *key;
void *value;
@paulfrische
paulfrische / vimModeStateDiagram.svg
Created September 28, 2023 15:16 — forked from darcyparker/vimModeStateDiagram.svg
Vim Modes Transition Diagram in SVG https://rawgithub.com/darcyparker/1886716/raw/eab57dfe784f016085251771d65a75a471ca22d4/vimModeStateDiagram.svg Note, most of the nodes in this graph have clickable hyperlinks to documentation.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paulfrische
paulfrische / vert.glsl
Created September 26, 2023 13:44
raymarching in shadertoy
vec4 SPHERE = vec4(0.0, 0.0, 3.0, 1.0);
float FOV = 3.0;
const int MAX_STEPS = 1000;
float EPSILON = 0.01;
float GROUND = -1.0;
vec4 SPHEREC = vec4(1.0, 0.0, 0.0, 0.0);
vec4 GROUNDC = vec4(0.4);
vec4 SKYC = vec4(0.3, 0.4, 0.8, 1.0);
@paulfrische
paulfrische / quick-sort.py
Created August 27, 2023 12:58
quick and dirty quick sort in python
import random
def quick_sort(arr):
if len(arr) <= 1:
return arr
pivot = arr[-1]
pivot_index = len(arr) - 1