From 1c8bad3898b6d2b598fe95f1044dff6adb4091d1 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Wed, 7 Mar 2018 18:25:15 +0200
Subject: [PATCH] Shameless rip from https://github.com/jessfraz/dotfiles. -
 Added monitor alias to notify on command finish or failure. - Better use of
 Python's json.tool. - Little tweaks.

---
 .bashrc    | 31 ++++++++++++++++++++++++-------
 .gitconfig |  6 ++++++
 .inputrc   |  3 +++
 .tmux.conf |  2 ++
 4 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/.bashrc b/.bashrc
index 42c1321..1738b45 100644
--- a/.bashrc
+++ b/.bashrc
@@ -43,6 +43,7 @@ export LESS_TERMCAP_us=$'\E[01;32m'
 export LESS_TERMCAP_ue=$'\E[0m'
 export PS0="\$(__prerun)"
 export PS1="\$(__prompt)\u@\h:\w\$ "
+export CDPATH="$HOME/Documents:$HOME/Documents/Shore:$HOME/Documents/Bullguard"
 
 alias ll='ls -lha'
 alias la='ls -A'
@@ -62,14 +63,18 @@ alias deconcat="perl -pe 's/\\\n/\n/g'"
 alias ecr-login='eval $(aws ecr get-login --no-include-email)'
 alias hostlocal='docker run --rm --privileged --net=host gliderlabs/hostlocal'
 alias cadvisor='docker run --rm   --volume=/:/rootfs:ro --volume=/var/run:/var/run:rw --volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:ro --volume=/dev/disk/:/dev/disk:ro --publish=8080:8080 --detach=true --name=cadvisor google/cadvisor:latest'
-alias apt-daily="sudo /bin/sh -c 'apt-get update && apt-get dist-upgrade --download-only --yes && apt-get autoclean'"
-alias flatpak-daily='flatpak --user update --no-deploy'
+alias __apt-daily="sudo /bin/sh -c 'apt-get update && apt-get dist-upgrade --download-only --yes && apt-get autoclean'"
+alias apt-daily="monitor __apt-daily"
+alias __flatpak-daily='flatpak --user update --no-deploy && notify-send "flatpak-daily has finished."'
+alias flatpak-daily="monitor __flatpak-daily"
 alias cdtemp='cd $(mktemp -d)'
 alias 0-day-cleanup='ssh xbmc.shore.co.il "sudo -u debian-transmission find /srv/library/Comics -name *.part -path *0-Day\ Week\ of* -delete"'
 alias httpbin='gunicorn httpbin:app'
 alias update-requirements='find -name "*requirements*.txt" -exec pur --requirement {} \;'
 alias restart-kodi='ssh xbmc.shore.co.il "sudo systemctl kill --kill-who all xorg.service"'
-alias sync-podcasts='(cd && unison podcasts)'
+alias __sync-podcasts='(cd && unison podcasts)'
+alias sync-podcasts='monitor __sync-podcasts'
+alias sync-comics='monitor __sync_comics'
 # shellcheck disable=SC2142
 alias tolower='awk "{print tolower(\$0)}"'
 # shellcheck disable=SC2142
@@ -86,13 +91,25 @@ alias todo="vim \$HOME/Documents/TODO.yml"
 alias sudo="sudo "
 alias presentation='docker dev adarnimrod/presentation'
 alias netdata='docker run --detach --name netdata --cap-add SYS_PTRACE --volume /proc:/host/proc:ro --volume /sys:/host/sys:ro --volume /var/run/docker.sock:/var/run/docker.sock --publish 19999:19999 firehol/netdata'
-alias json-tool='python3 -m json.tool'
-alias jt='json-tool'
+alias jt='json_tool'
 alias http-server='python3 -m http.server 8080'
-alias dd='dd status=progress'
+alias dd='monitor dd status=progress'
 alias screenshot-cleanup='find "$HOME/Pictures" -name "Screenshot from *.png" -delete'
 alias bell='printf \a'
 
+monitor () {
+    eval "$@" && notify-send "${1#__} has finished." || notify-send --urgency=critical "${1#__} has failed."
+}
+
+json_tool () {
+    if [ -t 0 ]
+    then
+        python3 -m json.tool <<< "$*" | pygmentize -l javascript
+    else
+        python3 -m json.tool | pygmentize -l javascript
+    fi
+}
+
 prune_prerun () {
     local shell_procs="$(pgrep -u "$(id -u)" "$(basename $SHELL)")"
     for file in $HOME/.prerun.*
@@ -167,7 +184,7 @@ gen_csr () {
     openssl req -new -newkey rsa:4096 -nodes -out "$1.csr" -keyout "$1.key"
 }
 
-sync_comics () {
+__sync_comics () {
     local this_month last_month format
     format='+xbmc.shore.co.il:/srv/library/Comics/0-Day\ Week\ of\ %Y.%m.*'
     this_month="$( date "$format" )"
diff --git a/.gitconfig b/.gitconfig
index 7eac9b0..085863c 100644
--- a/.gitconfig
+++ b/.gitconfig
@@ -1,3 +1,5 @@
+[apply]
+    whitespace = fix
 [alias]
     amend = commit --amend
     autorebase = -c 'core.editor=true' rebase -i --autosquash --autostash
@@ -27,7 +29,11 @@
     trigger = !git commit --allow-empty --no-edit --amend && git pushes --force-with-lease
 [color]
     grep = true
+    ui = auto
+[core]
+    whitespace = space-before-tab,-indent-with-non-tab,trailing-space
 [diff]
+    renames = copies
 	tool = meld
 [difftool]
 	prompt = false
diff --git a/.inputrc b/.inputrc
index fc02f73..ff79076 100644
--- a/.inputrc
+++ b/.inputrc
@@ -1,4 +1,7 @@
 $include  /etc/inputrc
+set completion-ignore-case on
+set show-all-if-ambiguous on
+set visible-stats on
 set skip-completed-text on
 set colored-stats on
 set colored-completion-prefix on
diff --git a/.tmux.conf b/.tmux.conf
index 4f0383f..4150f0e 100644
--- a/.tmux.conf
+++ b/.tmux.conf
@@ -1 +1,3 @@
 bind-key b send-prefix
+set -g set-titles on
+set -g set-titles-string '#T'
-- 
GitLab