Skip to content

Instantly share code, notes, and snippets.

@HarryHuang
HarryHuang / statusline-command.sh
Last active March 29, 2026 10:26
my claude-code statusline-command.sh
#!/usr/bin/env bash
input=$(cat)
# ── Colors ───────────────────────────────────────────────────────────────────
readonly CLR_RED='\033[0;31m' # bar: high usage (≥80%)
readonly CLR_YELLOW='\033[0;33m' # bar: medium usage (≥50%), model, cost
readonly CLR_GREEN='\033[0;32m' # bar: low usage (<50%)
readonly CLR_MAGENTA='\033[0;35m' # session time
readonly CLR_CYAN='\033[0;36m' # api time, git branch
readonly CLR_RESET='\033[0m' # reset
@HarryHuang
HarryHuang / cake_pattern_di.scala
Created November 19, 2011 11:54
Scala Dependency Injection: an improved cake pattern
//harry huang [huanghui.huang@gmail.com]
//
//After reading the original post [http://jboner.github.com/2008/10/06/real-world-scala-dependency-injection-di.html, ]
//the original cake pattern seems quite verbose for me, and it is quite invasive, so I spent a bit time
//and come up with an improved version of cake pattern, which I call it "Auto Cake DI". It is working
//well with any POST(plain old scala trait)/POSO(plain old scala object) which means that anything can be
//injected without modification or introducing new traits.
/*---------inject trait---------*/
trait Inject[+T] { def inject: T }