fixup mail route going down, and switch mail with no internet
[distro-setup] / brc
diff --git a/brc b/brc
index e589dfb8a3740f35a400903fb1d8addc8614f92d..a4c0589d5c627920c30fe6869c1e71e70e9d57f4 100644 (file)
--- a/brc
+++ b/brc
@@ -112,13 +112,13 @@ if [[ $- == *i* ]]; then
         # sakura == xterm-256color
         # konsole == xterm
         if [[ $TERM == "xterm" ]]; then
-            # make ctrl-backspace work
-            stty werase '^?'
             # control + arrow keys. for other terminals, see http://unix.stackexchange.com/questions/10806/how-to-change-previous-next-word-shortcut-in-bash
             bind '"\e[1;5C": shell-forward-word' 2>/dev/null
             bind '"\e[1;5D": shell-backward-word' 2>/dev/null
         else
-            #stty werase '^h'
+            # make ctrl-backspace work. for konsole, i fixed it through
+# /home/iank/.local/share/konsole/default.keytab
+            stty werase '^h'
             bind '"\eOc": shell-forward-word'
             bind '"\eOd": shell-backward-word'
         fi
@@ -152,7 +152,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='k *:[ ]*'
+HISTIGNORE='pass *:k *:[ ]*'
 
 export BC_LINE_LENGTH=0
 
