Skip to content

Instantly share code, notes, and snippets.

View ivan-loh's full-sized avatar
🚢

Ivan Loh ivan-loh

🚢
View GitHub Profile
@ivan-loh
ivan-loh / vision-fallback.py
Created August 29, 2026 10:12
vision fallback when using glm with claude code
#!/usr/bin/env python3
"""PreToolUse hook for Read: routes image and PDF files to a vision model
and returns its description as the denial reason, so the main (non-vision)
model never receives content blocks it cannot see."""
import base64
import json
import os
import sys
import urllib.request
@ivan-loh
ivan-loh / statusline.sh
Created December 26, 2025 15:37
Status line script for claude code - Example Output: ▓ 73% │ Opus │ 54k/200k │ 12m │ ~/Projects/myapp
#!/bin/bash
#
# Claude Code statusline - optimized single-pass JSON parsing ( ~/.claude/statusline.sh )
#
input=$(cat)
# Parse all values in a single jq call (6x fewer process spawns)
# Use NUL separator to handle empty fields and paths with spaces correctly
{
IFS= read -r -d '' MODEL
@ivan-loh
ivan-loh / alacritty.toml
Created October 5, 2025 09:14
Ivan's 2025-10-05 MacOS 26 Alacritty Config
# Prerequisites:
# brew install --cask font-fira-code
# git clone https://github.com/alacritty/alacritty-theme.git ~/.config/alacritty/themes
[general]
import = ["~/.config/alacritty/themes/themes/sonokai.toml"]
[window]
opacity = 0.95
decorations = "buttonless"
@ivan-loh
ivan-loh / MCP Servers.md
Last active August 11, 2025 14:39
# TypeScript + Next.js 15 Development Assistant

Cognitive/Planning helpers

claude mcp add context7 --scope user -- npx -y @upstash/context7-mcp@latest claude mcp add sequential-thinking --scope user -- npx -y @modelcontextprotocol/server-sequential-thinking

Core development

claude mcp add filesystem --scope user -- npx -y @modelcontextprotocol/server-filesystem .

Browser

claude mcp add playwright --scope user -- npx @playwright/mcp@latest

@ivan-loh
ivan-loh / docker-compose.yml
Created April 1, 2024 15:39
development stack
services:
neo4j:
image: neo4j:latest
ports:
- "7474:7474"
- "7687:7687"
environment:
- NEO4J_AUTH=none
- NEO4J_ACCEPT_LICENSE_AGREEMENT=yes
- NEO4J_apoc_export_file_enabled=true
@ivan-loh
ivan-loh / compile-install-emacs.sh
Last active March 31, 2024 05:06
Compile and install emacs 28.1 for Ubuntu
#!/bin/bash
sudo apt install build-essential texinfo libx11-dev libxpm-dev libjpeg-dev libpng-dev libgif-dev libtiff-dev libgtk2.0-dev libncurses-dev libgnutls28-dev
wget http://ftp.gnu.org/gnu/emacs/emacs-29.3.tar.gz
tar xvzf emacs-29.3.tar.gz
cd emacs-29.3
./configure --with-mailutils
make
@ivan-loh
ivan-loh / Main.go
Last active August 8, 2019 06:44
Sample Bigquery Streaming
package main
import (
"cloud.google.com/go/bigquery"
"context"
"google.golang.org/api/googleapi"
"log"
"time"
)
@ivan-loh
ivan-loh / Job.go
Created December 14, 2018 03:35
golang google bigquery check for job error
package main
import (
"cloud.google.com/go/bigquery"
"context"
"log"
)
func main () {
@ivan-loh
ivan-loh / memory.sh
Created December 16, 2017 08:36
script to use to monitor memory utilization
#!/bin/bash
function alert {
curl --header 'Access-Token: <access_token_here>' \
--header 'Content-Type: application/json' \
--data-binary '{"body":"Memory Threshold Reachd","title":"Database Server Alert","type":"note"}' \
--request POST \
https://api.pushbullet.com/v2/pushes
}
@ivan-loh
ivan-loh / rxjs_operators_by_example.md
Created March 21, 2017 16:24 — forked from btroncone/rxjs_operators_by_example.md
RxJS 5 Operators By Example