Skip to content

Instantly share code, notes, and snippets.

@tomo3141592653
tomo3141592653 / コミックおすすめ
Created July 3, 2019 09:11
コミックおすすめ
★★★★★
火の鳥 手塚治虫
MASTERキートン 浦沢直樹&勝鹿北星
寄生獣 岩明均
銃夢 木城ゆきと
藤子・F・不二雄のSF短編集 藤子・F・不二雄
攻殻機動隊 士郎正宗
プラネテス 幸村誠
カムイ伝 白土三平
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script>
L_NO_TOUCH = false;
L_DISABLE_3D = false;
@tomo3141592653
tomo3141592653 / claude_model_switcher.py
Created March 11, 2026 04:49
Auto-switch Claude Code model (opus/sonnet) based on remaining token usage
#!/usr/bin/env python3
"""
claude_model_switcher.py — Auto-switch Claude Code model based on token usage.
Reads remaining tokens from Anthropic API, then writes the chosen model
("opus" or "sonnet") into ~/.claude/settings.json.
Logic:
- Use opus if token_remaining% > 30 AND token_remaining% >= time_remaining%
- Otherwise use sonnet (to conserve tokens)
@tomo3141592653
tomo3141592653 / claude_tmux_runner.sh
Created June 15, 2026 15:48
claude --print (claude -p) の tmux 代替ラッパー: サブスクで --print が使えない時に Claude CLI を非対話駆動。__SESSION_COMPLETE__ で完了検出、--resume/--continue/--model/--allowed-tools 対応。
#!/bin/bash
# claude_tmux_runner.sh
#
# claude -p の代替。tmux経由でClaude CLIを駆動する。
# サブスク制限で --print が使えなくなった場合の代替手段。
#
# Usage:
# ./claude_tmux_runner.sh -p "prompt" # 新規セッション(--printと同等)
# ./claude_tmux_runner.sh --resume SESSION_ID "prompt" # セッション継続
# ./claude_tmux_runner.sh --continue "prompt" # 既存tmuxセッションに追加送信