Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
usage() {
echo "Usage: $0 [PERCENT]"
echo "Start Colima with dynamically allocated memory and CPU"
echo ""
echo "Arguments:"
echo " PERCENT Percentage of system memory and CPU to allocate (default: 75)"
echo ""
echo "Examples:"
@nwjsmith
nwjsmith / Wallit.swift
Last active August 19, 2025 19:09
macOS Dynamic Wallpaper Generator - Create appearance-aware wallpapers from hex colors
import Foundation
import CoreGraphics
import ImageIO
func parseHexColor(_ hex: String) -> (r: CGFloat, g: CGFloat, b: CGFloat)? {
let clean = hex.trimmingCharacters(in: CharacterSet(charactersIn: "#"))
guard clean.count == 6, let value = Int(clean, radix: 16) else { return nil }
return (
r: CGFloat((value >> 16) & 0xFF) / 255.0,
@nwjsmith
nwjsmith / DynamicWallpaperGenerator.swift
Created August 19, 2025 16:21
macOS Dynamic Wallpaper Generator - Creates HEIC wallpapers that switch between light/dark modes
#!/usr/bin/swift
import Foundation
import AppKit
import AVFoundation
import ImageIO
struct Color {
let r: CGFloat
let g: CGFloat
@nwjsmith
nwjsmith / keymap.json
Created March 1, 2024 15:00
DOOM-like window movement bindings for Zed
[
{
"context": "Editor && (vim_mode == normal || vim_mode == visual) && !VimWaiting && !menu",
"bindings": {
"space w v": "pane::SplitRight",
"space w s": "pane::SplitDown",
"space w h": ["workspace::ActivatePaneInDirection", "Left"],
"space w j": ["workspace::ActivatePaneInDirection", "Down"],
"space w k": ["workspace::ActivatePaneInDirection", "Up"],
"space w l": ["workspace::ActivatePaneInDirection", "Right"]

Keybase proof

I hereby claim:

  • I am nwjsmith on github.
  • I am nwjsmith (https://keybase.io/nwjsmith) on keybase.
  • I have a public key whose fingerprint is DE6F E362 7DF7 EEA0 79CB 38C1 F208 9547 768B 6CCA

To claim this, I am signing this object:

@nwjsmith
nwjsmith / SketchSystems.spec
Created August 10, 2019 17:15
Uninstalled*
Uninstalled*
Request installation -> Validating request
Validating request
Request invalid -> Bad installation request
Request valid -> Installed
Bad installation request
Installed
@nwjsmith
nwjsmith / SketchSystems.spec
Last active November 22, 2018 16:23
Pending*
Pending*
Build Pending
unblocked -> Running
Running
Build Running
Failing
Canceling
Unauthorized
Succeeded
Failed

Keybase proof

I hereby claim:

  • I am nwjsmith on github.
  • I am nwjsmith (https://keybase.io/nwjsmith) on keybase.
  • I have a public key ASCy88BjLsb0e4DMZnPdVUY57G532OZxKRpLFJASzljGJwo

To claim this, I am signing this object:

@nwjsmith
nwjsmith / instrument-fixture-fn.clj
Created February 20, 2018 18:20
Instrumenting fixture.
(defn instrument-fixture-fn
"Returns a function to be used as a clojure.test fixture. The fixture will
instrument the vars named by sym-or-syms, a symbol or collection of symbols,
or all instrumentable vars if the sym-or-syms is not specified. Any
previously instrumented vars will be unstrumented before the test run and
re-instrumented afterwards. Takes the same arguments as
`clojure.spec.test.alpha/instrument`."
([] (instrument-fixture-fn (stest/instrumentable-syms)))
([sym-or-syms] (instrument-fixture-fn sym-or-syms {}))
([sym-or-syms opts]
@nwjsmith
nwjsmith / gen_dag.clj
Created June 3, 2017 15:12
A test.check generator for a DAG
(def gen-node
"Generates graph nodes."
(gen/fmap str gen/uuid))
(defn gen-connecting-edges
"Generates edges between a connecting node and some subset of the given
nodes."
[connecting-node nodes]
(gen/fmap (partial map (partial vector connecting-node))