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 / build.sh
Last active April 4, 2026 07:01
Single binary HTTP server written in Go embedded with all static files.
#!/bin/bash -ue
if [ "$#" -lt 3 ]; then
echo "$0 BINARY_PREFIX STATIC_ROOT_DIR OUTPUT_DIR" >&2
exit 1
fi
export GOVER=1.18
export SUGOI_SRC='https://gist.githubusercontent.com/amane-katagiri/7b9e09f27d329515f423c97da35335b1/raw/0d1867886128375e30383f7b9aa470ff337a68a5/sugoi.go'
export PREFIX="$1"
@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で配信する簡単なスクリプト
ひとみを のぞきこむと じぶんの すがたが みえる。だが その かおは いつも すこしだけ わらっている。
だいじな ひとを わすれた にんげんの そばに あらわれる。かおりを かぐと なぜか なみだが でるという。
いちど なかまと みとめた あいてを にどと はなさない。トレーナーが きえても その ばしょで まわりつづける。
やくそくを やぶった にんげんを さがしだす。みつけると こゆびに あかい いとを まきつけて どこかへ つれさる。
はなびらが じかんごとに いちまいずつ ちる。さいごの いちまいが ちるとき なにが おこるかは だれも しらない。
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
r"""
Generate emoji list json file for mdx_unimoji(https://github.com/kernc/mdx_unimoji).
You can convert emoji_strategy.json on emojione (https://github.com/emojione/emojione) into
`{"ENTITY1": ["NAME1"], "ENTITY2": ["NAME2", "ALTERNAME2", ...], ...}`.
Usage:
$ ./emoji_generator.py https://raw.githubusercontent.com/Ranks/emojione/master/emoji_strategy.json
@amane-katagiri
amane-katagiri / LICENSE
Last active October 25, 2024 04:08
Wiki.jsでPGroongaを用いて全文検索を行う(/wiki/server/modules/search/pgroonga あたりに配置)
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
@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