Skip to content

Instantly share code, notes, and snippets.

@knadh
knadh / go-graceful-reload.go
Last active July 14, 2020 05:30
Example of gracefully shutting down and re-loading / restarting a Go app on SIGHUP retaining the same PID
// program
package main
import (
"fmt"
"log"
"os"
"os/signal"
"syscall"
"time"
@junegunn
junegunn / gist:f4fca918e937e6bf5bad
Last active May 24, 2024 02:07
Browsing git commit history with fzf
# fshow - git commit browser (enter for show, ctrl-d for diff, ` toggles sort)
fshow() {
local out shas sha q k
while out=$(
git log --graph --color=always \
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
fzf --ansi --multi --no-sort --reverse --query="$q" \
--print-query --expect=ctrl-d --toggle-sort=\`); do
q=$(head -1 <<< "$out")
k=$(head -2 <<< "$out" | tail -1)