Skip to content

Instantly share code, notes, and snippets.

@BlackHole1
BlackHole1 / shell.sh
Created September 24, 2026 06:22
claude cli -> claude dekstop
claude-app() {
local target="${1:-.}"
local prompt="${2:-}"
local dir encoded url
dir="${target:A}"
if [[ ! -d "$dir" ]]; then
print -u2 -- "claude-app: not a directory: $target"
return 1
fi
encoded="$(/usr/bin/python3 -c 'import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1], safe=""))' "$dir")"
@BlackHole1
BlackHole1 / seed-computer-use-app-approvals.sh
Created April 17, 2026 03:39
Seed ComputerUseAppApprovals.json with discovered macOS app bundle identifiers
#!/bin/bash
set -euo pipefail
DEFAULT_OUTPUT="$HOME/Library/Group Containers/2DC432GLL2.com.openai.sky.CUAService/Library/Application Support/Software/ComputerUseAppApprovals.json"
OUTPUT_PATH="${1:-$DEFAULT_OUTPUT}"
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
@BlackHole1
BlackHole1 / README.md
Last active March 11, 2026 09:31
Solving debugging pain points for custom URL protocols in local macOS development

Before enabling Electron, use process.env.ELECTRON_OVERRIDE_DIST_PATH to redirect to a custom Electron app.

e.g. vite.config.ts

export default defineConfig(env => {
  process.env.ELECTRON_OVERRIDE_DIST_PATH = path.join(__dirname, ".electron-dist");

  // ...
});
@BlackHole1
BlackHole1 / cmd.sh
Created March 1, 2024 08:31
git checkout with fzf
# Ref: https://x.com/naoya_ito/status/1763034484843381187?s=20
git for-each-ref refs/tags refs/heads --sort=-committerdate --format="%(if:equals=commit)%(objecttype)%(then)branch%(else)%(objecttype)%(end)˞%(HEAD) %(refname:lstrip=2)˞%(objectname:short)˞%(if)%(upstream:remoteref)%(then) [%(upstream:lstrip=2)]%(end) %(subject) %(upstream:track)" | column -t -s ˞ | fzf -i --layout=reverse --preview-window=down:50% --preview="git show --no-patch --pretty=format:'Date: %ci (%cr)%nAuthor: %an <%ae>%nHash: %H%nBody:%n%b' {2}" | tr '*' ' ' | awk '{print $2}' | xargs -o git checkout
@BlackHole1
BlackHole1 / index.html
Created February 9, 2023 09:43
electron-cookie-filter-secure
<!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>
@BlackHole1
BlackHole1 / index.html
Created February 9, 2023 08:00
oomol github sign up and sign in - electron
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<link href="./styles.css" rel="stylesheet">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
@BlackHole1
BlackHole1 / main.js
Last active September 28, 2024 12:33
Interception WebSocket failed in electron
const {app, BrowserWindow} = require('electron')
async function createWindow () {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
})
mainWindow.loadURL('https://socket.io/demos/chat')
@BlackHole1
BlackHole1 / main.js
Last active October 10, 2022 09:23
Capture WebSocket message in electron
const {app, BrowserWindow} = require('electron')
async function createWindow () {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
})
mainWindow.loadURL('https://socket.io/demos/chat')
@BlackHole1
BlackHole1 / index.html
Created March 7, 2022 06:24
Chrome: CoreText note: Client requested name ".NewYork-Regular"
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
@font-face {
font-family: system;
font-style: normal;
font-weight: 300;
src: local(".NewYork-Regular");
type ObjKeyof<T> = T extends object ? keyof T : never
type KeyofKeyof<T> = ObjKeyof<T> | { [K in keyof T]: ObjKeyof<T[K]> }[keyof T]
type StripNever<T> = Pick<T, { [K in keyof T]: [T[K]] extends [never] ? never : K }[keyof T]>;
type Lookup<T, K> = T extends any ? K extends keyof T ? T[K] : never : never
type SimpleFlatten<T> = T extends object ? StripNever<{ [K in KeyofKeyof<T>]:
Exclude<K extends keyof T ? T[K] : never, object> |
{ [P in keyof T]: Lookup<T[P], K> }[keyof T]
}> : T
type NestedFlatten<T> = SimpleFlatten<SimpleFlatten<
SimpleFlatten<SimpleFlatten<SimpleFlatten<T>>>>>;