Skip to content

Instantly share code, notes, and snippets.

View ormaaj's full-sized avatar

Daniel Douglas ormaaj

View GitHub Profile
sendfile is not supported for transport <_UnixWritePipeTransport fd=7 idle bufsize=0>
Traceback (most recent call last):
File "/usr/bin/entry/entry_point", line 109, in _run_python
exec(code, exec_scope) # pylint: disable=exec-used
^^^^^^^^^^^^^^^^^^^^^^
File "<string>", line 187, in <module>
File "/usr/local/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
@ormaaj
ormaaj / localopt.bash
Created October 29, 2025 12:57
simple shopt toggler
#!/usr/bin/env bash
shopt -s lastpipe extglob expand_aliases
function unset2 {
command unset "$@"
}
function localopt {
typeset IFS OPTARG REPLY r os=:v:uso
typeset -i i dn ret=0 OPTIND=1
@ormaaj
ormaaj / globsort.ksh
Created October 26, 2025 06:48
Numeric sort files matching a pattern (bash or ksh93)
if [[ -v KSH_VERSION ]]; then
typeset -n BASH_REMATCH=.sh.match
else
shopt -s extglob lastpipe
enable -f asort{,}
fi
touch file_{7..13}.pdf
unset -v a b
typeset -A a
@ormaaj
ormaaj / binutils
Last active September 30, 2025 21:25
ld xattr hooks
post_src_install() {
local -; set +o monitor -o pipefail
typeset k e r=${EROOT%%+(/)} cpn=${CATEGORY}/${PN}
e=${r:+${r}/}${ED%%+(/)}
typeset -A base=(
[sys-devel/binutils]=bfd
[sys-devel/mold]=mold
[llvm-core/lld]=lld
)
@ormaaj
ormaaj / tmux.conf
Created September 20, 2025 03:43
tmux.conf
# ~/.tmux.conf
if-shell \
'tput -T tmux-256color longname' \
'set -s default-terminal tmux-256color' \
'set -s default-terminal screen-256color'
%hidden trace='strace -DDYYyqqqf'
%hidden el=/usr/bin/execlineb
%hidden bash=/usr/bin/bash
mkfs.vfat -F 32 --codepage=437 -n ESP -- "${d}1"
mkswap -L swap2 --verbose -- "${d}2"
mkfs.btrfs -vf -O extref,skinny-metadata,no-holes -R quota,free-space-tree --csum xxhash -L ormaaj2 -- "${d}3"
@ormaaj
ormaaj / sudoers
Created August 12, 2025 10:43
sudoers
# /etc/sudoers
Defaults !pam_session
Defaults !pam_setcred
Defaults !use_pty
Defaults fdexec
Defaults closefrom_override
Defaults targetpw
root ALL=(ALL:ALL) ALL
ALL ALL=(ALL:ALL) ALL
@ormaaj
ormaaj / .ps
Last active July 23, 2025 20:35
msys2 launcher
PowerShell 7.6.0-preview.4
Loading personal and system profiles took 2730ms.
PS C:\Users\ormaaj> Start-Process -Wait -NoNewWindow -Environment ([Environment]::GetEnvironmentVariables() + @{ MSYSTEM = 'UCRT64'; MSYS2_NOSTART = 'yes'; LOGINSHELL = 'bash'; TERM = 'xterm-direct' }) -FilePath 'C:\msys64\usr\bin\env.exe' -ArgumentList ([string[]]@('-S-- BASH_COMPAT=51 /c/Users/ormaaj/startdbus.bash /ucrt64/bin/konsole.exe'))
+ m /ucrt64/bin/konsole.exe
+ local -
+ [[ m != \m\a\i\n ]]
+ set +m
+ typeset -x BASH_COMPAT=51
+ m
+ local -
@ormaaj
ormaaj / argv0match.bash
Last active September 19, 2025 15:52
pgrep but better
shopt -s lastpipe extglob
# return or write to stdout pids with argv[0]'s exactly matching any of the given arguments
# argv0match [ -v array ] names...
function argv0match {
local -; set +m
typeset OPTARG REPLY
typeset -i OPTIND=1
typeset -A opts
while getopts :v: REPLY; do
@ormaaj
ormaaj / copy_array.bash
Last active September 5, 2025 19:01
bash array copy (without @k)
#!/usr/bin/env bash
shopt -s lastpipe extglob expand_aliases
function copy_array {
((1 + ${#} % 2)) || return
typeset k s r
typeset -a v=(src ret)
IFS= read -d '' s <<-\EOF
[ "${!r}" = "$1" ${| unset -n r; } ]; \
typeset -Gn r=${v[$?]} \