commit c8d2c379e6a3c3a86e0b5c989ade003f2de7f817
parent c6d686ce21ee12961c14c29a51ad3b7d57c70a99
Author: oscarbenedito <oscar@oscarbenedito.com>
Date:   Mon, 30 Mar 2020 19:08:43 +0200

Improved backups and added vim pluggins

Diffstat:
M.chezmoiignore | 3+++
Mdot_config/aliases.tmpl | 33++++-----------------------------
Mdot_config/nvim/init.vim | 2++
Adot_local/bin/executable_backup_vc_10_11 | 32++++++++++++++++++++++++++++++++
4 files changed, 41 insertions(+), 29 deletions(-)

diff --git a/.chezmoiignore b/.chezmoiignore @@ -5,3 +5,6 @@ README.md .config/kitty .config/i3 {{ end }} +{{ if not .backup }} +.local/bin/backup_vc_10_11 +{{ end }} diff --git a/dot_config/aliases.tmpl b/dot_config/aliases.tmpl @@ -58,38 +58,13 @@ alias vscode="$HOME/KOLMOGOROV/VSCode-linux-x64/bin/code" {{- if .backup }} # Backup to external HD -alias backup_all="rsync -loptruzvP --delete --exclude={{ if gt (len .backup.backup_exclude) 1 -}} { {{- end }} - {{- range $i, $dir := .backup.backup_exclude }} - {{- if $i -}} - , - {{- end -}} - '{{ $dir }}' - {{- end -}} -{{ if gt (len .backup.backup_exclude) 1 -}} } {{- end }} $HOME/ /media/$USER/OSCAR/.{{ .backup.backup_dir }}/" - -# Encrypted backup to USB -backup_vc_10_11() { - veracrypt --mount /media/$USER/Oscar/Varis/copia-gris.hc --slot="10" - veracrypt --mount /media/$USER/Oscar/Varis/copia-gris-git.hc --slot="11" - rsync -gloptruzvP --delete --exclude={"/Git", - {{- range $i, $dir := .backup.backup_exclude }} - {{- if $i -}} - , - {{- end -}} - "{{ $dir }}" - {{- end -}} - {{ range $dir := .backup.small_backup_exclude -}} - ,"{{ $dir }}" - {{- end -}} - } $HOME/ /media/veracrypt10/{{ .backup.backup_dir }}/ - rsync -gloptruzvP --delete $HOME/Git/ /media/veracrypt11/{{ .backup.backup_dir }}/ - veracrypt --dismount /media/$USER/Oscar/Varis/copia-gris.hc - veracrypt --dismount /media/$USER/Oscar/Varis/copia-gris-git.hc -} +alias backup_all='rsync -loptruzvP --delete {{ range $i, $dir := .backup.backup_exclude }}--exclude "{{ $dir }}" {{ end }} "$HOME/" "/media/$USER/OSCAR/.{{ .backup.backup_dir }}/"' # Backup the contents of the USB -alias backup_usb="rsync -gloptruzvP --delete --exclude={'/Varis/copia-gris.hc','/Varis/copia-gris-git.hc','/.Trash-1000','/.Trashes','/.Spotlight-V100'} /media/$USER/Oscar/ /home/oscar/USB/" +alias backup_usb='rsync -gloptruzvP --delete --exclude "/Varis/copia-gris.hc" --exclude "/Varis/copia-gris-git.hc" --exclude "/.Trash-1000" --exclude "/.Trashes" --exclude "/.Spotlight-V100" "/media/$USER/Oscar/" "$HOME/Documents/Backups/USB/"' {{- end }} + {{- if eq .chezmoi.hostname "fme-desktop" }} + setxkbmap -option "caps:swapescape" # Switch caps and escape {{- end }} diff --git a/dot_config/nvim/init.vim b/dot_config/nvim/init.vim @@ -2,6 +2,8 @@ call plug#begin() Plug 'junegunn/goyo.vim' " minimalist design, nice for writing text Plug 'vim-latex/vim-latex' Plug 'sheerun/vim-polyglot' " languages syntax +Plug 'tpope/vim-surround' " surrounding objects +Plug 'tpope/vim-commentary' " easily comment objects call plug#end() " commands for latex-suite diff --git a/dot_local/bin/executable_backup_vc_10_11 b/dot_local/bin/executable_backup_vc_10_11 @@ -0,0 +1,32 @@ +#!/usr/bin/env sh + +KDBX="$HOME/Documents/Contrasenyes/Passwords.kdbx" + +stty -echo +printf "KeePassXC database password: " +read PW +stty echo +printf "\n" + +alias keepassxc="$XDG_DATA_HOME/keepassxc/KeePassXC-2.5.3-x86_64.AppImage" + +PW1="$(echo "$PW" | keepassxc cli show "$KDBX" \ + "Encriptat local/USB-copia-gris" -sq -a "Password")" || exit +PW2="$(echo "$PW" | keepassxc cli show "$KDBX" \ + "Encriptat local/USB-copia-gris-git" -sq -a "Password")" || exit + +unset PW + +veracrypt --mount "/media/$USER/Oscar/Varis/copia-gris.hc" --slot 10 \ + --password "$PW1" +unset PW1 + +veracrypt --mount "/media/$USER/Oscar/Varis/copia-gris-git.hc" --slot 11 \ + --password "$PW2" +unset PW2 + +rsync -gloptruzvP --delete --exclude "/Git" --exclude "/.*" --exclude "/Documents/Backups" --exclude "/Git/backup" "$HOME/" "/media/veracrypt10/BACKUP_GRAY/" +rsync -gloptruzvP --delete "$HOME/Git/" "/media/veracrypt11/BACKUP_GRAY/" + +veracrypt --dismount "/media/$USER/Oscar/Varis/copia-gris.hc" +veracrypt --dismount "/media/$USER/Oscar/Varis/copia-gris-git.hc"