summaryrefslogtreecommitdiff
path: root/dotfiles/bashrc.sync
blob: 842211afc0999a8df302cd9c4dc4d122cadffed2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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
}