Skip to content

Instantly share code, notes, and snippets.

View koteitan's full-sized avatar

koteitan koteitan

View GitHub Profile
@koteitan
koteitan / darkenpdf.py
Created November 14, 2026 15:32
PDF をダークモードに変換するスクリプト
" darken a pdf
" usage: python -I pdf_dark.py in.pdf out.pdf
import sys
import pikepdf
from pikepdf import Dictionary, Name, Pdf
def main(src: str, dst: str) -> None:
pdf = Pdf.open(src)
gs_obj = pdf.make_indirect(Dictionary(Type=Name.ExtGState, BM=Name.Difference))
@koteitan
koteitan / install-task.ps1
Last active September 12, 2026 21:24
WSL の強制再起動を無効化してアップデートをポップアップで通知する
# タスクスケジューラに「WSL update check」を登録する
# 3 時間ごと + ログオン時に wsl-update-check.ps1 を窓なしで実行する。
#
# 登録方法:
# - wsl-update-check.ps1 と同じディレクトリにこの install-task.ps1 を置く
# - 下記を実行する(管理者権限は不要)
# powershell -NoProfile -ExecutionPolicy Bypass -File install-task.ps1
# 削除方法: Unregister-ScheduledTask -TaskName 'WSL update check' -Confirm:$false
$ErrorActionPreference = 'Stop'
@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月