Posted on 2 mins read

Introduction

This is the second edition to “New Laptop Configuration”.

Backup

When moving laptops I will temporarily backup my existing GPG and SSH keys (encrypted) to an external data storage device.

cd ~/
mkdir /tmp/keys

# Backup GPG data
gpg --export-secret-keys --armor <NAME> > /tmp/keys/<NAME>.asc
gpg --symmetric /tmp/keys/<NAME>.asc
gpg --export-ownertrust > /tmp/keys/trustdb.txt 
mv /tmp/keys/<NAME>.asc.gpg /Volumes/.../<NAME>.asc.gpg
mv /tmp/keys/trustdb.txt /Volumes/.../trustdb.txt

# Backup SSH data
zip -r /tmp/keys/sshbackup ~/.ssh/
unzip -l /tmp/keys/sshbackup.zip
gpg --symmetric /tmp/keys/sshbackup.zip
mv /tmp/keys/sshbackup.zip.gpg /Volumes/.../sshbackup.zip.gpg

rm -rf /tmp/keys

Steps

  1. Install Rust.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  1. Install Go.
https://go.dev/dl/
  1. Import GPG/SSH keys.
mkdir /tmp/keys
cd /tmp/keys

gpg --decrypt /tmp/keys/<NAME>.gpg > <NAME>
gpg --import <NAME>.asc

rm ~/.gnupg/trustdb.gpg
gpg --import-ownertrust < /tmp/keys/trustdb.txt

gpg --decrypt /tmp/keys/sshbackup.zip.gpg > sshbackup.zip
unzip /tmp/keys/sshbackup.zip
mv /tmp/keys/.ssh/ ~/

rm -rf /tmp/keys
  1. Setup SSH.
eval "$(ssh-agent -s)"
ssh-add --apple-use-keychain ~/.ssh/github
  1. Install Alacritty.
# https://github.com/alacritty/alacritty/releases
mkdir .bash_completion
curl https://raw.githubusercontent.com/alacritty/alacritty/master/extra/completions/alacritty.bash -o ~/.bash_completion/alacritty
  1. Install Fig.
https://fig.io/
  1. Install Homebrew + packages.
# https://brew.sh
brew bundle --file /tmp/Brewfile install
  1. Change default shell to Zsh.
echo /opt/homebrew/bin/zsh | sudo tee -a /etc/shells
chsh -s /opt/homebrew/bin/zsh
  1. Configure Vim-Plug.
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
     https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
  1. Setup dotfiles.

NOTE: Don’t forget to execute ‘prefix + I’ in tmux to install plugins.

cd /tmp
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
git clone https://github.com/Integralist/dotfiles.git
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -o ~/.git-prompt.sh
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh -o ~/.zsh/_git
cp -R .alacritty.yml .zsh .zshrc .config .gitconfig .gitignore .gnupg .ignore .inputrc .leptonrc .tmux.conf ~/
chown -R $(whoami) ~/.gnupg/
chmod 600 ~/.gnupg/*
chmod 700 ~/.gnupg
  1. Setup password store.
KEY_ID=$(gpg --list-keys <NAME> | head -n 2 | tail -n 1 | cut -d ' ' -f 7)
pass init $KEY_ID
pass git init
pass git remote add origin git@github.com:<private/repo>
pass git pull
  1. Safari extensions.
AdBlock One
Dark Reader for Safari
Super Agent for Safari (Cookie Consent Automation)
Tab Sessions
  1. Configure OS.
- Dock (Automatically hide and show the Dock)
- Keyboard (Key Repeat = Fast, Delay Until Repeat = Short)
- Accessibility > Zoom (Use keyboard shortcuts to zoom)
- Date & Time > Clock (Show date + Display the time with seconds)
- Mission Control (disable "Automatically rearrange Spaces based on most recent use")
- Terminal Developer Mode (`spctl developer-mode enable-terminal`)
- Wake up from sleep (`sudo pmset -a standbydelay 7200`)

But before we wrap up... time (once again) for some self-promotion 🙊