diff options
author | Blaise Thompson <blaise@untzag.com> | 2018-07-02 21:18:45 -0500 |
---|---|---|
committer | Blaise Thompson <blaise@untzag.com> | 2018-07-02 21:18:45 -0500 |
commit | 7bcb0b78ce9e70b5e09ed84677742357ffdd3709 (patch) | |
tree | e33afbc154c0c302b78c7888d9e019b77df6340a /bash | |
parent | 4fda7b1b6eb947fbf0c9d8e2fe654d4db039401b (diff) |
2018-07-02 21:18
Diffstat (limited to 'bash')
-rw-r--r-- | bash/bashrc.sync | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/bash/bashrc.sync b/bash/bashrc.sync new file mode 100644 index 0000000..842211a --- /dev/null +++ b/bash/bashrc.sync @@ -0,0 +1,76 @@ +export PS1="\[\033[01;32m\]\u@\h \W \\$ \[$(tput sgr0)\]\[\033[0m\]" + +export VISUAL=vim +export EDITOR="$VISUAL" +export LEDGER_FILE="~/ledger/main.ledger" + +# --- aliases ------------------------------------------------------------------------------------- + +alias ledger='ledger --date-format "%Y-%m-%d"' + +alias ledger-cash='ledger register cash --tail 15' + +alias ledger-checking='ledger register checking --tail 15' + +alias ledger-worth='ledger bal ^assets ^liabilities' + +# --- functions ----------------------------------------------------------------------------------- + +function countdown(){ + secs=$(($1 * 60)); + date1=$((`date +%s` + "$secs")); + while [ "$date1" -ge `date +%s` ]; do + echo -ne "$(date -u --date @$(($date1 - `date +%s`)) +%H:%M:%S)\r"; + sleep 0.1 + done +} + +function git-commit-with-timestamp(){ + print-green $(pwd) + git remote update + git pull + if ! git diff --quiet + then + echo "COMMITING" + git add --all + git commit -m "$(date +"%Y-%m-%d %H:%M")" + git push + fi +} + +function git-sync-all(){ + while read -r line + do + print-line + cd "$line" + git-commit-with-timestamp + done < ~/.git-synced + cd ~ +} + +function print-cyan { + CYAN='\033[0;36m' + NC='\033[0m' # No Color + printf "${CYAN}$*${NC}\n" +} + + +function print-green { + GREEN='\033[0;32m' + NC='\033[0m' # No Color + printf "${GREEN}$*${NC}\n" +} + +function print-line { + print-green "%`tput cols`s"|tr ' ' '#' +} + +function print-yellow { + YELLOW='\033[0;33m' + NC='\033[0m' # No Color + printf "${YELLOW}$*${NC}\n" +} + +function pip3-update-all { + pip3 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U +} |