Skip to content

Instantly share code, notes, and snippets.

View glfmn's full-sized avatar
💼
Find me on codeberg

Gwen glfmn

💼
Find me on codeberg
View GitHub Profile
@kajott
kajott / bluenoise.c
Created June 26, 2019 10:49
Blue Noise texture generation using the void-and-cluster algorithm
#if 0 // self-compiling code
gcc -std=c99 -Wall -Wextra -pedantic -Werror -g -O4 -march=native $0 -lm || exit 1
exec time ./a.out
#endif
// Blue Noise texture generation using the void-and-cluster algorithm
// implemented by Martin Fiedler <keyj@emphy.de>
// using an algorithm description written by Alan Wolfe:
// https://blog.demofox.org/2019/06/25/generating-blue-noise-textures-with-void-and-cluster/
@minecrawler
minecrawler / main.rs
Created March 22, 2017 00:40
Simple Snake implemented on top of Amethyst
extern crate rand;
extern crate amethyst;
use amethyst::{Application, Event, State, Trans, VirtualKeyCode, WindowEvent};
use amethyst::asset_manager::AssetManager;
use amethyst::config::Element;
use amethyst::ecs::{World, Join, VecStorage, Component, RunArg, System, Entity};
use amethyst::ecs::components::{Mesh, LocalTransform, Texture, Transform, Renderable};
use amethyst::gfx_device::DisplayConfig;
@andrewsosa
andrewsosa / mergesort.py
Last active March 6, 2017 17:23
Minimalistic Merge sort in Python
def select(left, right):
"""Choose the minimum front from left and right, but handle empty lists."""
return left.pop(0) if (len(left) > 0 and len(right) is 0) or (len(left) > 0 and left[0] < right[0]) else right.pop(0)
def merge(left, right):
"""Conquer: Merge together the selected (min) front of left and right."""
return [select(left,right) for i in range((len(left) + len(right)))]
def sort(l):
"""Divide: Recursive call to split input list into managable sublists."""