From: Ian Kelling Date: Wed, 29 Apr 2026 15:25:53 +0000 (-0400) Subject: minor improvements X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=d6742c1bb5847dea37f85eaac2cb9fa6bec102c1;p=distro-setup minor improvements --- diff --git a/.gitconfig b/.gitconfig index 9d45ab5..16b148c 100644 --- a/.gitconfig +++ b/.gitconfig @@ -3,12 +3,14 @@ name = Ian Kelling email = iank@fsf.org #email = ian@iankelling.org [alias] -lg = log --graph --follow -lgstat = log --stat --graph --follow --pretty=format:'%h %ad- %s [%an]' +lg = log --graph +lgstat = log --stat --graph --pretty=format:'%h %ad- %s [%an]' +# stat without showing modification of existing files. ARCD = Added, Removed, Copied, Deleted. +lgstat-m = log --stat --graph --pretty=format:'%h %ad- %s [%an]' --diff-filter=ARCD co = checkout s = status ci = commit -lol = log --graph --follow --pretty=oneline --abbrev-commit --all +lol = log --graph --pretty=oneline --abbrev-commit --all dt = difftool # https://stackoverflow.com/questions/17369254/is-there-a-way-to-cause-git-reflog-to-show-a-date-alongside-each-entry rl = reflog --format='%C(auto)%h %<|(17)%gd %C(blue)%ci%C(reset) %s' diff --git a/.psqlrc b/.psqlrc index f59b3a2..be763a5 100644 --- a/.psqlrc +++ b/.psqlrc @@ -1,2 +1,17 @@ --- wraps long columns. so nice. -\pset format wrapped +\set QUIET on + +-- reminder comment for occasionally useful setting to make nulls displayed explicitly. +-- \pset null '.n_.' + +-- occasionally useful setting when optimizing queries, print the time of each query: +-- \timing on + +\set HISTSIZE 500000 +\set HISTCONTROL ignoredups +\set ON_ERROR_STOP on +-- auto switch to \x when results are too wide to fix +\x auto +-- alternative to x auto, this wraps long columns. +--\pset format wrapped + +\unset QUIET diff --git a/.sqliterc b/.sqliterc index 6f7d58d..733e873 100644 --- a/.sqliterc +++ b/.sqliterc @@ -1 +1,3 @@ -.timeout 6000 +.output /dev/null +.timeout 20000 +.output stdout diff --git a/beetag b/beetag index 38eb1cc..f81aaab 100755 --- a/beetag +++ b/beetag @@ -354,6 +354,8 @@ beetag-track-select() { beetag-usage() { cat <<'EOF' +#### note: the central place for my beets docs is in t.org + tag with beets. usage: beetag [OPTIONS] QUERY diff --git a/big.sqliterc b/big.sqliterc index 58051fb..6fe2769 100644 --- a/big.sqliterc +++ b/big.sqliterc @@ -5,6 +5,7 @@ -- 0 = OFF 1 = NORMAL 2 = FULL .output /dev/null +.timeout 60000 PRAGMA synchronous = NORMAL; PRAGMA journal_size_limit = 6144000; PRAGMA temp_store = MEMORY; diff --git a/brc b/brc index bdfbaca..61672d6 100644 --- a/brc +++ b/brc @@ -1165,13 +1165,8 @@ c4() { c /var/log/exim4; } # commit all amend caa() { git commit --amend --no-edit -a; } -# cat + hr all files found by find. -caf() { - local file - find -L "$@" -type f -not \( -name .svn -prune -o -name .git -prune \ - -o -name .hg -prune -o -name .editor-backups -prune \ - -o -name .undo-tree-history -prune \) -printf '%h\0%d\0%p\n' | sort -t '\0' -n \ - | awk -F '\0' '{print $3}' 2>/dev/null | while read -r file; do +catf-pretty() { + for file; do hr "$file" if type -p v &>/dev/null; then v "$file" @@ -1185,6 +1180,31 @@ caf() { fi done } +# cat + hr all files found by find. But if we just pass files, skip the find. +caf() { + local file arg only_file_args=true + + if (( $# == 0 )); then only_file_args=false; fi + for arg; do + if [[ ! -f $arg ]]; then + only_file_args=false + break + fi + done + + if $only_file_args; then + catf-pretty "$@" + else + + + find -L "$@" -type f -not \( -name .svn -prune -o -name .git -prune \ + -o -name .hg -prune -o -name .editor-backups -prune \ + -o -name .undo-tree-history -prune \) -printf '%h\0%d\0%p\n' | sort -t '\0' -n \ + | awk -F '\0' '{print $3}' 2>/dev/null | while read -r file; do + catf-pretty "$file" + done + fi +} ccomp cat cf caf # calculator @@ -2332,13 +2352,15 @@ lowr() { done } -# note: this does not work for EOL chars. -# aka chomp in perl. note this doesn't work as you would want because its not a variable reference. todo: think about improving it. +# reminds me of chomp in perl. note this doesn't work as you would want +# because its not a variable reference. todo: think about improving it. strips() { # remove leading whitespace characters var="${var#"${var%%[![:space:]]*}"}" - # remove trailing whitespace characters + # Inner var expansion: get from var: right of the rightmost non-space + # char. Outer var expansion: remove that from the right. var="${var%"${var##*[![:space:]]}"}" + # } # make filenames lowercase, remove bad chars @@ -3129,11 +3151,12 @@ shk-p() { local fname="${1##*/}" [[ ! -L $1 && ( $fname == *.sh || $fname != *.* ) ]] && istext "$1" && [[ $(head -n1 "$1" 2>/dev/null) == '#!/bin/bash'* ]] } -# todo: update bash style guide with new exceptions +# todo: update bash style guide with new exceptions. +# note: I wouldn't recommend 2012 to others. shellcheck-except() { local quotes others - quotes=2048,2064,2068,2086,2119,2206,2254,2231 - others=2024,2029,2032,2033,2054,2164,2185,2190,2317 + quotes=2048,2064,2068,2086,2119,2206,2254,2231,2223 + others=2024,2029,2032,2033,2054,2164,2185,2190,2317,2012,2103 shellcheck -e $quotes,$others "$@" || return $? } # wrapper for shellcheck with better defaults. @@ -4865,7 +4888,7 @@ cryptc() { cryptsetup luksClose "$arg" } -# crypt open +# crypt open. just to save typing. crypto() { cryptsetup luksOpen "$@" } diff --git a/distro-end b/distro-end index a9eece0..1725cba 100755 --- a/distro-end +++ b/distro-end @@ -1713,6 +1713,7 @@ esac ##### begin beets ##### +#### note: the central place for my beets docs is in t.org ## note: begin u24 message upon pip install # If you wish to install a non-Debian-packaged Python package, @@ -2085,6 +2086,15 @@ if [[ ! -e /etc/apt/sources.list.d/pgdg.sources ]]; then fi # initial db creation with: # createdb -O iank db_name + + e "vm.hugetlb_shm_group=$(getent group postgres|awk -F : '{print $3}')" | sd /etc/sysctl.d/80-iank-hugepage-postgres.conf + sudo sysctl -p/etc/sysctl.d/80-iank-hugepage-postgres.conf + # total mem > 10g + if (( $(free -m|a2| sed -n 2p) > 10000 )); then + : + # if we get oomed, try enabling this in sysctl to disable overcommit. + # vm.overcommit_memory = 2 + fi fi ##### diff --git a/fast.sqliterc b/fast.sqliterc index 8bc9da3..78692c7 100644 --- a/fast.sqliterc +++ b/fast.sqliterc @@ -1,4 +1,5 @@ .output /dev/null +.timeout 20000 -- note: this causes sqlite cli to print "memory" PRAGMA journal_mode = MEMORY; PRAGMA synchronous = OFF; diff --git a/filesystem/etc/sysctl.d/iank.conf b/filesystem/etc/sysctl.d/iank.conf index 6442b2e..2a30cf4 100644 --- a/filesystem/etc/sysctl.d/iank.conf +++ b/filesystem/etc/sysctl.d/iank.conf @@ -2,3 +2,7 @@ # default is 120 and gets hit a lot with heavy io. kernel.hung_task_timeout_secs=600 + +# default is 50, preventing any app from commiting more than 50% of +# physical memory + swap. I want to allow memory hogs. +vm.overcommit_ratio=100 diff --git a/filesystem/etc/systemd/system/postgresql@18-main.service.d/iank.conf b/filesystem/etc/systemd/system/postgresql@18-main.service.d/iank.conf new file mode 100644 index 0000000..4e78c71 --- /dev/null +++ b/filesystem/etc/systemd/system/postgresql@18-main.service.d/iank.conf @@ -0,0 +1,6 @@ +[Service] +# enables using static hugepages. +# default on t12: cat /proc/POSTGRES_PID/limits , Max locked memory = 8mb +LimitMEMLOCK=infinity +# not sure this is really needed, but supposedly this ensures postgres uses static huge pages. +ExecStartPre=/bin/sh -c 'echo never | tee /sys/kernel/mm/transparent_hugepage/defrag /sys/kernel/mm/transparent_hugepage/enabled >/dev/null' diff --git a/subdir_files/.config/konsolerc b/subdir_files/.config/konsolerc index 6a1f4e9..310d7bf 100644 --- a/subdir_files/.config/konsolerc +++ b/subdir_files/.config/konsolerc @@ -23,10 +23,10 @@ ShowMenuBarByDefault=false 2 screens: Width=1916 2 screens: XPosition=2 2 screens: YPosition=2 -3840x2160 screen: Height=1718 -3840x2160 screen: Width=1276 -3840x2160 screen: XPosition=2562 -3840x2160 screen: YPosition=440 +3840x2160 screen: Height=2156 +3840x2160 screen: Width=3836 +3840x2160 screen: XPosition=2 +3840x2160 screen: YPosition=2 DP-0=DP-0 DP-1 eDP-1=DP-1 DP-1-1 eDP-1=DP-1-1