Skip to content

Instantly share code, notes, and snippets.

View l-qing's full-sized avatar
🏠
Working from home

l-qing

🏠
Working from home
  • Wuhan, China.
  • 12:17 (UTC +08:00)
View GitHub Profile
@tamphh
tamphh / git_fzf.sh
Last active March 30, 2024 20:32 — forked from junegunn/gist:f4fca918e937e6bf5bad
Browsing git commit history with fzf
# git log show with fzf
#
# https://gist.github.com/tamphh/3c9a4aa07ef21232624bacb4b3f3c580/edit
# https://asciinema.org/a/257939
#
# git log show with fzf
gli() {
# param validation
@rdump
rdump / kubectl-multi-version-brews.md
Last active April 4, 2024 15:20
kubectl multi-version brews (kubernetes-cli formula)

kubectl multi-version brews

Applicability

The instructions below apply to older versions of Homebrew which still provide switch capability.

For current Homebrew, you'll likely need to keep Versions around, and build locally. Here's my versions repository https://github.com/rdump/homebrew-versions

MacPorts is now keeping versioned installations available as well, by default.

@xjcoan
xjcoan / Add Java JUnit Testing to Mac
Last active January 25, 2024 20:24
Install JUnit testing on a Mac environment (written for JUnit 4)
Download the latest version of JUnit here : <https://github.com/junit-team/junit4/wiki/Download-and-Install>
(I place mine in ~/java/ for this example)
Add the following lines to terminal conf. file (~/.zshrc)
`export JUNIT_HOME="$HOME/java"`
`export PATH="$PATH:$JUNIT_HOME"`
`export CLASSPATH="$CLASSPATH:$JUNIT_HOME/junit-4.12.jar:$JUNIT_HOME/hamcrest-core-1.3.jar"`
Alias junit in zshrc: `alias junit="java org.junit.runner.JUnitCore"`
@wilon
wilon / vim-surround使用指南.MD
Last active March 11, 2025 04:30
vim-surround使用指南,vim-surround如何使用

普通模式

命令 说明 + 示例
ds 删除括号
ds " "Hello world!" =>
Hello world!
cs 替换括号
cs "( "Hello world!" =>
(Hello world!)
cS 替换括号,括号内文本做新一行
cS "{ "Hello world!" => {     Hello world! }
# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@"
}
@jboner
jboner / latency.txt
Last active December 10, 2025 03:43
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD