Skip to content

Instantly share code, notes, and snippets.

View erhhung's full-sized avatar

Erhhung Yuan erhhung

  • Silicon Valley
  • 20:56 (UTC -07:00)
View GitHub Profile
@erhhung
erhhung / postman_modules.md
Created April 4, 2022 18:12
Load external modules in Postman

This document describes one way to load external JavaScript modules into Postman pre-request or test scripts to augment the functionality of your own scripts.

In the collection pre-request script, export common utility functions (feel free to add additional functions for your own use case as this is a common technique for sharing code among individual requests):

// get latest version
_ = require('lodash');

// export common utility functions
pm.globals.set('util', String(() => ({
@erhhung
erhhung / erhhung.omp.md
Last active October 1, 2025 19:00
Custom Oh-My-Posh theme

oh-my-posh-theme

"~/.config/oh-my-posh/erhhung.omp.yaml"

# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json

secondary_prompt:
  template: "  <b>{{ if .Root }} \uf0e7 {{ else }}❯{{ end }}</> "
  foreground: "#ffffff"
  background: transparent
@erhhung
erhhung / config
Created January 25, 2025 07:20
Ghostty Config on macOS
# https://ghostty.org/docs/config/reference
# https://ghostty.zerebos.com/
# shell
term = xterm-256color
shell-integration = bash
shell-integration-features = no-cursor
command = /bin/sh -c "printf '\e[2J\e[3J\e[H\n'; exec /usr/local/bin/bash -l"
# window
@erhhung
erhhung / slumber.yaml
Last active November 26, 2025 01:14
Open WebUI API Requests
.common_profile:
api_base: "{{ host_url }}/api"
# https://slumber.lucaspickering.me/api/template_functions.html
auth_token: "{{ response('sign_in', trigger='1h') | jsonpath('$.token') }}"
session_user: "{{ response('session_user', trigger='no_history') | json_parse() }}"
admin_user: "{{ session_user | jq('{id, name, email, role, profile_image_url}') }}"
user_id: "{{ admin_user | jsonpath('$.id') }}"
group_list: "{{ response('list_groups', trigger='no_history') | json_parse() }}"
group_id: '{{ group_list | jsonpath(concat([''$[?(@.name=="'',group_name,''")].id''])) }}'
knowledge_list: "{{ response('list_knowledge', trigger='no_history') | json_parse() }}"
@erhhung
erhhung / words.sh
Last active December 27, 2025 04:17
NYT Spelling Bee
#!/usr/bin/env bash
# @describe
#
# Find words of minimum length containing one or more
# letters given, optionally requiring certain letters.
# @option -n --minimum[=3|2|4|5|6|7|8] Minimum length
# @option -r --required* Required letters
# @arg letters* Contains letters