Skip to content

Instantly share code, notes, and snippets.

View gromgit's full-sized avatar
💭
🤔 🤣

Adrian Ho gromgit

💭
🤔 🤣
  • Singapore
  • 19:28 (UTC +08:00)
View GitHub Profile
@gromgit
gromgit / sharexec
Created August 2, 2024 07:54
sharexec - create a shar that also runs a specific executable bundled in the shar
#!/usr/bin/env bash
# USAGE: sharexec [-d <dir>] <executable> <file>... > my.sh
# Creates a shar file containing <executable> + all <file>s
# On execution:
# 1. unpack everything in <dir> (default: temp dir)
# 2. run <executable>
# 3. if temp dir used, remove it
warn() {
echo "WARNING: $*" >&2
@gromgit
gromgit / build_sqtcl
Last active February 18, 2025 15:52
building statically-linked tclsh with built-in SQLite
#!/usr/bin/env bash
fatal() {
printf 'FATAL ERROR: %s' "$*"
exit 1
}
base=tcl${ver:-9.0.1}
cd "$(dirname "$0")" || fatal "unable to cd to script dir"
instroot=$(pwd)/inst
[[ -s ${base}-src.tar.gz ]] || fatal "unable to find src tarball 'tcl${ver}-src.tar.gz'"
rm -fr build "$instroot" "$base"
#!/usr/bin/env bash
cmd() {
echo ">>> $(printf '%q ' "$@")" >&2
time "$@"
}
sqlite=/opt/homebrew/opt/sqlite/bin/sqlite3
csvs=(perfect_0.csv perfect_1.csv imperfect_2.csv)
# Generate CSVs
for i in $(seq -f %07.0f 9999999); do