Skip to content

Instantly share code, notes, and snippets.

View wout's full-sized avatar
💥

Wout wout

💥
View GitHub Profile
@wout
wout / vim-cheats.md
Created August 20, 2022 14:39 — forked from Starefossen/vim-cheats.md
My vim cheat sheet for working with tabs and window splits.

Tabs

New Tab

  • :tabnew - new blank tab
  • :tabedit [file] - open file in tab

Cursor Movement

  • gt (:tabn) - next tab
@wout
wout / cli.js
Created September 13, 2022 18:27 — forked from mattdesl/cli.js
colour palette from text prompt using Stable Diffusion https://twitter.com/mattdesl/status/1569457645182152705
/**
* General-purpose NodeJS CLI/API wrapping the Stable-Diffusion python scripts.
*
* Note that this uses an older fork of stable-diffusion
* with the 'txt2img.py' script, and that script was modified to
* support the --outfile command.
*/
var { spawn, exec } = require("child_process");
var path = require("path");
// x,y is bottom left corner
var Rectangle = function Rectangle(x,y,w,h){
this.x = x;
this.y = y;
this.width = w;
this.height = h;
}
// SOLUTION
var checkIntersect = function checkIntersect(r1,r2) {
@wout
wout / blurhashDataURL.ts
Created April 11, 2023 16:12 — forked from mattiaz9/blurhashDataURL.ts
Convert blurhash to a base64 DataURL string (no canvas or node-canvas)
import { decode } from "blurhash"
export function blurHashToDataURL(hash: string | undefined): string | undefined {
if (!hash) return undefined
const pixels = decode(hash, 32, 32)
const dataURL = parsePixels(pixels, 32, 32)
return dataURL
}
@wout
wout / rack_sse.ru
Created March 23, 2024 11:10 — forked from raggi/rack_sse.ru
Rack SSE Example
# rack_sse.ru
#
# An example of basic real-time, single-room broadcast chat using Server Sent
# Events in plain old Rack. This example does NOT use hijack, or the async
# hacks, it just relies on a well implemented threaded Rack server (at time of
# writing this will therefore only work with puma!). Other servers should be
# fixed to support this, as it is pretty critical to how Rack *should* work on
# most servers. The only spec-acceptable failure in this case is not flushing
# the content stream on each yield (for which the rack spec has no workaround
# today).
const { svg, prng, perlin, picker, array, dist, shuffle } = Pxyz
const { circle, line, polyline, group, rect } = Pxyz
// setup
const rand = prng(Atelier.seed())
const noise = perlin(15, rand)
// variables
const { width: W, height: H } = Atelier.resize(105, 148)
const M = 10
@wout
wout / Dockerfile
Created October 3, 2025 17:16 — forked from russ/Dockerfile
FROM node:gallium-buster as jsbuilder
ARG BUILD_DATE
ARG GIT_REF
ARG GIT_SHA
ENV NODE_OPTIONS=--max_old_space_size=4096
WORKDIR /app