Skip to content

Instantly share code, notes, and snippets.

@shmolyneaux
shmolyneaux / caramelized_carrot_soup.json
Last active July 5, 2021 18:24
Modernist Cuisine HTML Recipe Example
{
"title": "caramelized carrot soup",
"properties": [
{
"name": "yield",
"value": "six servings (1.3 kg / 6 cups)"
},
{
"name": "time estimate",
"value": "40 minutes overall, including 20 minutes of preparation and 20 minutes unattended"
@shmolyneaux
shmolyneaux / onion_skin.py
Last active March 30, 2021 18:12
Blender Onion Skinning (WIP)
import bpy
import gpu
from gpu_extras.batch import batch_for_shader
from collections import defaultdict
from time import time
from math import sin
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
import argparse
import itertools
import logging
from pathlib import Path
from PIL import Image
import sys
def collage_size(*, image_count, x_count, source_image_size):
if image_count <= x_count:
@shmolyneaux
shmolyneaux / cat_groups.rs
Last active October 15, 2019 05:53
Indexing Cat Groups
/// Cats, groups of cats, and cat ages obfuscate business objects
/// for an actual problem trying to be solved
use std::collections::HashMap;
struct Cat {
age: u8
}
struct CatGroup {
@shmolyneaux
shmolyneaux / FilterMethodIL.cs
Created September 22, 2018 19:26
Transcription of Beautiful Code Chapter 8 IL Generation
void FilterMethodIL(byte[] src, byte[] dst, int stride, int bytesPerPixel)
{
int cBytes = src.Length;
DynamicMethod dynameth = new DynamicMethod("Go", typeof(void),
new Type[] { typeof(byte[]), typeof(byte[]) }, GetType());
ILGenerator generator = dynameth.GetILGenerator();
generator.DeclareLocal(typeof(int)); // Index 0 = iDst
generator.DeclareLocal(typeof(double)); // Index 1 = pixelsAccum
generator.DeclareLocal(typeof(double)); // Index 2 = filterAccum