aboutsummaryrefslogtreecommitdiff
path: root/shenanigans.sh
diff options
context:
space:
mode:
Diffstat (limited to 'shenanigans.sh')
-rwxr-xr-xshenanigans.sh128
1 files changed, 128 insertions, 0 deletions
diff --git a/shenanigans.sh b/shenanigans.sh
new file mode 100755
index 0000000..040f8bc
--- /dev/null
+++ b/shenanigans.sh
@@ -0,0 +1,128 @@
1# Software list.
2# cifs-utils tree jq xmlstarlet s3cmd xclip neovim mc gnupg
3# tilix fzf ripgrep
4
5# Magical environment variables.
6
7NIX_SHELL_PRESERVE_PROMPT=1
8TERM=xterm-256color
9EDITOR=vim
10
11# Better prompt.
12
13parse_git_branch() {
14 git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
15}
16
17is_inside_nix_shell() {
18 nix_shell_name="$(basename "$IN_NIX_SHELL" 2>/dev/null)"
19 if [[ -n "$nix_shell_name" ]]; then
20 echo " \e[0;36m(nix-shell)\e[0m"
21 fi
22}
23
24export PS1="[\033[38;5;9m\]\u@\h\[$(tput sgr0)\]]$(is_inside_nix_shell)\[\033[33m\]\$(parse_git_branch)\[\033[00m\] \w\[$(tput sgr0)\] \n$ "
25
26# General aliases.
27
28alias c='clear'
29alias l='ls -lh'
30alias ll='ls -lha'
31alias t='tree -L 2'
32alias ..='cd ..'
33alias h='history'
34alias x='exit'
35alias grep='grep --color=always'
36alias less='less -R'
37alias e='emacs'
38alias n='nvim'
39alias gg='lazygit'
40alias gt='git-town'
41alias server='python3 -m http.server 6969'
42
43# Custom folder jump commands.
44
45alias p='cd ~/Vault/projects'
46alias j='cd ~/Junk'
47alias d='cd ~/Downloads'
48alias v='cd ~/Vault'
49
50# Additional path settings.
51
52export PATH=$HOME/Vault/bin:$PATH
53export PATH=$HOME/Applications:$PATH
54export PATH=$HOME/.local/bin:$PATH
55export PATH=$HOME/go/bin:$PATH
56
57export PATH=$HOME/Android/Sdk/platform-tools:$PATH
58export PATH=$HOME/Android/Sdk/tools:$PATH
59
60# History and search.
61
62HISTCONTROL=ignoreboth
63shopt -s histappend
64export HISTSIZE=
65export HISTFILESIZE=
66export HISTFILE=~/.bash_history_infinite
67PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"
68bind '"\e[A": history-search-backward'
69bind '"\e[B": history-search-forward'
70alias hh=hstr
71export HSTR_CONFIG=hicolor
72if [[ $- =~ .i. ]]; then bind '"\C-h": "\C-a hstr -- \C-j"'; fi
73
74# Useful function. Much wow!
75
76backup() {
77 VHOME=/home/$USER/Vault
78 ME=$(whoami)@$(hostname)
79
80 mkdir -p $VHOME/dotfiles
81 cd $VHOME/dotfiles
82
83 # Make a copy of dotfiles.
84 cp /home/$USER/.shenanigans.sh shenanigans.sh
85 cp /home/$USER/.bash_history bash_history
86 cp /home/$USER/.bash_history_infinite bash_history_infinite
87 cp /home/$USER/.smbcredentials smbcredentials
88 cp /home/$USER/.gitconfig gitconfig
89 cp /home/$USER/.s3cfg s3cfg
90
91 cp /home/$USER/.vimrc vimrc
92 cp /home/$USER/.config/nvim/init.lua neovim.lua
93 cp /home/$USER/.config/emacs/init.el init.el
94
95 cp -Rf /home/$USER/.ssh/ ./
96 cp -Rf /home/$USER/.aws/ ./
97
98 dconf dump /com/gexperts/Tilix/ > tilix.dconf
99 # dconf load /com/gexperts/Tilix/ < tilix.dconf
100
101 # Backup screenshots.
102 mkdir -p $VHOME/pictures
103 cp -rfn ~/Pictures/* $VHOME/pictures/
104
105 # Backup screencasts.
106 mkdir -p $VHOME/videos
107 cp -rfn ~/Videos/* $VHOME/videos/
108
109 # Sync with NAS.
110 rsync -azv \
111 --exclude '.venv/' \
112 --exclude '.git/' \
113 --exclude 'node_modules/' \
114 --delete \
115 $VHOME/ /media/Void/Backup/$ME/
116
117 # Sync to off-site DO S3 bucket.
118 s3cmd sync \
119 --host-bucket=vault \
120 --delete-removed \
121 --exclude 'node_modules/*' \
122 --exclude '.git/*' \
123 --exclude '.venv/*' \
124 $VHOME/ s3://vault/backup/$ME/
125
126 # Add to log file.
127 echo `date +"%D %T"` >> ~/.vault.log
128}