Skip to content

Instantly share code, notes, and snippets.

View Jian-Min-Huang's full-sized avatar
🔥
Go Go Go !

黃健旻 Vincent Huang Jian-Min-Huang

🔥
Go Go Go !
View GitHub Profile
#!/bin/zsh
# Read JSON input from stdin
input=$(cat)
# Extract values using jq
CURRENT_TIME=$(date "+%Y-%m-%d %H:%M:%S")
MODEL_DISPLAY=$(echo "$input" | jq -r '.model.display_name // "unknown"')
CURRENT_DIR=$(echo "$input" | jq -r '.workspace.current_dir // "."')
TOTAL_COST=$(echo "$input" | jq -r '.cost.total_cost_usd // 0' | xargs printf "%.2f")

Rules

  • 買了就要用;用不到就賣掉
  • 按鍵類型不重複
  • 量產鍵盤品牌不重複
  • 團購套件
    • 65%
  • WKL
@Jian-Min-Huang
Jian-Min-Huang / OptSample.java
Last active December 18, 2022 15:31
Optional Note Part1
public class OptSample {
public void demoOpt() {
String requestBody = sendPost();
// 頭部
// of -> 確定不為 Null 的值
// ofNullable -> 可能為 Null 的值
Optional.of(requestBody).orElse("Empty Body");
Optional.ofNullable(requestBody).orElse("Empty Body");
@Jian-Min-Huang
Jian-Min-Huang / arrow-ext.kt
Last active July 2, 2022 16:59
Some note from learning Arrow-kt
fun <T> T?.catchErrWhenNull(tw: Throwable): Either<Throwable, T> = Either.Companion.catch { this ?: throw tw }
fun <T> Either<Throwable, T?>.flattenCatchErrWhenNull(tw: Throwable): Either<Throwable, T> =
when (this) {
is Either.Left -> this
is Either.Right -> Either.Companion.catch {
this.value ?: throw tw
}
}
@Jian-Min-Huang
Jian-Min-Huang / brand.md
Last active April 10, 2022 12:45
My Brands

3C

  • Apple
    • iPhone 13 Pro Max
    • MacBook Pro
    • Magic Mouse
    • Magic Trackpad
    • Watch
    • Airpods Pro
@Jian-Min-Huang
Jian-Min-Huang / Pinecone Burn Firmware.md
Last active February 22, 2026 14:38
Pinecone Burn Firmware
@Jian-Min-Huang
Jian-Min-Huang / reinstall_1126.md
Last active May 23, 2023 03:33
Reinstall 1126 Note