Skip to content

Instantly share code, notes, and snippets.

View shrynx's full-sized avatar
🤦‍♂️
github statuses are stupid. waiting for github stories

shrynx shrynx

🤦‍♂️
github statuses are stupid. waiting for github stories
View GitHub Profile
@shrynx
shrynx / README.md
Created March 16, 2024 22:34 — forked from noelbundick/README.md
Optimizing Rust container builds

Optimizing Rust container builds

I'm a Rust newbie, and one of the things that I've found frustrating is that the default docker build experience is extremely slow. As it downloads crates, then dependencies, then finally my app - I often get distracted, start doing something else, then come back several minutes later and forget what I was doing

Recently, I had the idea to make it a little better by combining multistage builds with some of the amazing features from BuildKit. Specifically, cache mounts, which let a build container cache directories for compilers & package managers. Here's a quick annotated before & after from a real app I encountered.

Before

This is a standard enough multistage Dockerfile. Nothing seemingly terrible or great here - just a normal build stage, and a smaller runtime stage.

@shrynx
shrynx / halftone-cartesian.pde
Created March 24, 2020 21:50 — forked from desandro/halftone-cartesian.pde
Half-ton halftones Processing sketch
// options
String imagePath = "img/desandro-avatar.jpg";
float res = 10; // resolution, dot density
float zoom = 3.0; // proportion to zoom image
boolean isAdditive = true; // true = RGB, false = CMY
float offsetAngle = 1; // affects dot pattern
/*
0 = no patter
0.05 = slight offset
1 = slight offset
@shrynx
shrynx / beads.clj
Created April 23, 2019 21:07 — forked from adicirstei/beads.clj
Beads on vector fields source
(ns gen-art.beads
(:require [clojure2d.core :refer :all]
[fastmath.core :as m]
[fastmath.random :as r]
[fastmath.fields :as f]
[fastmath.vector :as v]
[clojure2d.color :as c]
[clojure2d.extra.utils :as ut]
[clojure2d.pixels :as p])
(:import [fastmath.vector Vec2]) )