Skip to content
Snippets Groups Projects
Commit 1c8bad38 authored by nimrod's avatar nimrod
Browse files
- Added monitor alias to notify on command finish or failure.
- Better use of Python's json.tool.
- Little tweaks.
parent b21663f5
No related branches found
No related tags found
No related merge requests found
...@@ -43,6 +43,7 @@ export LESS_TERMCAP_us=$'\E[01;32m' ...@@ -43,6 +43,7 @@ export LESS_TERMCAP_us=$'\E[01;32m'
export LESS_TERMCAP_ue=$'\E[0m' export LESS_TERMCAP_ue=$'\E[0m'
export PS0="\$(__prerun)" export PS0="\$(__prerun)"
export PS1="\$(__prompt)\u@\h:\w\$ " export PS1="\$(__prompt)\u@\h:\w\$ "
export CDPATH="$HOME/Documents:$HOME/Documents/Shore:$HOME/Documents/Bullguard"
alias ll='ls -lha' alias ll='ls -lha'
alias la='ls -A' alias la='ls -A'
...@@ -62,14 +63,18 @@ alias deconcat="perl -pe 's/\\\n/\n/g'" ...@@ -62,14 +63,18 @@ alias deconcat="perl -pe 's/\\\n/\n/g'"
alias ecr-login='eval $(aws ecr get-login --no-include-email)' alias ecr-login='eval $(aws ecr get-login --no-include-email)'
alias hostlocal='docker run --rm --privileged --net=host gliderlabs/hostlocal' 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 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 __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="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 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 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 httpbin='gunicorn httpbin:app'
alias update-requirements='find -name "*requirements*.txt" -exec pur --requirement {} \;' 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 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 # shellcheck disable=SC2142
alias tolower='awk "{print tolower(\$0)}"' alias tolower='awk "{print tolower(\$0)}"'
# shellcheck disable=SC2142 # shellcheck disable=SC2142
...@@ -86,13 +91,25 @@ alias todo="vim \$HOME/Documents/TODO.yml" ...@@ -86,13 +91,25 @@ alias todo="vim \$HOME/Documents/TODO.yml"
alias sudo="sudo " alias sudo="sudo "
alias presentation='docker dev adarnimrod/presentation' 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 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 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 screenshot-cleanup='find "$HOME/Pictures" -name "Screenshot from *.png" -delete'
alias bell='printf \a' 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 () { prune_prerun () {
local shell_procs="$(pgrep -u "$(id -u)" "$(basename $SHELL)")" local shell_procs="$(pgrep -u "$(id -u)" "$(basename $SHELL)")"
for file in $HOME/.prerun.* for file in $HOME/.prerun.*
...@@ -167,7 +184,7 @@ gen_csr () { ...@@ -167,7 +184,7 @@ gen_csr () {
openssl req -new -newkey rsa:4096 -nodes -out "$1.csr" -keyout "$1.key" openssl req -new -newkey rsa:4096 -nodes -out "$1.csr" -keyout "$1.key"
} }
sync_comics () { __sync_comics () {
local this_month last_month format local this_month last_month format
format='+xbmc.shore.co.il:/srv/library/Comics/0-Day\ Week\ of\ %Y.%m.*' format='+xbmc.shore.co.il:/srv/library/Comics/0-Day\ Week\ of\ %Y.%m.*'
this_month="$( date "$format" )" this_month="$( date "$format" )"
......
[apply]
whitespace = fix
[alias] [alias]
amend = commit --amend amend = commit --amend
autorebase = -c 'core.editor=true' rebase -i --autosquash --autostash autorebase = -c 'core.editor=true' rebase -i --autosquash --autostash
...@@ -27,7 +29,11 @@ ...@@ -27,7 +29,11 @@
trigger = !git commit --allow-empty --no-edit --amend && git pushes --force-with-lease trigger = !git commit --allow-empty --no-edit --amend && git pushes --force-with-lease
[color] [color]
grep = true grep = true
ui = auto
[core]
whitespace = space-before-tab,-indent-with-non-tab,trailing-space
[diff] [diff]
renames = copies
tool = meld tool = meld
[difftool] [difftool]
prompt = false prompt = false
......
$include /etc/inputrc $include /etc/inputrc
set completion-ignore-case on
set show-all-if-ambiguous on
set visible-stats on
set skip-completed-text on set skip-completed-text on
set colored-stats on set colored-stats on
set colored-completion-prefix on set colored-completion-prefix on
......
bind-key b send-prefix bind-key b send-prefix
set -g set-titles on
set -g set-titles-string '#T'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment