Skip to content

Instantly share code, notes, and snippets.

View so298's full-sized avatar

Sosuke Hosokawa so298

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@so298
so298 / watch.py
Last active May 31, 2024 23:12
Simple command line tool to run a command and send a message to a Slack webhook if the command fails. (No external library dependencies!!)
#!/usr/bin/env python3
'''
Command line tool to run a command and send a message to a Slack webhook if the command fails.
'''
import subprocess
import urllib
import urllib.request
import urllib.parse
@so298
so298 / cat-unicode.py
Created August 5, 2024 16:17
Script to check if font file contains font for a specific unicode character
#!/usr/bin/env python3
import sys
def unicode_escape(file_path):
try:
with open(file_path, 'r', encoding='utf-8') as file:
content = file.read()
escaped_content = content.encode('unicode_escape').decode('ascii')
@so298
so298 / jax_pytree.py
Last active January 16, 2025 11:57
Simple example of JAX's pytree utility
import jax.numpy as jnp
from dataclasses import dataclass
from functools import partial
from jax.tree_util import register_dataclass, tree_flatten, tree_leaves
from jax import vmap
import jax
@partial(
register_dataclass,
@so298
so298 / cc_hooks.md
Last active July 4, 2025 07:52
Claude Codeのhooks

Claude Code hooksでslack通知を入れる

  1. claude コマンドを起動し、 /hooks を入力し、hooksの設定画面を開く
  2. 以下のような設定を Notification, Stop の両方に設定する
    cat | jq -r --arg host "$(hostname)" '
    {
      channel    : "claude-code",
      username   : "Claude Code",

icon_emoji : ":claude:",