I’ve recently begun volunteering some of my time at church to help run the sound board for worship services. The church has a digital board, which is foreign to me, and there’s been a relatively steep learning curve to get up to speed.
Given that I’m not there where I can learn and practice on the board every week, I need to take pretty good notes. Besides that, I like to keep notes about each service as we do rehearsals, so that I can keep the important aspects to highlight written down for reference.
In addition to the sound board, I have mac in front of me. It’s not my mac, and I’m certainly not the only person that’s using it, so I can’t customize it like I would my personal workstation. It doesn’t have Xcode installed, and therefore definately doesn’t have homebrew, and since it’s not mine, I’m not going to install those things.
I want to keep my notes encrypted when I’m not there. So I looked into what tools I have available to me to do such a task. Note that these might not be default OSX tools, but it’s what was already on the machine when I got there.
In addition, I want some basic things like my vimrc
present, but only while
I’m the one using the machine. I don’t have my own user on the machine, so I
can’t just customize the $HOME
dir.
There’s nothing revolutionary here, I just haven’t done this before, and I want to document it, especially since someone might find my personal hidden directory and remove it.
Create the workspace: ๐
mkdir -p ~/.andrew/notes/config/vim/pack/default/start
touch ~/.andrew/notes/config/vim/vimrc
touch ~/.andrew/toggle
I won’t fill the files/directories right now - just want to show that there’s contents there.
Create the toggle ๐
toggle.sh
#!/usr/bin/env bash
set -e
FILE=notes
encrypt() {
rm -rf "${HOME}/.vim"
zip -r "${FILE}.zip" $FILE
openssl enc -aes-256-cbc -e -in "${FILE}.zip" -out "${FILE}.enc"
rm -rf $FILE "${FILE}.zip"
}
decrypt() {
openssl enc -aes-256-cbc -d -in "${FILE}.enc" -out "${FILE}.zip"
unzip "${FILE}.zip"
rm -rf "${FILE}.enc" "${FILE}.zip"
ln -s "${PWD}/${FILE}/config/vim $HOME/.vim"
}
if [[ -e $FILE ]]; then
encrypt
else
decrypt
fi
Note the set -e
!!! I didn’t set this at first, and after screwing up some
of the openssl, I deleted all my work, and I didn’t have a backup saved…
Don’t be me. Make a backup, and fail fast.