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'
# 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"
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
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
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.
cryptsetup luksClose "$arg"
}
-# crypt open
+# crypt open. just to save typing.
crypto() {
cryptsetup luksOpen "$@"
}
##### 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,
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
#####