Skip to content

Instantly share code, notes, and snippets.

@oleg-koval
oleg-koval / enforcing-model-tiers.md
Last active August 17, 2026 15:00
Enforcing model tiers in Claude Code: PreToolUse hooks that stop silent Opus subagent fan-out

Stop paying for Opus subagents: enforcing model tiers in Claude Code with hooks

Everyone eventually writes some version of this rule into their CLAUDE.md:

The main thread orchestrates. Leaf work runs on Sonnet or Haiku. Escalate to Opus only after Sonnet actually fails.

And then it doesn't hold. Not because the model is disobedient, but because a rule written in prose is a rule the model gets to interpret, every single turn, under pressure to be helpful. The sub-task feels complex, so it "deserves" the better model. The Agent call omits model

@oleg-koval
oleg-koval / claude-code-statusline-gotchas.md
Last active August 5, 2026 10:54
Claude Code Status Line: the 7 gotchas that make yours lie to you (payload reference, copy-paste snippets, and a one-line install)

Claude Code statusline - things that make yours lie to you

Everything I learned writing and rewriting a Claude Code status line: the full shape of the JSON you get on stdin, the seven bugs that quietly make a status line wrong, and a finished one you can install in a single line.

The bugs are the interesting part. Every one of these was in my own status line, shipped, for weeks. None of them are in the docs.

How it looks schematically:

✻ O5 H  ┃  📁 my-repo  🌿 main ●3 ↑1  ┃  💰 $0.42 · 4m  +1.2k/-340  ┃  🧠 36% 357k/1.0M  ⏱5h 63% ↻1h07m  ┃  ☕ 52m break
 session place change budget rest
@oleg-koval
oleg-koval / block_commies.md
Created April 23, 2026 14:24
Blocking Countries via Cloudflare WAF Custom Rules

Blocking Countries via Cloudflare WAF Custom Rules

Prerequisites

  • Cloudflare API Token with Zone:Rulesets:Edit permission
  • Zone IDs for each domain

1. Get Zone IDs

curl -s -X GET \
@oleg-koval
oleg-koval / ai_shell.py
Last active March 17, 2026 16:55
Kitty terminal config — migrated from iTerm2 by Claude Code
import os
import subprocess
import sys
import tty
import termios
def main(args):
# Input prompt
sys.stdout.write('\033[1;34m╭─ Kitty AI Shell\033[0m\n')
@oleg-koval
oleg-koval / dclean.md
Last active April 2, 2026 22:40
dclean = one command to clean, rebuild, and start selected Docker Compose services.

Standalone script

Install

Store it in .zshrc and source ~/.zshrc

Run

dclean service1 service2

What Hiring Should Look Like

This is definitely not the first time I've written about this topic, but I haven't written formally about it in quite awhile. So I want to revisit why I think technical-position interviewing is so poorly designed, and lay out what I think would be a better process.

I'm just one guy, with a bunch of strong opinions and a bunch of flaws. So take these suggestions with a grain of salt. I'm sure there's a lot of talented, passionate folks with other thoughts, and some are probably a lot more interesting and useful than my own.

But at the same time, I hope you'll set aside the assumptions and status quo of how interviewing is always done. Just because you were hired a certain way, and even if you liked it, doesn't mean that it's a good interview process to repeat.

If you're happy with the way technical interviewing currently works at your company, fine. Just stop, don't read any further. I'm not going to spend any effort trying to convince you otherwise.

@oleg-koval
oleg-koval / install-protoc-osx.md
Created September 2, 2019 15:08
Install protobuf (protoc) compiler OSX, Ubuntu

If you have Homebrew (which you can get from https://brew.sh), just run:

brew install protobuf

or

PROTOC_VERSION=3.9.1
@oleg-koval
oleg-koval / settings.json
Created July 10, 2019 10:44
Styles for a cool vscode setup
{
"gitlens.advanced.messages": {
"suppressCommitHasNoPreviousCommitWarning": false,
"suppressCommitNotFoundWarning": false,
"suppressShowKeyBindingsNotice": true,
"suppressFileNotUnderSourceControlWarning": false,
"suppressGitVersionWarning": false,
"suppressLineUncommittedWarning": false,
"suppressNoRepositoryWarning": false,
"suppressUpdateNotice": false,
@oleg-koval
oleg-koval / index.js
Last active April 15, 2019 14:14
exponentialBackoff function
exponentialBackoff(fnFailsSomeTimes, 10, 100, function(result) {
console.log("the result is", result);
});
function exponentialBackoff(fn, max, delay, callback) {
const result = fn();
if (result) {
callback(result);
} else {
if (max > 0) {
@oleg-koval
oleg-koval / array_iteration_thoughts.md
Created January 29, 2019 15:27 — forked from ljharb/array_iteration_thoughts.md
Array iteration methods summarized

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and