Skip to content

Instantly share code, notes, and snippets.

View xhd2015's full-sized avatar
๐Ÿ’
Working

xhd2015 xhd2015

๐Ÿ’
Working
View GitHub Profile
@xhd2015
xhd2015 / log_bash_history
Created July 30, 2025 12:07
Bash history recording and logging
After asked grok3 lots of options, the only one that works for me:
```sh
# log and append history while preserving $_
append_log_history() {
# Save the current $_
local saved_underscore="$_"
echo -n '' > /tmp/history$$
HISTFILE=/tmp/history$$ history -a
cat /tmp/history$$ >> "$BASH_HISTORY_BACKUP_FILE"
@xhd2015
xhd2015 / Dockerfile-build-git-static
Last active September 30, 2025 10:31
Cross build git for linux/amd64 on MacOS M1, using podman
# Stage 1: The Builder
# Use a Ubuntu latest(24.04) base image, specifying the target architecture.
FROM --platform=linux/amd64 ubuntu:latest AS builder
# debug info
# RUN lsb_release -c
RUN cat /etc/os-release
# add deb-src to sources.list so that we can build git from source code
RUN echo "deb-src http://archive.ubuntu.com/ubuntu/ noble main restricted universe multiverse" >> /etc/apt/sources.list