@@ -558,7 +558,7 @@ fa() {
 }
 
 faf() { # find all files
-    find -L $1 -type f -not \( -name .svn -prune -o -name .git -prune \
+    find -L $1 -not \( -name .svn -prune -o -name .git -prune \
          -o -name .hg -prune -o -name .editor-backups -prune \
          -o -name .undo-tree-history -prune \) 2>/dev/null
 }
@@ -568,9 +568,11 @@ fastboot() {
     /a/opt/android-platform-tools/fastboot "$@";
 }
 
+kdecd() { /usr/lib/x86_64-linux-gnu/libexec/kdeconnectd; }
 
 # List of apps to install/update
 # Create from existing manually installed apps by doing
+# fdroidcl update
 # fdroidcl search -i, then manually removing
 # automatically installed/preinstalled apps
 
@@ -589,8 +591,8 @@ fastboot() {
 # usually good enough to just rm -rf /data/app/APPNAME
 #
 # currently broken:
-#at.bitfire.davdroid
 fdroid_pkgs=(
+    at.bitfire.davdroid
     com.alaskalinuxuser.justnotes
     com.artifex.mupdfdemo
     com.fsck.k9
@@ -615,6 +617,7 @@ fdroid_pkgs=(
     org.quantumbadger.redreader
     org.smssecure.smssecure
     org.fedorahosted.freeotp
+    org.yaaic
 )
 # https://forum.xda-developers.com/android/software-hacking/wip-selinux-capable-superuser-t3216394
 # for maru,
@@ -951,6 +954,10 @@ else
     }
 fi
 
+ipdrop() {
+    s iptables -A INPUT -s $1 -j DROP
+}
+
 net-dev-info() {
     e "lspci -nnk|gr -iA2 net"
     lspci -nnk|gr -iA2 net
@@ -970,7 +977,7 @@ jtail() {
 }
 
 kff() { # keyboardio firmware flash
-    pushd /a/opt/sketches/Model01-Firmware
+    pushd /a/bin/distro-setup/Arduino/Model01-Firmware
     yes $'\n' | make flash
     popd
 }
@@ -1527,7 +1534,7 @@ t() {
      declare -gi _seq; _seq+=1
      echo "test body" | m mail -s "test mail from $HOSTNAME, $_seq" "${@:-root@localhost}"
      # for testing to send from an external address, you can do for example
-     # -aFrom:ian@iank.bid web-6fnbs@mail-tester.com
+     # -fian@iank.bid -aFrom:ian@iank.bid web-6fnbs@mail-tester.com
      # note in exim, you can retry a deferred message
      # s exim -M MSG_ID
      # MSG_ID is in /var/log/exim4/mainlog, looks like 1ccdnD-0001nh-EN
@@ -1602,7 +1609,7 @@ EOF
  tx() { # toggle set -x, and the prompt so it doesn't spam
         if [[ $- == *x* ]]; then
             set +x
-            PROMPT_COMMAND=prompt_command
+            PROMPT_COMMAND=prompt-command
         else
             unset PROMPT_COMMAND
             PS1="\w \$ "
@@ -1627,10 +1634,10 @@ m() { printf "%s\n" "$*";  "$@"; }
 
 
 vpncmd() {
-    m s nsenter -t $(pgrep -f "/usr/sbin/openvpn .* --config /etc/openvpn/client/client.conf") -n -m "$@"
+    m s nsenter -t $(pgrep -f "/usr/sbin/openvpn .* --config /etc/openvpn/.*client.conf") -n -m "$@"
 }
 vpnf() {
-    vpncmd gksudo -u ian "firefox -no-remote -P firefox-main-profile" &r
+    vpncmd gksudo -u iank "firefox -no-remote -P firefox-main-profile" &r
 }
 vpnbash() {
     vpncmd bash
@@ -1709,8 +1716,11 @@ vspicy() { # usage: VIRSH_DOMAIN
 wtr() { curl wttr.in/boston; }
 
 xl() {
-    # this succeeds even if gnome-screensaver isn\'t running.
+    if pgrep gnome-screensav &>/dev/null; then
+    # this command actually starts gnome-screensaver if it isn't running.
+    # lololol, what crap
     gnome-screensaver-command --exit &>/dev/null
+    fi
     mate-screensaver-command --exit &>/dev/null
     if ! pidof xscreensaver; then
         pushd /
@@ -1719,7 +1729,7 @@ xl() {
         # 1 was not long enough
         sleep 3
     fi
-    xscreensaver-command -lock
+    xscreensaver-command -activate
 }
 
 #############################
@@ -1856,22 +1866,15 @@ if [[ $- == *i* ]]; then
         PS1="\h $PS1"
     fi
 
-    prompt_command() {
+
+
+
+    prompt-command() {
         local return=$? # this MUST COME FIRST
         local psc pst ps_char ps_color stale_subvol
         unset IFS
         history -a # save history
 
-        # for titlebar
-        if [[ $TERM == *(screen*|xterm*|rxvt*) ]]; then
-            # from the screen man page
-            if [[ $TERM == screen* ]]; then
-                local title_escape="\033]..2;"
-            else
-                local title_escape="\033]0;"
-            fi
-           echo -ne "$title_escape${PWD/#$HOME/~}  $USER@$HOSTNAME\007"
-       fi
 
 
         case $return in
@@ -1901,18 +1904,36 @@ if [[ $- == *i* ]]; then
         # emacs completion doesn't like the git prompt atm, so disabling it.
         #PS1="${PS1%"${PS1#*[wW]}"}$(__git_ps1 ' (%s)') \[$ps_color\]$ps_char\[$(get_term_color nocolor)\] "
     }
-    PROMPT_COMMAND=prompt_command
+    PROMPT_COMMAND=prompt-command
+
+    settitle () {
+        if [[ $TERM == screen* ]]; then
+            local title_escape="\033]..2;"
+        else
+            local title_escape="\033]0;"
+        fi
+        if [[ $* != prompt-command ]]; then
+           echo -ne "$title_escape$USER@$HOSTNAME ${PWD/#$HOME/~} $*\007"
+        fi
+    }
+
+    # for titlebar
+    # condition from the screen man page i think
+    if [[ $TERM == *(screen*|xterm*|rxvt*) ]]; then
+        trap 'settitle "$BASH_COMMAND"' DEBUG
+    else
+        trap DEBUG
+    fi
+
 fi
 
 reset-konsole() {
     # we also have a file in /a/c/...konsole...
-    setini ShowMenuBarByDefault false KonsoleWindow $HOME/.config/konsolerc
-        while read k v; do
-            setini $k $v TabBar $HOME/.config/konsolerc
-        done <<'EOF'
-TabBarVisibility ShowTabBarWhenNeeded
-TabBarPosition Top
-EOF
+    local f=$HOME/.config/konsolerc
+    setini DefaultProfile profileian.profile "Desktop Entry" $f
+    setini Favorites profileian.profile "Favorite Profiles" $f
+    setini ShowMenuBarByDefault false KonsoleWindow $f
+    setini TabBarPosition Top TabBar $f
 }
 
 reset-sakura() {
@@ -1929,6 +1950,25 @@ scrollbar true
 EOF
 }
 
+reset-xscreensaver() {
+    # except for spash, i set these by setting gui options in
+    # xscreensaver-command -demo
+    # then finding the corresponding option in .xscreensaver
+    # spash, i happened to notice in .xscreensaver
+    cat > /home/iank/.xscreensaver <<'EOF'
+mode:          blank
+dpmsEnabled:   True
+dpmsStandby:   0:01:00
+dpmsSuspend:   0:01:00
+dpmsOff:       0:02:00
+timeout:       0:01:00
+lock:           True
+lockTimeout:   0:02:00
+splash:                False
+EOF
+
+}
+
 
 ###########################################
 # stuff that makes sense to be at the end #