Stephen Gilmore

💻 Setting up a new computer

Python August 27th, 2022 4 minute read.

These are my notes on the tasks or apps I frequently use and setup on a new or refreshed computer.

Desktop Backgrounds

Forest originally from uhdpaper.

Install fonts

Meslo LGS NF

For Mac, just unzip the fonts and double click each file to add it to Font Book.

Apps to Install

Install git

Type the following into terminal:

git --version

Go things

Install pkgsite

go install golang.org/x/pkgsite/cmd/pkgsite@latest

Install godoc

go install golang.org/x/tools/cmd/godoc@latest
Run locally with godoc -http=:7000

Install gofumpt

go install mvdan.cc/gofumpt@latest

Update VS Code settings:

"go.useLanguageServer": true,
"gopls": {
    "formatting.gofumpt": true,
},

zsh Things

Starship prompt

instructions

Install it

curl -sS https://starship.rs/install.sh | sh

Add the following to the end of ~/.zshrc:

# ~/.zshrc

eval "$(starship init zsh)"

zsh auto-suggestions

https://github.com/zsh-users/zsh-autosuggestions

git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions

echo "source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc

zsh syntax highlighting

https://github.com/zsh-users/zsh-syntax-highlighting

# Clone this repository and source the script
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.zsh/zsh-syntax-highlighting

echo "source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc

Set up global gitignore

Edit the .gitconfig file

nano ~/.gitconfig

Add the lines:

[core]
        excludesfile = ~/.gitignore
Save the file and then create/open a .gitignore file
nano ~/.gitignore

Add anything that should be ignored for all projects. For example:

.DS_Store
.env
venv
.venv
*.db
*.sqlite3
.pytest_cache
__pycache__

Set up "permanent" environment variables

(provided by OpenAI's ChatGPT)

macOS

Use nano to add export MY_VARIABLE=my_value to one of the following: - If you are using Bash shell, you can use ~/.bashrc - If you are using Zsh shell, you can use ~/.zshrc. Here’s how:

Load the new environment variables by running: - source ~/.zshrc - source ~/.bashrc

Install Air

Air is a useful tool for live reloading applications.

Installation:

go install github.com/cosmtrek/air@latest

Make sure GOPATH is set in ~/.zshrc to be able to use the air command

# Go Path Things
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export PATH=$PATH:$(go env GOPATH)/bin

Archive

Things I used to use, but don't anymore:

Meslo NerdFont

pyenv

https://github.com/pyenv/pyenv#automatic-installer

# pyenv automatic installer

curl https://pyenv.run | bash

# Set up pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.zshrc

# Set up global pyenv virtual env
pyenv install 3.11.2
pyenv virtualenv 3.11.2 3.11.2-global
pyenv global 3.11.2-global

Powerlevel10k

https://github.com/romkatv/powerlevel10k#manual

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.zsh/powerlevel10k

echo 'source ~/.zsh/powerlevel10k/powerlevel10k.zsh-theme' >> ~/.zshrc

# Configure it
p10k configure