misc improvements
[distro-setup] / brc
diff --git a/brc b/brc
index 16b7eb74e341abfb8a3c08da20ee72084ac2775f..6389c0466b5ce31d4f602f672c7da95cbbe2755b 100644 (file)
--- a/brc
+++ b/brc
@@ -147,13 +147,13 @@ HISTFILE=$HOME/.bh
 # the time format display when doing the history command
 # also, setting this makes the history file record time
 # of each command as seconds from the epoch
-HISTTIMEFORMAT="%I:%M %p %m/%d "
+HISTTIMEFORMAT="%Y-%m-%d %I:%M %p "
 # consecutive duplicate lines dont go in history
 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 *:[ ]*:lom '
+HISTIGNORE='pass *:[ ]*:lom '
 
 export BC_LINE_LENGTH=0
 
@@ -440,6 +440,7 @@ cgpl()
     cp /a/bin/data/COPYING .
   fi
 }
+
 capache()
 {
   if (($#)); then
@@ -448,6 +449,20 @@ capache()
     cp /a/bin/data/LICENSE .
   fi
 }
+
+cat-new-files() {
+  local start=$SECONDS
+  local dir="$1"
+  inotifywait -m "$dir" -e create -e moved_to |
+    while read filedir _ file; do
+      cat "$filedir$file"
+      hr
+      calc $((SECONDS - start)) / 60
+      sleep 5
+    done
+
+}
+
 chown() {
   # makes it so chown -R symlink affects the symlink and its target.
   if [[ $1 == -R ]]; then
@@ -1003,6 +1018,7 @@ ic() {
   git commit -am "$*"
 }
 
+
 idea() {
   /a/opt/idea-IC-163.7743.44/bin/idea.sh "$@" &r
 }
@@ -1079,6 +1095,8 @@ l() {
 
 lcn() { locate -i "*$**"; }
 
+lg() { LC_COLLATE=C.UTF-8 ll --group-directories-first; }
+
 lt() { ll -tr "$@"; }
 
 lld() { ll -d "$@"; }
@@ -1149,6 +1167,7 @@ mbenable() {
   dst=/m/4e/$1
   src=/m/md/$1
   set -x
+  [[ -e $src ]] || { set +x; return 1; }
   mv -T $src $dst || { set +x; return 1; }
   ln -s -T $dst $src
   /a/exe/lnf /p/.mu ~
@@ -1160,6 +1179,7 @@ mbdisable() {
   dst=/m/md/$1
   src=/m/4e/$1
   set -x
+  [[ -e $src ]] || { set +x; return 1; }
   if [[ -L $dst ]]; then rm $dst; fi
   mv -T $src $dst
   set +x
@@ -1443,6 +1463,13 @@ ser() {
     $s service $2 $1
   fi
 }
+# like restart, but do nothing if its not already started
+srestart() {
+  local service=$1
+  if [[ $(s systemctl --no-pager show -p ActiveState $service ) == ActiveState=active ]]; then
+    systemctl restart $service
+    fi
+}
 serstopnm() {
   ser stop NetworkManager
   ser stop dnsmasq
@@ -1550,6 +1577,10 @@ splay() { # script replay
   scriptreplay "$1.t" "$1.s"
 }
 
+smeld() { # usage host1 host2 file
+  meld <(ssh $1 cat $3) <(ssh $2 cat $3)
+}
+
 spd() {
   PATH=/usr/local/spdhackfix:$PATH command spd "$@"
 }
@@ -1881,6 +1912,9 @@ vspicy() { # usage: VIRSH_DOMAIN
                sed -r "s/.*port='([0-9]+).*/\1/")
 }
 
+wian() {
+  cat-new-files /m/4e/INBOX/new
+}
 
 wtr() { curl wttr.in/boston; }