Skip to content

Instantly share code, notes, and snippets.

View ivan's full-sized avatar
🕸️

Ivan Kozik ivan

🕸️
View GitHub Profile
@ivan
ivan / asyncread poll_read footgun.md
Last active September 14, 2026 19:17
tokio::io::AsyncRead poll_read implementation footgun

The tokio::io::AsyncRead documentation confusingly states:

Poll::Ready(Ok(())) means that data was immediately read and placed into the output buffer. The amount of data read can be determined by the increase in the length of the slice returned by ReadBuf::filled. If the difference is 0, EOF has been reached.

https://docs.rs/tokio/latest/tokio/io/trait.AsyncRead.html

The footgun is that when poll_read is called, buf may already be partially filled. In some cases, this happens just a small fraction of the time in production, causing e.g. the last chunk of a file to be poll_read twice.

Setup code:

@ivan
ivan / 2024_reading.md
Last active September 14, 2026 06:38
2024 reading list
@ivan
ivan / thoughts.md
Last active August 14, 2026 03:42
my thoughts after reading Davood Gozli's _Extended Minds and Tools for Mind-Wandering_ chapter in _New Perspectives on Mind-Wandering_

I noticed the same thing that you noticed with Twitter shaping mind-wandering thoughts, and that makes me think one of Twitter's wide effects is to rob tens of millions of people of paragraph-sized thoughts. Posting a large paragraph with multiple tweets feels imposing, and writing something complicated and nuanced on Twitter can also feel odd. Courageous people bend the medium to their will, but the medium largely demands informal and aphoristic thoughts. And as you say, that then shapes our MW time.

I really like the first Dostoevsky quote and “contemplation”. Mind-wandering may set someone free if their non-MW activities are keeping them stuck in some bad local maximum.

The arguments against the perceptual-decoupling view are really interesting and seem right, though I'm not familiar with the research being critiqued. It's funny that they would miss these counterexamples.

MW as a result of flexible relations to goals is interesting. I noticed that while reading and underslept, I kept MW as I had a goal

@ivan
ivan / README.md
Created December 24, 2023 06:29
I just need to find a good game to play

Game reviews of things I'm trying EOY 2023 - early 2024

@ivan
ivan / CLAUDE.md for having Claude Code use Codex for code reviews after each commit.md
Created August 10, 2026 06:19
Have Claude Code use Codex for code reviews after each commit

After making changes

Automatically commit your changes with this commit template:

subsystem: short one-line description; semicolon if multiple changes

Model-output: model name e.g. Claude Fable 5
  • $310K for a year of MSSQL support
  • $192K for Traefik support
  • $27.5K for a https://snyk.io/ renewal
  • $233K for YotaScale renewal while "working on our own internal tool with a goal to replace Yotascale with an alternative which will allow for better customization & self-service options"
  • $30K for RStudio renewal for their data scientists
  • $12K/year for Nasdaq Governance Solutions to "allow directors and section 16 officers of the company to complete required disclosure questionnaires using an online questionnaire platform"
  • unknown amount for 800 licenses of Lightstep "a cloud-based tracing solution that can track the communication and dependency among the HTTP or gRpc services, and help debug latency or performance issues"
  • $125K/year for https://www.kodex.us/ "Kodex. The purpose of this tool is to enable secure receiving and responding to law enforcement requests. Kodex will also take on ownership of verifying law enforcement agencies as well as flagging if they deem a request suspicious. Kodex i
@ivan
ivan / Untested nixpkgs patch to avoid filling up boot with too many generations.patch
Last active July 28, 2026 02:25
(Claude Fable 5 + ChatGPT 5.6 Sol (Pro)) Untested nixpkgs patch to avoid filling up /boot with too many generations
diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix
index 042fd63cd254..6d319a3d3ca3 100644
--- a/nixos/modules/system/boot/loader/grub/grub.nix
+++ b/nixos/modules/system/boot/loader/grub/grub.nix
@@ -90,6 +90,9 @@ let
else
args.efiBootloaderId;
timeout = if config.boot.loader.timeout == null then -1 else config.boot.loader.timeout;
+ dynamicLimit = cfg.dynamicConfigurationLimit.enable;
+ dynamicLimitMarginMB = cfg.dynamicConfigurationLimit.marginMB;
@ivan
ivan / zsh-history-archive.zsh
Last active July 26, 2026 05:33
Maybe a proper zsh history logger, via good requirements + ChatGPT 5.2 Thinking + 5.5 Pro + 5.5 Thinking
# This is slop authored by ChatGPT 5.5 Pro on 2026-05-03, using some earlier
# inputs from ChatGPT 5.2 Thinking.
# zsh JSONL history archive
# Install: source this near the end of ~/.zshrc.
#
# Records go to one unique JSONL file per interactive zsh session:
# ${ZSH_HISTORY_ARCHIVE_DIR:-${XDG_STATE_HOME:-$HOME/.local/state}/zsh-history-archive}/hist.<session>.jsonl
#
# Record types:
@ivan
ivan / patch_witness_stair_speed_no_corruption_check.py
Last active July 12, 2026 20:45
Fix the walking speed in The Witness witness64_d3d11.exe (GOG, Patch 21.12.2017 from 06 March 2018) to not have sqrt(2) walking speed on stairs
#!/usr/bin/env python3
# Model-output: ChatGPT 5.6 Sol (High)
"""Patch The Witness stair movement and bypass its startup corruption guard.
The movement patch rescales a player-only walk-manifold request when traversal adds
vertical displacement. The startup patch removes the conditional jump that routes
a zero critical-asset sentinel to ``fatal_error_data_corruption``. The PE file size
and section count remain unchanged.
@ivan
ivan / Prevent ChatGPT from unloading text from the DOM when it is outside the viewport.user.js
Created July 8, 2026 04:32
Prevent ChatGPT from unloading text from the DOM when it is outside the viewport
// ==UserScript==
// @name leave my text alone (chatgpt.com)
// @namespace https://chatgpt.com/
// @version 1.0.0
// @description Keep every chat turn mounted in the DOM (defeats IntersectionObserver-driven unloading) so find-in-page and SingleFile capture whole conversations.
// @match https://chatgpt.com/*
// @match https://chat.openai.com/*
// @run-at document-start
// @grant none
// @inject-into page