Add new up/download scripts
- Author
- Maarten Vangeneugden
- Date
- Sept. 14, 2023, 3:09 p.m.
- Hash
- 6e024e5c239f16e575b758a28be43be2357406cf
- Parent
- 1493641f19a88c47a9924a866bc6a862e4881b88
- Modified files
- .zshrc
- download-changes.sh
- upload-changes.sh
.zshrc ¶
12 additions and 2 deletions.
View changes Hide changes
1 |
1 |
HISTFILE=~/.histfile |
2 |
2 |
HISTSIZE=1000 |
3 |
3 |
SAVEHIST=1000 |
4 |
4 |
bindkey -e |
5 |
5 |
# End of lines configured by zsh-newuser-install |
6 |
6 |
# The following lines were added by compinstall |
7 |
7 |
zstyle :compinstall filename $HOME+'/.zshrc' |
8 |
8 |
|
9 |
9 |
autoload -Uz compinit |
10 |
10 |
compinit |
11 |
11 |
# End of lines added by compinstall |
12 |
12 |
|
13 |
13 |
#By myself; these will explicitely tell ZSH to autoload this file. |
14 |
14 |
autoload -U promptinit |
15 |
15 |
promptinit |
16 |
16 |
|
17 |
17 |
#This is for colors: |
18 |
18 |
autoload -U colors && colors |
19 |
19 |
|
20 |
20 |
#This is for the Powerline font: |
21 |
21 |
# Eum, this doesn't work. commented out until further notice. |
22 |
22 |
#. /usr/share/zsh/site-contrib-powerline.zsh |
23 |
23 |
|
24 |
24 |
# Ignore useless files and directories: |
25 |
25 |
zstyle ':completion:*' ignored-patterns '*?.pyc' '__pycache__' '*?.class' 'Cargo.lock' |
26 |
26 |
|
27 |
27 |
# A list of aliases: |
28 |
28 |
|
29 |
29 |
alias install="pacaur -S" # Install a package. |
30 |
30 |
alias delete="pacaur -Rscu" # Delete a package and orphan dependencies/packages. |
31 |
31 |
# Opens the GNU Emacs client directly in the terminal like with Vim |
32 |
32 |
alias em="emacsclient -nw -s gnuemacs" |
33 |
- | |
+ |
33 |
|
34 |
34 |
# Set editor correctly |
35 |
35 |
export EDITOR="emacsclient -nw -s gnuemacs" |
36 |
- | |
+ |
36 |
|
37 |
37 |
# Settings that allow for my SSH keys to work through all terminals. |
38 |
38 |
# (Verbatim copied from Arch Wiki) |
39 |
39 |
if ! pgrep -u $USER ssh-agent > /dev/null; then |
40 |
40 |
ssh-agent > ~/.ssh-agent-thing |
41 |
41 |
fi |
42 |
42 |
if [[ "$SSH_AGENT_PID" == "" ]]; then |
43 |
43 |
eval $(<~/.ssh-agent-thing) |
44 |
44 |
fi |
45 |
45 |
ssh-add -l >/dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh' |
46 |
46 |
|
+ |
47 |
export PATH="$HOME/.cabal/bin:$HOME/.ghcup/bin:$PATH" |
+ |
48 |
|
+ |
49 |
# Some aliases for rsync |
+ |
50 |
cpr() { |
+ |
51 |
rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1 "$@" |
+ |
52 |
} |
+ |
53 |
mvr() { |
+ |
54 |
rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1 --remove-source-files "$@" |
+ |
55 |
} |
+ |
56 |
download-changes.sh ¶
18 additions and 0 deletions.
View changes Hide changes
+ |
1 |
rsync -r -e 'ssh -p 1111' -a --delete --partial --info=stats1,progress2 maarten@maartenv.be:/home/maarten/backup/shared/planning shared/planning/ |
+ |
2 |
|
+ |
3 |
echo -e "Retrieving weekly folder from HQ:" |
+ |
4 |
rsync -r -e 'ssh -p 1111' -a --delete --partial --info=stats1,progress2 maarten@maartenv.be:/home/maarten/backup/shared/weekly shared/weekly/ |
+ |
5 |
|
+ |
6 |
echo -e "Retrieving IDLab folder from HQ:" |
+ |
7 |
rsync -r -e 'ssh -p 1111' -a --delete --partial --info=stats1,progress2 maarten@maartenv.be:/home/maarten/backup/IDLab IDLab/ |
+ |
8 |
|
+ |
9 |
echo -e "Updating all repositories: " |
+ |
10 |
cd ~/Repositories |
+ |
11 |
for directory in */ ; do |
+ |
12 |
cd $directory |
+ |
13 |
git pull |
+ |
14 |
cd .. |
+ |
15 |
done |
+ |
16 |
|
+ |
17 |
cd ~ |
+ |
18 |
upload-changes.sh ¶
25 additions and 0 deletions.
View changes Hide changes
+ |
1 |
rsync -r -e 'ssh -p 1111' -a --delete --partial --info=stats1,progress2 shared/planning/ maarten@maartenv.be:/home/maarten/backup/shared/planning |
+ |
2 |
|
+ |
3 |
echo -e "Sending weekly folder to HQ: " |
+ |
4 |
rsync -r -e 'ssh -p 1111' -a --delete --partial --info=stats1,progress2 shared/weekly/ maarten@maartenv.be:/home/maarten/backup/shared/weekly |
+ |
5 |
|
+ |
6 |
echo -e "Sending IDLab folder to HQ: " |
+ |
7 |
rsync -r -e 'ssh -p 1111' -a --delete --partial --info=stats1,progress2 IDLab/ maarten@maartenv.be:/home/maarten/backup/IDLab |
+ |
8 |
|
+ |
9 |
echo -e "Checking all repositories for outstanding commits...\n" |
+ |
10 |
cd ~/Repositories |
+ |
11 |
for directory in */ ; do |
+ |
12 |
cd $directory |
+ |
13 |
echo -e "Checking $directory...\n" |
+ |
14 |
files="$(git status -s)" |
+ |
15 |
if [ "${files:0:2}" == " M" ]; then |
+ |
16 |
i3-nagbar -t warning -m "Repository $directory has uncommitted modifications!" |
+ |
17 |
break |
+ |
18 |
else |
+ |
19 |
git push # Pushing the changes to the upstream repo if applicable |
+ |
20 |
fi |
+ |
21 |
cd .. # Returning to Repositories |
+ |
22 |
done |
+ |
23 |
|
+ |
24 |
cd ~ |
+ |
25 |