reboot: chezmoi
This commit is contained in:
parent
1dfcb6068f
commit
e8846ec72b
36 changed files with 5 additions and 1387 deletions
79
zsh/zshrc
79
zsh/zshrc
|
@ -1,79 +0,0 @@
|
|||
# Matthew Dillon
|
||||
# matthewrdillon@gmail.com
|
||||
|
||||
srcs=(
|
||||
"${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
|
||||
"/opt/miniconda3/etc/profile.d/conda.sh"
|
||||
"$HOME/.cargo/env"
|
||||
)
|
||||
|
||||
for fp in $srcs; do
|
||||
if [[ -s "$fp" ]]; then
|
||||
source "$fp"
|
||||
fi
|
||||
done
|
||||
|
||||
BASE16_SHELL=$HOME/.config/base16-shell/
|
||||
[ -n "$PS1" ] && [ -s $BASE16_SHELL/profile_helper.sh ] && eval "$($BASE16_SHELL/profile_helper.sh)"
|
||||
|
||||
alias q="conda activate q2dev"
|
||||
alias i="ipython3"
|
||||
alias vim="nvim"
|
||||
|
||||
# Backup shortcuts (borrowed parts from https://github.com/laurent22/rsync-time-backup
|
||||
function prune_backups() {
|
||||
dest_root="/Volumes/field_on_fire/$HOST"
|
||||
epoch=$(date "+%s")
|
||||
previous='0000-00-00-000000'
|
||||
for filename in $(find "$dest_root" -type d -name "????-??-??-??????" -prune | sort -r); do
|
||||
backup_date=$(basename "$filename")
|
||||
timestamp=$(date -j -f "%Y-%m-%d-%H%M%S" "$backup_date" "+%s")
|
||||
if [ -z "$timestamp" ]; then
|
||||
echo "Error parsing date date: $filename"
|
||||
continue
|
||||
fi
|
||||
if [ $timestamp -ge $((epoch - 86400)) ]; then
|
||||
true
|
||||
elif [ $timestamp -ge $((epoch - 2678400)) ]; then
|
||||
if [ "${backup_date:0:10}" '==' "${previous:0:10}" ]; then
|
||||
rm -rf "$filename"
|
||||
fi
|
||||
else
|
||||
if [ "${backup_date:0:7}" '==' "${previous:0:7}" ]; then
|
||||
rm -rf "$filename"
|
||||
fi
|
||||
fi
|
||||
previous=$backup_date
|
||||
done
|
||||
}
|
||||
|
||||
function back_things_up() {
|
||||
date=$(date +"%Y-%m-%d-%H%M%S")
|
||||
# TODO: update this...
|
||||
dest_root="/Volumes/field_on_fire/$HOST"
|
||||
rsync -azP \
|
||||
--stats \
|
||||
--human-readable \
|
||||
--itemize-changes \
|
||||
--size-only \
|
||||
--link-dest=$dest_root/latest \
|
||||
--exclude-from $HOME/.dotfiles/rsync_excludes.txt \
|
||||
$HOME/ \
|
||||
$dest_root/$date && \
|
||||
rm -f $dest_root/latest && \
|
||||
ln -s $dest_root/$date $dest_root/latest
|
||||
# TODO: once confident pruning is working well, add that in here
|
||||
}
|
||||
|
||||
function devlog() {
|
||||
vim -c 'Goyo' '+normal Go' +startinsert ~/projects/personal/devlog/logs/$(date '+%Y-%m-%d').gmi
|
||||
}
|
||||
|
||||
# NOTE: this might need a mapped network drive to work (e.g. Z:\)
|
||||
function cmd() {
|
||||
CMD=$1
|
||||
shift;
|
||||
ARGS=$@
|
||||
WIN_PWD=$(wslpath -w ${PWD})
|
||||
cmd.exe /c "pushd ${WIN_PWD} && ${CMD} ${ARGS}"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue