Skip to content

Instantly share code, notes, and snippets.

View amane-katagiri's full-sized avatar

Ryunosuke Ito amane-katagiri

View GitHub Profile
@amane-katagiri
amane-katagiri / ai_profile.fish
Last active September 25, 2026 23:15
clausonaのプロファイルをディレクトリごとに自動で切り替えるためのbash/fish向けコマンド集
function __ai_profile
set -l dir $PWD
while true
if test -f "$dir/.ai-profile"
string trim < "$dir/.ai-profile"
return 0
end
if test "$dir" = "/"
@amane-katagiri
amane-katagiri / index.html
Created June 22, 2026 07:19
あまねけ!おもしろCSS 7選 サンプルページ ⑦ CSSだけでランダムっぽいパラメータを使う
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>あまねけ!おもしろCSS 7選 サンプルページ ⑦ CSSだけでランダムっぽいパラメータを使う</title>
<style>
:root {
--s: 1;
@amane-katagiri
amane-katagiri / index.html
Created June 22, 2026 07:17
あまねけ!おもしろCSS 7選 サンプルページ ⑥ CSSだけでクリックに応じてスタイルを切り替える
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>あまねけ!おもしろCSS 7選 サンプルページ ⑥ CSSだけでクリックに応じてスタイルを切り替える</title>
<style>
/* 「状態」を保持するチェックボックスを隠しつつフォーカス可能にする */
input[type="checkbox"]#toggle {
@amane-katagiri
amane-katagiri / spotify-now-playing.bat
Last active March 29, 2026 03:03
10秒に一回のペースでSpotifyから再生中の曲を取得してSSEで配信する簡単なスクリプト
cd /d "%~dp0"
set SPOTIFY_CLIENT_ID=xxx
set SPOTIFY_CLIENT_SECRET=yyy
node spotify-now-playing.mjs
@amane-katagiri
amane-katagiri / data.txt
Last active March 29, 2026 03:01
30秒に一回のペースで data.txt からランダムなテキストをSSEで配信する簡単なスクリプト
ひとみを のぞきこむと じぶんの すがたが みえる。だが その かおは いつも すこしだけ わらっている。
だいじな ひとを わすれた にんげんの そばに あらわれる。かおりを かぐと なぜか なみだが でるという。
いちど なかまと みとめた あいてを にどと はなさない。トレーナーが きえても その ばしょで まわりつづける。
やくそくを やぶった にんげんを さがしだす。みつけると こゆびに あかい いとを まきつけて どこかへ つれさる。
はなびらが じかんごとに いちまいずつ ちる。さいごの いちまいが ちるとき なにが おこるかは だれも しらない。
@amane-katagiri
amane-katagiri / emoji_atokdict_generator.py
Last active November 15, 2023 07:20
Emoji dictionary generator for ATOK.
#!/usr/bin/env python3
r"""
Generate emoji dict file for ATOK.
You can convert emoji_strategy.json on emoji-toolkit (https://github.com/joypixels/emoji-toolkit) into:
```
Grinning 😀 名詞*
...
@amane-katagiri
amane-katagiri / export_chatgpt.py
Last active July 31, 2023 06:57
List all conversation lines from exported data of ChatGPT.
#!/usr/bin/env python3
# Usage: ./export_chatgpt.py conversations.json ./path/to/export/dir
from dataclasses import dataclass
import itertools
import json
import logging
from logging import getLogger, StreamHandler
import sys
@amane-katagiri
amane-katagiri / correct.sh
Last active July 22, 2023 18:01
A tiny script to print proofreading suggestions for your sentences with OpenAI API.
#!/bin/bash -eu
# https://blog.jxck.io/entries/2023-03-24/proofreading-via-openai.html
PROMPT='バッククォートで囲まれた以下の文章の誤字、脱字、スペルミスを、原文をできるだけ尊重しつつ修正してください。返答は修正後の文章のみを簡潔に返すこと。'
QUOTE='```'
CONF="$HOME/.correct"
CACHE="$HOME/.correct_cache"
FORCE=''
@amane-katagiri
amane-katagiri / expose-wsl-server.ps1
Last active June 3, 2023 20:36
Expose server connection on WSL to LAN.
#!/usr/bin/pwsh
if ($args.count -eq 0){
$connectport = [Microsoft.VisualBasic.Interaction]::InputBox("Input connectport (expose port on wsl)", $MyInvocation.MyCommand.Name, "8000")
if ($connectport.length -eq 0) {
Write-Error "Set connectport" -ErrorAction Stop
}
$listenport = [Microsoft.VisualBasic.Interaction]::InputBox("Input listenport (expose port on host)", $MyInvocation.MyCommand.Name, $connectport)
if ($listenport.length -eq 0) {
Write-Error "Set listenport" -ErrorAction Stop
@amane-katagiri
amane-katagiri / sample.atom.xml
Last active June 4, 2023 01:26
Atomフィードのサンプル
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>【サイトタイトル】</title>
<!-- サイトのURL -->
<link rel="alternate" href="https://your-site.example.com/"></link>
<!-- フィードのURL -->
<link rel="self" href="https://your-site2.example.com/path/to/feed.atom.xml"></link>
<!-- フィードのID「tag:【サイトドメイン】,【公開年(月日)】:【URL】」 -->
<id>tag:your-site.example.com,2023:/</id>
<!-- フィードの最終更新日時 -->