Skip to content

Instantly share code, notes, and snippets.

The following is a markdown transcription of https://www.mathpages.com/rr/s8-04/8-04.htm

The interesting part are up to and including the paragraph that ends in "These are the equations of motion for light based on the temporal metric approach.". Can you reproduce these in the response, and then add a 3D version as well?

8.4 Refractions on Relativity

For now we see through a glass, darkly; but then face to face. Now I know in part, but then shall I know even as also I am known. — I Corinthians 13,12

We saw in Section 3.4 that Fermat's Principle of least time predicts that paths of light rays passing through a plane boundary between regions of constant refractive index, but to more fully appreciate this principle it's useful to develop the equations of motion for light rays in a medium with arbitrarily varying refractive index. First, notice that Snell's law enables us to determine the paths of optical rays passing though a discrete boundary between regions of constant refractive index, b

@vassvik
vassvik / read_reg_string_bug.md
Created April 2, 2026 08:15
Bug: read_reg_string uses UTF-16 byte count to slice UTF-8 output buffer (core/sys/info/platform_windows.odin)

Bug: read_reg_string uses UTF-16 byte count to slice UTF-8 output buffer

File: core/sys/info/platform_windows.odin, line 385

Introduced in: the update-odin-2026-02 merge that removed context/temp allocator usage from init_gpu_info and read_reg_string.

The bug

utf16.decode_to_utf8(res_buf[:result_size], buf_utf16[:])

AI Code Review Pipeline

This is a multi-agent code review system built on Claude Code and claude -p (the non-interactive CLI). It reviews large PRs by breaking them into groups, examining them in dependency order, and producing a verified findings report.

Agent architecture

The system uses three types of Claude sessions, each with a custom system prompt and different tool access:

  • Tool-free reviewer agents (claude -p --tools "") — no file access, no code execution. They receive everything they need as text input: diffs, focus instructions, known facts, PR description. They can only read and reason. This constraint is intentional — it prevents reviewers from wandering through the codebase and forces all context to be curated upfront. Their system prompt defines what to flag (logic errors, leaks, races, broken API contracts), what to skip (style, missing tests), and critically — what to do when uncertain (emit a QUESTION finding with a specific verifiable question, rather than building on as
@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)
// 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