Skip to content

Instantly share code, notes, and snippets.

@vassvik
vassvik / statusline-gist.md
Created March 2, 2026 11:20
Claude Code custom two-line statusline with token metrics, cost, thinking, and session logging (PowerShell/Windows)

Claude Code Custom Statusline

A two-line statusline for Claude Code showing token metrics, cost, thinking activity, context usage, and session logging.

[Ctx:69.559%/70%] [$10.63750] Opus 4.6 C:\Projects\MyApp
[cw:174 cr:109538 | in:53526 (+3) out:40005 (+58)] [think:3832ch (+1087)]

What It Shows

Getting Started with the Claude API

The Claude API lets you send text to a model and get text back. That's it. There's no session, no memory, no connection between calls — every request is independent.

Disclaimer: this is based on a day of hands-on experimentation, not deep expertise. I don't speak with authority on exactly how things work internally, but everything here reflects what I observed in practice. All outputs shown are real API responses.

To follow along, you need:

  • Python 3.8+
  • pip install anthropic
  • An API key from console.anthropic.com (pay-per-token, separate from any subscription)
@vassvik
vassvik / FEATURE_REFERENCE.md
Created February 18, 2026 21:01
EmberGen 1.2 Feature & Algorithm Reference

EmberGen 1.2 — Feature & Algorithm Reference

This document describes what EmberGen 1.2 does at a feature/algorithm level, intended as a reproduction guide for reimplementing these features in the sparse rewrite. It is organized by system, not by UI node.


1. Simulation Overview

EmberGen simulates incompressible volumetric fluid on a uniform 3D grid (32–512 voxels per side). Two simulation modes exist: Combustion (smoke + temperature + fuel + flames, 4 channels) and Colored Smoke (smoke density + RGB color, 4 channels). The simulation runs entirely on the GPU via compute shaders.

@vassvik
vassvik / spherical_frustum_grid.md
Last active February 12, 2026 10:29
Short description of a spherically distorted frustum grid. Authored with Claude Code, so some inconsistencies and oversights might have slipped through.

Spherically Distorted Frustum Grid

This document describes a variant of the frustum grid that uses spherical depth shells instead of planar depth slices, while retaining the standard perspective lateral coordinates.

Planar Grid Overview

The planar frustum grid uses a piecewise depth distribution. Key parameters:

  • κ = 2·tan(θ/2)/N — pixel cone slope (θ = FOV, N = pixels along one axis)
  • s — voxel size (world-space units)
// Bsky thread: https://bsky.app/profile/vassvik.bsky.social/post/3m7anve2mt22t
// Converted to GLSL from https://fgiesen.wordpress.com/2009/12/13/decoding-morton-codes/
// 5 &
// 4 |
// 4 >>
// 13 total
uvec2 _compact_1_by_1(uvec2 x) {
x = x & 0x55555555u; // x = -f-e -d-c -b-a -9-8 -7-6 -5-4 -3-2 -1-0
import sympy
h = sympy.Symbol("h")
f = sympy.Symbol("f")
e = sympy.Symbol("e")
c = sympy.Symbol("c")
def taylor_expansion(a, b, c):
n = 4
derivatives = [0] * n
@vassvik
vassvik / Readme.md
Last active December 2, 2024 13:40
GLFW + glad on Windows

How to get GLFW + glad working in Windows using the Visual Studio compiler (MSVC):

From an x64 dev command prompt. I'm using VS 2019, but earlier and later versions should work the same. GLFW depends on git and cmake being available in PATH. No other dependencies.

Compiling GLFW:

git clone https://github.com/glfw/glfw

cd glfw 
@vassvik
vassvik / Simulation_Projection.md
Last active January 23, 2026 02:59
Realtime Fluid Simulation: Projection

Realtime Fluid Simulation: Projection

The core of most real-time fluid simulators, like the one in EmberGen, are based on the "Stable Fluids" algorithm by Jos Stam, which to my knowledge was first presented at SIGGRAPH '99. This is a post about one part of this algorithm that's often underestimated: Projection

MG4_F32.mp4

Stable Fluids

The Stable Fluids algorithm solves a subset of the famous "Navier Stokes equations", which describe how fluids interact and move. In particular, it typically solves what's called the "incompressible Euler equations", where viscous forces are often ignored.

Card Name VRAM (GB) Type Release Date Bandwidth (GB/s)
------------------------------------------------------------------------------------------
GeForce RTX 2080 Ti | 11 | GDDR6 | Sep 20 2018 | 616.0
Radeon RX 5700 XT | 8 | GDDR6 | Jul 7 2019 | 448.0
Radeon RX 580 | 8 | GDDR5 | Apr 18 2017 | 256.0
Radeon RX 570 | 4 | GDDR5 | Apr 18 2017 | 224.0
GeForce RTX 2060 | 6 | GDDR6 | Jan 7 2019 | 336.0
GeForce RTX 2070 SUPER | 8 | GDDR6 | Jul 9 2019 | 448.0
GeForce GTX 1660 Ti | 6 | GDDR6 | Feb 22 2019 | 288.0
GeForce GTX 1050 Ti | 4 | GDDR5 | Oct 25 2016 | 112.1
31.932 0.781 235.379 cs_filter3D_27stencil.glsl 512x512x512 R16F [8, 8, 8]
31.973 1.101 235.080 cs_filter3D_27stencil.glsl 512x512x512 R16F [32, 32, 1]
31.285 0.552 240.247 cs_filter3D_27stencil.glsl 512x512x512 R16F [32, 1, 32]
30.455 1.047 246.794 cs_filter3D_27stencil.glsl 512x512x512 R16F [16, 16, 1]
30.281 0.894 248.218 cs_filter3D_27stencil.glsl 512x512x512 R16F [16, 1, 16]
32.020 1.188 234.732 cs_filter3D_27stencil.glsl 512x512x512 R16F [16, 16, 4]
31.585 0.934 237.969 cs_filter3D_27stencil.glsl 512x512x512 R16F [16, 4, 16]
31.712 0.940 237.013 cs_filter3D_27stencil.glsl 512x512x512 R16F [4, 16, 16]
30.113 0.383 249.603 cs_filter3D_27stencil.glsl 512x512x512 R16F [4, 2, 16]
30.041 0.290 250.198 cs_filter3D_27stencil.glsl 512x512x512 R16F [16, 2, 4]