Skip to content

Instantly share code, notes, and snippets.

@kenji4569
kenji4569 / settings.json
Created August 1, 2026 21:31
settings.json for the root of the Claude Code
{
"env": {},
"permissions": {
"deny": [
"Bash(sudo:*)",
"Bash(rm:*)",
"Bash(git push * main:*)",
"Bash(git push *:main:*)",
"Bash(git push * master:*)",
"Bash(git push *:master:*)",
@kenji4569
kenji4569 / statusline.sh
Last active August 1, 2026 21:30
A shell script that renders a colorized Claude Code status line showing the current directory, Git status, model, cost, execution time, context usage, and subscription rate limits.
#!/bin/sh
# Claude Code statusLine script
# Mirrors ~/.zshrc PROMPT configuration
input=$(cat)
cwd=$(echo "$input" | jq -r '.cwd')
MODEL_NAME=$(echo "$input" | jq -r '.model.display_name')
TOTAL_COST=$(echo "$input" | jq -r '.cost.total_cost_usd')
TOTAL_DURATION=$(echo "$input" | jq -r '.cost.total_duration_ms')
TOTAL_API_DURATION=$(echo "$input" | jq -r '.cost.total_api_duration_ms')
inductive RideStatus
| requested
| rejected
| assigned
| pickedUp
structure Driver where
name : String
-- Ride は現在の状態と、必要なら担当ドライバーを持つ。
-- 信号の色を表す型を定義する。
-- `inductive` は、場合の候補を並べて新しい型を作る。
inductive Light
| red
| yellow
| green
-- 次の信号の色を返す関数。
def next
| Light.red => Light.green
def sum_of_natural_numbers (n : Nat) : Nat :=
-- 自然数の和を再帰で定義する。
match n with
-- 0 までの和。
| 0 => 0
-- n + 1 までの和は、n までの和に n + 1 を足す。
| n + 1 => sum_of_natural_numbers n + (n + 1)
-- 計算例。
#eval sum_of_natural_numbers 5
@kenji4569
kenji4569 / list-cidr-by-asn.py
Created May 16, 2026 03:52
Display the list of CIDRs
import re
import subprocess
ASN = "AS200373"
cmd = f"whois -h whois.radb.net -- '-i origin {ASN}'"
result = subprocess.run(
cmd,
shell=True,
# # GTFS Viewer
# ## Refs
# - https://gtfs.org/ja/
# - https://www.gtfs.jp/
# - https://nttdocomo-developers.jp/entry/20231218_1
# ## Setup
# $ pip install streamlit streamlit-folium folium pydeck pandas requests geopy gtfs-realtime-bindings
# $ streamlit run gtfs-viewer-app.py
# # Dynamic Vehicle Routing
# ## Refs
# - https://github.com/lb-robotics/python-vehicle-routing
# - https://zenn.dev/ohtaman/articles/streamlit_start_stop
# ## Setup
# $ pip install streamlit numpy scipy pandas altair readerwriterlock
# $ pip install wandb # Optional. Please do "wandb login" when you use it.
# $ streamlit run dynamic-vehicle-routing-streamlit-app.py
"""
streamlit-folium-example-app
Run the following commands to launch the app:
$ pip install streamlit streamlit-folium
$ streamlit run streamlit-folium-example-app.py
"""
import time
import express from 'express'
import cluster from 'cluster'
import { cpus } from 'os'
import process from 'process'
const workers = Math.min(Number(process.argv[2]) || 1, cpus().length)
const blockTime = Number(process.argv[3])
const app = express()
const port = 4000