Skip to content

Instantly share code, notes, and snippets.

View xiaolai's full-sized avatar
🎯
Focusing

xiaolai xiaolai

🎯
Focusing
View GitHub Profile
@xiaolai
xiaolai / claude-plugin-autoload.md
Created April 16, 2026 23:41
Drop-in Claude Code plugins per project — shell wrapper auto-loads repo-local plugins via --plugin-dir

Drop-in Claude Code plugins per project

A tiny shell wrapper that auto-loads any plugins living inside your project's .claude/plugins/ folder — no marketplace, no /plugin install, no settings.json edits.

Why

Claude Code plugins are normally installed via a marketplace or by editing .claude/settings.json. For personal or team-internal plugins that live inside a repo, this is clunky — you want to git clone a project and have its plugins just work.

There's an undocumented-but-official CLI flag, --plugin-dir <path>, intended for development and testing. It loads a plugin from disk for the duration of the session. This wrapper detects every plugin under ./.claude/plugins/*/ and appends one --plugin-dir flag per plugin automatically — so claude, claude -c, claude --resume, etc. all pick them up with no extra typing.

@xiaolai
xiaolai / cws.md
Last active April 22, 2026 09:02
cws — Claude Code workspace launcher for iTerm2 (AppleScript, zero dependencies)

cws — Claude Workspace Launcher

One command to open a Claude Code workspace in iTerm2.

cws ~/projects/myapp

What it does

@xiaolai
xiaolai / github.sh
Created December 25, 2022 08:43
Bash Function to Open a Gepo's Github Page from Terminal
function github {
if [ -d .git ]; then
remotes=$(git remote -v | head -1 | awk -F'[email protected]:' '{print $2}' | cut -d" " -f1)
if [ -z "$remotes" ];
then
remotes=$(git remote -v | awk -F'https://github.com/' '{print $2}' | cut -d" " -f1)
fi
remote_url=$(echo $remotes | cut -d" " -f1)
url="https://github.com/"
@xiaolai
xiaolai / iina-as-an-audiobook-player.md
Last active June 25, 2023 23:44
A better way to listen audiobook on MacOS
@xiaolai
xiaolai / download-all-my-kindle-books.ipynb
Last active March 18, 2026 14:26
a jupyter notebook for downloading all books to devices, using Selenium.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xiaolai
xiaolai / Using various profiles for vscode.md
Last active December 5, 2022 12:31
Using various profiles for vscode.md
alias codedefault="/opt/homebrew/bin/code"
alias code="codedefault --extensions-dir $HOME/.vscode/default/extentions --user-data-dir $HOME/.vscode/default/user"
alias codedart="codedefault --extensions-dir $HOME/.vscode/dart/extentions --user-data-dir $HOME/.vscode/dart/user"
alias codejs="codedefault --extensions-dir $HOME/.vscode/js/extentions --user-data-dir $HOME/.vscode/js/user"
alias codego="codedefault --extensions-dir $HOME/.vscode/go/extentions --user-data-dir $HOME/.vscode/go/user"
alias codemd="codedefault --extensions-dir $HOME/.vscode/markdown/extentions --user-data-dir $HOME/.vscode/markdown/user"
alias codepy="codedefault --extensions-dir $HOME/.vscode/python/extentions --user-data-dir $HOME/.vscode/python/user"
@xiaolai
xiaolai / index.html
Last active November 27, 2022 09:15
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
<link href="./styles.css" rel="stylesheet">
<title>Hello World!</title>
</head>
<body>
@xiaolai
xiaolai / notion.md
Last active April 24, 2024 23:40
Change fonts of Notion APP

Change font settings for Notion (Web/Desktop App)

Notion provides only three fonts to choose... I have to inject css styles to meet my ends, using Stylus extension for Edge and Nativefier for Desktop App.

notion.css

.notion-page-content {
    font-family: 'Kaiti SC'
} 
@xiaolai
xiaolai / 55-bytes-of-css.md
Created September 26, 2022 01:29 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@xiaolai
xiaolai / Python 2 and Alfred on macOS Monterey.md
Last active March 27, 2022 03:15
Python 2 and Alfred on macOS Monterey