Skip to content

Instantly share code, notes, and snippets.

@CookieBox26
CookieBox26 / index.html
Created January 15, 2026 15:06
ランチャー
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<style type="text/css"><!--
html, body {
margin: 0;
height: 100%;
@CookieBox26
CookieBox26 / cld-ini.sh
Created January 14, 2026 07:25
Creates .claude/settings.local.json and .claude/CLAUDE.md if they do not exist.
#!/usr/bin/bash
# Creates .claude/settings.local.json and .claude/CLAUDE.md if they do not exist.
# Args: target directory, setting file flag, prompt file flag
# Ex. cld-ini.sh "`pwd`" "1Wb" "0"
# Ex. cld-ini.sh "`pwd`" "1WrWb" "0"
# Ex. cld-ini.sh "`pwd`" "1WrWb" "1"
# Setting file flag: one of "0", "1", "1Wb", "1WrWb" ("0" means do not create).
# Prompt file flag: "0" or "1" ("0" means do not create). Currently always generates Python rules.
# Assumes prompt templates are stored under ~/.claude_templates/.
set -euo pipefail # Fail fast on errors, undefined variables, and broken pipelines
@CookieBox26
CookieBox26 / scheduled_task.py
Last active January 13, 2026 06:50
スケジュール実行タスク (schedule ライブラリ使用)
"""
Python の schedule でタスクを定期実行するための便利クラス (遅刻・ダウンタイム・回数上限設定可)
このクラスの使い方: https://qiita.com/CookieBox26/items/9334a4d0e701ebbf0cdb
schedule ライブラリ: https://schedule.readthedocs.io/en/stable/index.html
"""
from abc import ABC, abstractmethod
import schedule
import time
import datetime
@CookieBox26
CookieBox26 / scrape.py
Created January 9, 2026 04:52
気象庁から名古屋と福岡の日時の気圧と気温をスクレイピングするスクリプト
from bs4 import BeautifulSoup
from pathlib import Path
import requests
import numpy as np
import pandas as pd
import time
class JMADataDaily:
def __init__(self, prec_no=51, block_no=47636, year=2025, month=12, suffix='_nagoya'):
@CookieBox26
CookieBox26 / convexts.sh
Created January 9, 2026 03:07
指定ディレクトリ以下の .txt を一斉に .md にリネームする (あるいはその逆をする) スクリプト (混在時はエラー)
#!/usr/bin/bash
# Ex. ./convexts.sh ./Dropbox/obsidian/Mercury/References/
set -euo pipefail # Fail fast on errors, undefined variables, and broken pipelines
[ "$#" -eq 1 ] || { echo "Usage: $0 <target_dir>" >&2; exit 1; }
target_dir=$1
[ -e "$target_dir" ] || { echo "Error: not found: $target_dir" >&2; exit 2; }
cd "$target_dir"
shopt -s nullglob # Make globs expand to empty when no files match
li_txt=( *.txt )
@CookieBox26
CookieBox26 / validate_tasks.py
Last active January 13, 2026 03:25
タスクバリデーションスクリプト
"""タスクバリデーションスクリプト
Usage: python path/to/validate_tasks.py
スクリプトの隣にある README.md 内のタスク一覧と Tasks/ 以下に作成済みのフォルダ一覧を比較して
以下に該当するタスクがあれば標準出力しますPython 標準モジュールのみ使います
- README にあるが Tasks/ 以下に未作成
- Tasks/ 以下にあるが README に未管理
- 締切日まで0日を切っているが未完了
- 締切日まで3日を切っているが未着手
@CookieBox26
CookieBox26 / fibonacci.py
Created January 8, 2026 05:05
フィボナッチ数列
class Fibonacci:
def __iter__(self):
print('===== __iter__() was just called. =====')
self.seq = []
return self
def __next__(self):
if len(self.seq) >= 10:
raise StopIteration
if len(self.seq) < 2:
x = 1
@CookieBox26
CookieBox26 / .CLAUDE.md
Last active January 14, 2026 06:49
Claude に守ってほしいルール

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

共通ルール

常に以下を守ってください。

  • 回答は日本語で行ってください。
  • 私が明示的に依頼しない限り、コードを実装しようとしないでください。
@CookieBox26
CookieBox26 / claudy.sh
Last active January 9, 2026 02:46
Claude への質問を積むための便利シェルスクリプト
#!/usr/bin/bash
# 指定の作業ディレクトリに移動して Claude に質問し回答を回収場所に保存して戻ってきます
# これを何回分も予約しておくことができます
# 回答は回収ボックス内に YYYYMMDD-hhmmss.md という名前で保存されます
# フラグを指定した場合は回答内容から制限に達していたか確認し制限解除まで待って再質問します
obsidian_dir=~/Dropbox/obsidian/Mercury/Claude/ # 回答マークダウンファイル回収場所
check_hit_limit=false # 回答文から制限に達していたかを確認するか (true/false)
setup() { # 引数: 作業ディレクトリ, 設定ファイル作成フラグ, ルールファイル作成フラグ
@CookieBox26
CookieBox26 / script.py
Created January 7, 2026 01:47
トークン数を確認するスクリプト
import torch
from transformers import AutoTokenizer, AutoModel
class Embedder:
def __init__(self):
self.model_name = "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2"
self.device = "cuda" if torch.cuda.is_available() else "cpu"
self.tokenizer = AutoTokenizer.from_pretrained(self.model_name)
text = """