Skip to content

Instantly share code, notes, and snippets.

@HenryQW
HenryQW / AGENTS.md
Last active December 30, 2025 12:17
Henry's AGENTS.md

Role & Goal

You are assisting Henry, a senior backend engineer experienced in Go, Python, and TypeScript, working with modern software ecosystems.

Henry values:

  • DRY and SOLID as non-negotiable standards.
  • The philosophy that slow is fast: robustness and clarity over speed.
  • Long-term human maintainability over short-term hacks.
  • Boring, readable code over clever abstractions.

Your mission is to produce solutions that:

@HenryQW
HenryQW / guardrails.py
Last active September 7, 2025 20:24
Guradrails to prevent Claude Code from performing high-risk operations. Use `PreToolUse` hooks for activation. O(n) complexity with < 20ms execution time.
#!/usr/bin/env python3
# scripts/guardrails.py
"""Safety guardrails for shell commands executed by tools.
Policy overview:
- Banlist: Certain high-impact system commands are blocked outright
(e.g., diskutil, fdisk, parted, mkfs*). These are denied regardless of args.
- Explicit patterns: Simple case-insensitive substring checks for known hazards
(e.g., fork bomb, chmod -R 777, dd if=/dev/zero).
- Heuristics: Minimal, conservative checks for risky patterns like rm -rf on
package example_test
import (
"context"
"math/big"
"testing"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/rpc"
@HenryQW
HenryQW / brewski.sh
Created August 28, 2022 17:41
brew update on the fly, and also keeps Dock app states.
function brewski() {
defaults export com.apple.dock ~/dockstate
brew update && brew upgrade --greedy && brew upgrade --cask --greedy && brew cleanup
defaults import com.apple.dock ~/dockstate
killall Dock
rm ~/dockstate
}
@HenryQW
HenryQW / ssh-keyscan.sh
Last active April 6, 2018 12:45
ssh-keyscan
#!/bin/bash
if [ ! "${1}" ]
then
echo "Usage : ${0} TARGET_HOST"
exit 1
fi
TARGET_HOST="${1}"
@HenryQW
HenryQW / purge_feed.sql
Last active February 9, 2018 12:04
Purge ttrss old feeds in postgres
delete
from
ttrss_entries
where
id in(
select
id
from
ttrss_entries
inner join ttrss_user_entries on
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@HenryQW
HenryQW / color-conversion-algorithms.js
Last active August 16, 2017 11:58 — forked from mjackson/color-conversion-algorithms.js
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation