X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;ds=sidebyside;f=brc;h=4e02122cccc6f72ae3d3acf9b882783b692ec455;hb=06a56540b041accaaff795ad57664e368cb07a10;hp=ddb6e79b9bfb496557c7b36f03a7eacec5e9f211;hpb=8796be333861fd2edc6c8b9b4c22307c11fce409;p=distro-setup diff --git a/brc b/brc index ddb6e79..4e02122 100644 --- a/brc +++ b/brc @@ -712,7 +712,7 @@ for field in {1..20}; do done # h1 = head -n1 for num in {1..9}; do - eval h$num"() { head -n$num; }" + eval h$num"() { head -n$num || [[ \$? == 141 ]]; }" done @@ -1590,6 +1590,8 @@ pst() { pstree -apnA } +# journalctl with times in the format the --since= and --until= options accept +jrt() { journalctl -e -n100000 -o short-full "$@"; } jr() { journalctl -e -n100000 "$@" ; } jrf() { journalctl -n1000 -f "$@" ; } jru() { @@ -1706,6 +1708,11 @@ histrm() { history -w } +# history without the date +histplain() { + history "$@" | cut -d' ' -f 7- +} + ccomp grep k ks ksu histrm @@ -1749,6 +1756,14 @@ nags() { fi /usr/bin/nagstamon & } +prof() { + if ! pgrep -f /usr/lib/notification-daemon/notification-daemon >/dev/null; then + /usr/lib/notification-daemon/notification-daemon & + fi + profanity "$@" +} + + nmt() { # cant use s because sudo -i doesnt work for passwordless sudo command @@ -2121,10 +2136,17 @@ sk() { # see bash-template/style-guide.md for justifications local quotes others - quotes=2048,2068,2086,2206 + quotes=2048,2068,2086,2206,2254 others=2029,2033,2054,2164 shellcheck -W 999 -x -e $quotes,$others "$@" || return $? } +# sk with quotes. For checking scripts that we expect to take untrusted +# input in order to verify we quoted vars. +skq() { + local others + others=2029,2033,2054,2164 + shellcheck -W 999 -x -e $others "$@" || return $? +} skgit() { local f @@ -2696,6 +2718,34 @@ spark() pdfwc() { local f; for f; do echo "$f" "$(pdfinfo "$f" | awk '/^Pages:/ {print $2}')"; done } + +# nvm install script appended this to my .bashrc. I dont want to run it all the time, +# so put it in a function. +nvm-init() { + export NVM_DIR="$HOME/.nvm" + # shellcheck disable=SC1091 # may not exist, & third party + [ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" # This loads nvm + # shellcheck disable=SC1091 # may not exist, & third party + [ -s "$NVM_DIR/bash_completion" ] && source "$NVM_DIR/bash_completion" # This loads nvm bash_completion +} + + +leap-year() { + if date -d 'february 29' &>/dev/null; then + year_days=366 + else + year_days=365 + fi + echo $year_days +} + +# on-battery +on-bat() { + if [[ -e /sys/class/power_supply/AC/online && $(