Skip to content

Instantly share code, notes, and snippets.

View koteitan's full-sized avatar

koteitan koteitan

View GitHub Profile
@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)
@koteitan
koteitan / oneliner-nostr-client.js
Created February 11, 2026 15:43
oneliner of nostr client for browser console
(ws=new WebSocket("wss://yabu.me")).onopen=()=>ws.send('["REQ","tl",{"kinds":[1],"limit":20}]'),ws.onmessage=e=>{d=JSON.parse(e.data);d[0]=="EVENT"&&console.log(d[2].content)};
@koteitan
koteitan / nostrproject.md
Created January 17, 2026 16:29
custom slash command for nostr programming. put it in ~/.claude/commands/ and use it by /nostrproject
@koteitan
koteitan / github2llm.py
Created October 24, 2025 19:17
dump text in github for LLM
import os
import sys
def is_binary(file_path):
try:
with open(file_path, 'rb') as f:
chunk = f.read(1024)
if b'\0' in chunk:
return True
text_characters = bytearray({7,8,9,10,12,13,27} | set(range(0x20, 0x100)))
@koteitan
koteitan / claude-pushover.bash
Last active March 23, 2026 02:25
claude-pushover: send a push notification from claude code when the turn passes back to the user
#!/bin/bash
# claude-pushover - Send Claude Code conversation summary to Pushover
# push over https://pushover.net/ is a web API to make a push notification into iPhone App
# Configuration
SECURITY_MODE=0 # 0=off (detailed messages), 1=on (simple message only)
MAX_CHARS=800 # Maximum message length for Pushover
DEBUG_LOG="$HOME/claude-pushover-debug.log" # Debug log file
# Function to extract message from hook JSON input
get_hook_message() {
# Check security mode first
@koteitan
koteitan / find-twin.js
Last active August 9, 2025 02:03
find twin of nostr nsec
#!/usr/bin/env node
import { nip19, getPublicKey } from 'nostr-tools'
// secp256k1 curve order
const n = 115792089237316195423570985008687907852837564279074904382605163141518161494337n
// Get nsec from command line argument
const input_nsec = process.argv[2]
// Check arguments
@koteitan
koteitan / nsec-pair-gen.js
Last active August 8, 2025 15:21
Genrates a pair of secret keys that share the same public key
import { nip19, getPublicKey } from 'nostr-tools'
import crypto from 'crypto'
// secp256k1の位数
const n = 115792089237316195423570985008687907852837564279074904382605163141518161494337n
// シードから秘密鍵ペアを生成
function generatePair(seed) {
// シードをSHA256でハッシュ化して32バイトの値を作る
const hash = crypto.createHash('sha256').update(seed).digest()
@koteitan
koteitan / chargraph.py
Created July 27, 2025 16:18
draw a number-of-char-graph of your repository into charcount.png
import subprocess
import os
import csv
import shutil
from datetime import datetime
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
# Save current branch name
@koteitan
koteitan / deploy-submodule
Last active September 25, 2025 14:16
add, commit and push the submodule's update
#!/bin/bash
# Find the root of the git repository
git_root=$(git rev-parse --show-toplevel 2>/dev/null)
if [ $? -ne 0 ]; then
echo "Error: Not in a git repository"
exit 1
fi
# Check if we're in a submodule