X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=blobdiff_plain;f=brc;h=046edbed75a35594cde84f4cc3101bf8e9e5e7bd;hp=9ec776de13572d0e3afca8b8d49d2564f9af3359;hb=b857462732e15f455e41f26e3048a390d7b399c0;hpb=f0a35267f28e274ef3c2f63ffc20a26ca864e37c diff --git a/brc b/brc index 9ec776d..046edbe 100644 --- a/brc +++ b/brc @@ -7,10 +7,7 @@ # trap 'trap ERR' RETURN - -############ -# settings # -############ +# * settings CDPATH=. @@ -109,6 +106,10 @@ if [[ $- == *i* ]]; then bind 'set print-completions-horizontally on' bind '"\C-i": self-insert' else + + # todo: not sure this works in sakura + #stty werase undef + #bind "\C-w": kill-region # sakura == xterm-256color # konsole == xterm if [[ $TERM == "xterm" ]]; then @@ -152,7 +153,7 @@ HISTCONTROL=ignoredups # works in addition to HISTCONTROL to do more flexible things # it could also do the same things as HISTCONTROL and thus replace it, # but meh. dunno why, but just " *" does glob expansion, so use [ ] to avoid it. -HISTIGNORE='pass *:k *:[ ]*' +HISTIGNORE='pass *:k *:[ ]*:lom ' export BC_LINE_LENGTH=0 @@ -163,9 +164,7 @@ export BC_LINE_LENGTH=0 C_DEFAULT_DIR=/a -################### -## include files ### -################### +# * include files for _x in /a/bin/distro-functions/src/* /a/bin/!(githtml)/*-function?(s); do source "$_x" done @@ -182,9 +181,7 @@ _x=/usr/share/wcd/wcd-include.sh if [[ -e $_x ]]; then source $_x; fi -############### -### aliases ### -############### +# * aliases # very few aliases, functions are always preferred. @@ -210,15 +207,7 @@ unalias ls ll grep &>/dev/null ||: - - - - - - -##################### -### functions #### -##################### +# * functions ..() { c ..; } @@ -865,6 +854,11 @@ gdkill() { pk1 emacs --daemon } +# at least in flidas, things rely on gpg being gpg1 +gpg() { + command gpg2 "$@" +} + gse() { git send-email --notes '--envelope-sender=' \ --suppress-cc=self "$@" @@ -876,20 +870,24 @@ gr() { grr() { if [[ ${#@} == 1 ]]; then - grep -riIP --color=auto "$@" . + grep --exclude-dir='*.emacs.d' --exclude-dir='*.git' -riIP --color=auto "$@" . else - grep -riIP --color=auto "$@" + grep --exclude-dir='*.emacs.d' --exclude-dir='*.git' -riIP --color=auto "$@" fi } hstatus() { # do git status on published repos cd /a/bin/githtml - for x in !(forks) forks/* ian-specific/*; do + do_hr=false + for x in *; do cd `readlink -f $x`/.. - hr - echo $x - i status + status=$(i status -s) || pwd + if [[ $status ]]; then + hr + echo $x + printf "%s\n" "$status" + fi cd /a/bin/githtml done } @@ -1020,8 +1018,32 @@ l() { lcn() { locate -i "*$**"; } +lt() { ll -tr "$@"; } + lld() { ll -d "$@"; } +lom() { + local l base + if [[ $1 == /* ]]; then + l=$(sudo losetup -f) + sudo losetup $l $1 + base=${1##*/} + if ! sudo cryptsetup luksOpen $l $base; then + sudo losetup -d $l + return 1 + fi + sudo mkdir -p /mnt/$base + sudo mount /dev/mapper/$base /mnt/$base + sudo chown $USER:$USER /mnt/$base + else + base=$1 + sudo umount /mnt/$base + l=$(sudo cryptsetup status /dev/mapper/$base|sed -rn 's/^\s*device:\s*(.*)/\1/p') + sudo cryptsetup luksClose /dev/mapper/$base + sudo losetup -d $l + fi +} + low() { # make filenames lowercase, remove bad chars local f new for f in "$@"; do @@ -1082,6 +1104,7 @@ mbdisable() { set +x } + mdt() { markdown "$1" >/tmp/mdtest.html firefox /tmp/mdtest.html @@ -1103,10 +1126,17 @@ mkdir() { command mkdir -p "$@"; } mo() { xset dpms force off; } # monitor off + +nopanic() { + sudo tee -a /var/log/exim4/paniclog-archive