Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save benjaminapetersen/67fa8e9640752a36ea5084686e54e7ff to your computer and use it in GitHub Desktop.
Save benjaminapetersen/67fa8e9640752a36ea5084686e54e7ff to your computer and use it in GitHub Desktop.

Laptop Setup Tips

Moving from an older laptop? Bring these files over.

  • In Safari, "File -> Export -> Bookmarks"
  • Make a copy of ~/.zsh_history
  • Make a copy of github public and private keys from ~/.ssh or wherever you kept them
  • Check your Downloads folder for anything worth keeping

Helpful Brew Casks

brew install docker flycut goland google-cloud-sdk iterm2 sizeup slack

Flycut preferences

Enable the following:

  • Sticky bezel
  • Wraparound bezel
  • Menu selection pastes
  • Launch flycut on login
  • Remove duplicates
  • Move pasted items to top of stack
  • Remember 50, display 30, favorites 50

iTerm2 preferences

  • General -> Selection -> turn off "Copy to paste on selection"
  • Profiles -> Text -> Font -> 16pt
  • Profiles -> Terminal -> scrollback lines 100,000

Helpful Brew Installs

brew tap homebrew/command-not-found
brew tap carvel-dev/carvel
brew install ytt kbld kapp imgpkg kwt vendir kctrl
brew install zsh zsh-history-substring-search
brew install go
# Note: on linux go really wants gcc5 to also be installed for some reason
#brew install gcc@5
brew install git git-duet/tap/git-duet pre-commit gh
# Note: for each git repo that you choose to use pre-commit with, cd to the repo and run: pre-commit install
brew install k9s kind kubectl kubectx stern # previously also tilt-dev/tap/tilt
brew install fzf chroma # fasd has been archived, so not including that anymore
brew install acarl005/homebrew-formulas/ls-go ripgrep procs bat tokei git-delta dust fd httpie
brew install watch htop wget
brew install jesseduffield/lazydocker/lazydocker ctop dive
brew install jq yq
brew install grip
brew install aws-iam-authenticator
brew install step cfssl
# On linux, also:
#sudo apt-get install apache2-utils -y

Shell Setup Tips

zsh is a nice option.

  1. brew install zsh
  2. Install Oh My Zsh, see https://ohmyz.sh
  3. Get some nice plugins
    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$HOME"/.oh-my-zsh/custom/themes/powerlevel10k
    git clone https://github.com/zsh-users/zsh-autosuggestions "$HOME"/.oh-my-zsh/custom/plugins/zsh-autosuggestions
    git clone https://github.com/TamCore/autoupdate-oh-my-zsh-plugins "$HOME"/.oh-my-zsh/plugins/autoupdate
    git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git "$HOME"/.oh-my-zsh/custom/plugins/fast-syntax-highlighting
  4. Add ~/.zshrc
  5. Optionally add ~/.p10k.zsh for a nice theme
  6. Open iTerm's preferences and set your shell to /usr/local/bin/zsh (use /opt/homebrew/bin/zsh if on Apple Silicon) in Profiles -> General -> Command -> Custom Shell.
  7. Open a new iTerm shell and run p10k configure. It should ask if you want to install a font. Answer yes, then follow the instructions.

Install gvm

See https://github.com/moovweb/gvm?tab=readme-ov-file#installing.

# Install gvm. Note that this will add a line to the bottom of your .zshrc.
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
# Then close the terminal and open a new one. In the new one:
gvm listall # to see available versions
gvm install go1.22.2 # to install a particular version (takes a while)
gvm use go1.22.2 --default # to set it as your default go
brew uninstall go # to remove the brew-installed Go so you are only using gvm
which go # should show the gvm-installed version

Other Useful Files

  1. ~/.gitconfig
  2. ~/.git-authors

Add /usr/local/bin/jetbrains-git-wrapper

#!/usr/bin/env bash
export PATH="/usr/local/bin:$PATH"
exec git "${@/%commit/duet-commit}"

GoLand Setup Tips

Some helpful tips when using the GoLand IDE to help you code in style. 🚀

Open the Pinniped Projects in GoLand

  1. "File -> Open", open the pinniped-ci repo directory in the file browser.
  2. "File -> Open", open the pinniped-ci repo directory in the file browser, and in the next dialog box choose "Attach"

Git settings

  • In "Preferences -> Version Control -> Path to Git executable", set it to /usr/local/bin/jetbrains-git-wrapper if you want to use git-duet for commits from inside Goland.
  • In "Preferences -> Version Control -> Git" change "Update Method" to "Rebase".
  • In "Preferences -> Version Control -> Commit" check the boxes for all "Commit Message Inspections".

Key Bindings

First Resolve the Conflicting Key Bindings

  1. Open the MacOS "Keyboard" system preferences pane
  2. In "Keyboard Shortcuts" -> "Function Keys", check the box to use F keys as function keys
  3. In "Keyboard Shortcuts", turn off conflicting shortcuts, e.g. cmd+shift+A, etc. GoLand's "Keymap" preferences page will tell you which shortcuts have conflicts with the OS shortcuts when you click on the "Show Conflicts" (exclamation point) icon.

Then Add New Key Bindings in "Preferences -> Keymap"

  1. Close Others: cmd+shift+W
  2. Move To Opposite Group: ctrl+opt+shift+cmd+left_arrow and ctrl+opt+shift+cmd+right_arrow (note: you can right-click and "Add Keyboard Shortcut" more than once)
  3. Split and Move Right: ctrl+opt+shift+cmd+up_arrow
  4. Split and Move Down: ctrl+opt+shift+cmd+down_arrow
  5. Note that Goto Next Splitter is opt+tab by default. Changing it to the more natural opt+backtick is not as easy as it used to be. Now it requires adding the Unicode Hex Input keyboard in the OS Keyboard preferences pane and switching to use the that keyboard instead of the US English keyboard in the menu bar. See https://stackoverflow.com/a/61482584. If you do this, you'll also want to go to the OS keyboard settings and turn off the key binding for control-space to switch between input devices, or else control-space will no longer work in your IDE.

Configure the Editor

  1. "Preferences -> Appearance & Behavior -> System Settings", check the box for "Confirm Before Exiting the IDE"
  2. "Preferences -> Editor"
    1. Under "General", turn off the annoying "Move code fragments with drag-and-drop" setting and turn on the "Ensure an empty line at the end of a file on Save" setting.
    2. Under "Font", pick your favorite font size
  3. "Preferences -> Editor -> File Types", choose "Go files" and add *.go.tmpl because we use those files as Go templates and its nice for the editor to treat them like Go files (e.g. use tab characters instead of spaces for indentiation).
@benjaminapetersen
Copy link
Author

A quick note on replacing the BSD versions (UNIX) of CLI tools with the GNU versions (Linux). See this:

The GNU versions are much more user friendly, have better flags, etc. I use this little snippet after doing the things above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment