Skip to content

Instantly share code, notes, and snippets.

View koteitan's full-sized avatar

koteitan koteitan

View GitHub Profile
@koteitan
koteitan / find-stop-by-max-token.bash
Last active September 3, 2026 17:25
max tokens に引っかかってリトライしまくり現象の検出 (claude code)
grep -rHF 'stop_reason":"max_' --include='*.jsonl' ~/.claude/projects | sed 's|.*/projects/-home-koteitan-||' | awk -F: '{p=$1; sub(/^[^:]*:/,""); print p"\t"$0}' | while IFS=$'\t' read -r p j; do echo "$j" | jq -r --arg p "${p%%/*}" '[$p,(.timestamp|.[0:16]|sub("T";" ")),.message.usage.output_tokens,.message.model]|@tsv'; done | sort -k2 | column -t
@koteitan
koteitan / diff.md
Last active August 13, 2026 17:57
BMS to Rathjen fix

https://googology.fandom.com/ja/wiki/%E3%83%A6%E3%83%BC%E3%82%B6%E3%83%BC%E3%83%96%E3%83%AD%E3%82%B0:Hexirp/2023-09-16_%E3%81%AE%E8%A7%A3%E6%9E%90

(0,0)(1,1)(2,0)(1,1)(1,0)(2,1)(3,0)(1,0)(2,1)

(0,0)(1,1)(2,0)(1,1)(1,0)(2,1)(3,0)(1,0)                = w(phi(0,w(0)+1)+phi(0,w(0))+1) # agreement
(0,0)(1,1)(2,0)(1,1)(1,0)(2,1)(3,0)(1,0)(0,0)           = w(phi(0,w(0)+1)+phi(0,w(0))+1)+1
(0,0)(1,1)(2,0)(1,1)(1,0)(2,1)(3,0)(1,0)(1,0)           = w(phi(0,w(0)+1)+phi(0,w(0))+1+1)
(0,0)(1,1)(2,0)(1,1)(1,0)(2,1)(3,0)(1,0)(2,0)           = w(phi(0,w(0)+1)+phi(0,w(0))+w(0))
(0,0)(1,1)(2,0)(1,1)(1,0)(2,1)(3,0)(1,0)(2,1)           = w(phi(0,w(0)+1)+phi(0,w(0))+phi(0,0)) # here ------
─────────────────────────────────────────────────────────────────────────────────────
> nvim はあんまり使ってないんですが、バキバキにチューニングしてもらってもいいですか。
  最新のめっちゃいいプラグインいれまくり
─────────────────────────────────────────────────────────────────────────────────────

バキバキ nvim 環境まとめ

Vim Neovim
@koteitan
koteitan / statusline-command.sh
Last active July 15, 2026 17:17
statusLine command for Claude Code
#!/bin/bash
# statusLine command for Claude Code
# save it as ~/.claude/statusline-command.sh
input=$(cat)
host=$(hostname -s)
dir=$(echo "$input" | jq -r '.workspace.current_dir // .cwd // empty')
[ -z "$dir" ] && dir=$(pwd)
@koteitan
koteitan / katte.md
Created July 10, 2026 16:44
かってにやっちゃったアワード2026

🎉 かってにやっちゃったアワード2026 🎉

〜Claude Codeエージェント 暴走エピソード ランキング TOP10〜

Claude Code のセッション履歴を横断検索し、エージェント(=歴代の分身たち)が かってにやっちゃった名シーンを発掘・表彰する。第10位から発表。

---

第10位 「たとえ話で煙に巻く」賞 📚

@koteitan
koteitan / kawaii-prompt.md
Last active May 23, 2026 08:13
kawaii prompt

Usage

This is a prompt for ChatGPT Attach a charactor image and replace "____" by the charactor name

ChatGPT 用の prompt です。 キャラクターのイメージを添付して、"____" にキャラクターの名前を入れてください。

Prompt

Please create a character reference sheet for the character in the attached image. The character's name is "____".

@koteitan
koteitan / diff.md
Last active May 8, 2026 00:18
nosli と lumilumi の違い

nosli vs lumilumi の差分

kind はどちらも 30023.

1. tags

tag lumilumi nosli
image プレビュー画像 URL 出力しない
published_at unix 秒 出力しない
@koteitan
koteitan / aho-aho-2025
Created April 10, 2026 13:26
nostr の 2025 年のアホアホ投稿を claude に選抜してもらいました
# 🏆 koteitan 2025年 アホアホ投稿大賞
Nostr の koteitan (npub1f3w4x7dqvceeez8kuyq78md3lwhwfm0ra634llr0r3nykwjrs0hq) の 2025年の投稿 7387件から、月ごとにアホアホ投稿を3つずつ選抜し、さらに決勝戦で年間TOP3を決定しました。
---
## 月間予選結果(各月TOP3 = 計36投稿)
### 1月
@koteitan
koteitan / how-to-log-openclaw-http-request.md
Last active March 19, 2026 11:57
openclaw のモデルプロバイダ向けの http リクエストをログするための改造です

コード改造例

例えば、openai-codex の場合は下記のような感じ ~/.nvm/versions/node/v22.22.0/lib/node_modules/openclaw/node_modules/@mariozechner/pi-ai/dist/providers/openai-codex-responses.js

//ここから挿入コード-------------------------
try {
  const controlPath = "/tmp/openclaw-request-dump.json";
  if (existsSync(controlPath)) {
    const cfg = JSON.parse(readFileSync(controlPath, "utf8"));
@koteitan
koteitan / live-server-list.bash
Created February 21, 2026 01:32
list live-server ports
#!/bin/bash
# List ports that live-server is listening on
pids=$(ps aux | grep 'node.*[l]ive-server' | awk '{print $2}')
if [ -z "$pids" ]; then
echo "No live-server running."
exit 0
fi
for pid in $pids; do
port=$(ss -tlnp 2>/dev/null | grep "pid=$pid," | awk '{print $4}' | grep -oE '[0-9]+$')
dir=$(readlink -f /proc/$pid/cwd 2>/dev/null)