Skip to content

Instantly share code, notes, and snippets.

@runely
Last active February 26, 2024 04:03
Show Gist options
  • Save runely/ee8a8378591566c49976355337ebe99f to your computer and use it in GitHub Desktop.
Save runely/ee8a8378591566c49976355337ebe99f to your computer and use it in GitHub Desktop.

Browsers

Personer

Utilities

Homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install nmap
brew install vercel-cli

Apps

A better window switcher

See your next meeting right in your menu bar

Move and resize windows in macOS using keyboard shortcuts or snap areas

Remote Desktop manager

Drivers for Philips brilliance 499p

A little bit of 📝 that lives on your menu bar

Development tools

Misc settings
  • Launching from terminal:
    • Open Command Palette (SHIFT+CMD+P) -> Shell Command: Install 'code' command in the PATH
  • Open folder from Finder

NodeJS

brew install node

Homey

npm install -g homey

Azure-CLI

brew install azure-cli

Azure Functions Core Tools

brew tap azure/functions
brew install azure-functions-core-tools@2
brew install azure-functions-core-tools@3

Switching between azure-function-core-tools: brew link --overwrite azure-functions-core-tools@3

Various npm packages

npm install -g vercel release create-react-app standard eslint

Setup vercel

vercel login

Finder settings

  • Create local folder for git repos
mkdir ~/source
Settings (Finder -> Preferences)
  • General
    • New Finder windows shows: '~/source'
    • Open folders in tabs instead of new windows
  • Side panel
    • Videos (remove)
    • Music (remove)
    • Pictures (add)
    • runely (Home)
    • iCloud Drive (remove)
    • Placements (add all)
    • New etiquettes (remove)
  • Advanced
    • Activate all
    • When searching: Search the open folder
Settings (View -> Show view options)

https://discussions.apple.com/thread/7941640

  • Sort by: Name

  • Icon size: 56 x 56

  • Click: Use as defaults

Chances are you've opened some Finder windows in the past. Individual folder options will override this default setting that we just set.

In order reset your folder settings across the entire machine we have to delete all .DS_Store files. This will ensure that all folders start fresh. Open up the Terminal application (Applications/Utilities/Terminal), and type:
sudo find / -name .DS_Store -delete; killall Finder

Terminal settings / tweaks

Git

git config --global user.name "Rune Moskvil Lyngås"
git config --global user.email "rune.moskvil.lyngaas@vtfk.no"
git config --global github.user runely
git config --global color.ui true
ssh-keygen -t rsa -b 4096 -C "rune.moskvil.lyngaas@vtfk.no"
eval "$(ssh-agent -s)"

Edit ~/.ssh/config

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_rsa
ssh-add -K ~/.ssh/id_rsa

Copy key:

pbcopy < ~/.ssh/id_rsa.pub
chmod 600 ~/.ssh/id_rsa
  1. Open https://github.com/settings/keys
  2. Add new SSH key
  3. Paste in the key from clipboard

gpg

  1. brew install gpg
  2. Generate gpg keys and upload to github, as described in this guide
    1. gpg --full-generate-key -> RSA and RSA -> 4096 -> 0
    2. gpg --list-secret-keys --keyid-format LONG
    3. Copy the key in the sec section between rsa4096/ and the date
    4. gpg --armor --export key-copied-from-above
    5. Copy everything printed out
    6. Add to SSH and GPG keys
  3. git config --global commit.gpgsign true
  4. Add gpg passphrase to keyring on first commit

NPM

npm set init.author.email "rune.moskvil.lyngaas@vtfk.no"
npm set init.author.url "https://github.com/runely"
npm set init.author.name "Rune Moskvil Lyngås"
npm set init.license "MIT"
npm set save-prefix ""
  1. nano /Users/runely/.npmrc
    1. Change init.author.email into --init-author-email
    2. Change init.author.url into --init-author-name
    3. Change init.author.name into --init-author-url
    4. Change init.license into --init-license

Switch shell to zsh

chsh -s /bin/zsh

Install "oh my zsh"

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Install "oh my zsh" theme

curl -o ~/.oh-my-zsh/custom/themes/My-Theme.zsh-theme https://gist.githubusercontent.com/runely/c8bbf60ac7b9aa6da34b9df4f61017f6/raw/c7ebaba737b92b47802c50937f57af3ab2ae0020/My-Theme.zsh-theme

Configure "oh my zsh"

nano ~/.zshrc

# set/update the following
ZSH_THEME="My-Theme"

ZSH_DISABLE_COMPFIX=true

HIST_STAMPS="dd/mm/yyyy"

plugins=(git)

# You may need to manually set your language environment
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

# Preferred editor for local and remote sessions
#if [[ -n $SSH_CONNECTION ]]; then
#    export TERM=xterm
#else
#    export TERM=xterm-kitty
#fi

# My aliases
alias cd..="cd .."
alias ls="ls -la"
alias now="vercel"

# Set startup folder
if [ -z "$TERM_PROGRAM" ]; then
  echo "Normal terminal launched. Setting start point"
  cd ~/source
elif [ "$TERM_PROGRAM" = "Apple_Terminal" ]; then
  echo "Apple terminal launched. Setting start point"
  cd ~/source
else
  echo "'$TERM_PROGRAM' launched. Skipping start point"
fi

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

# show uptime
uptime

Install zsh-syntax-highlighting

brew install zsh-syntax-highlighting

Install zsh nvm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash

Terminal tweaks

echo "# My aliases" >> ~/.bash_profile
echo "alias cd..=\"cd ..\"" >> ~/.bash_profile
echo "alias ls=\"ls -la\"" >> ~/.bash_profile
echo "alias now=\"vercel\"" >> ~/.bash_profile

echo "\n# Set startup folder" >> ~/.bash_profile
echo "if [ -z \"\$TERM_PROGRAM\" ]; then" >> ~/.bash_profile
echo "  echo \"Normal terminal launched. Setting start point\"" >> ~/.bash_profile
echo "  cd ~/source" >> ~/.bash_profile
echo "elif [ \"\$TERM_PROGRAM\" = \"Apple_Terminal\" ]; then" >> ~/.bash_profile
echo "  echo \"Apple terminal launched. Setting start point\"" >> ~/.bash_profile
echo "  cd ~/source" >> ~/.bash_profile
echo "else" >> ~/.bash_profile
echo "  echo \"'\$TERM_PROGRAM' launched. Skipping start point\"" >> ~/.bash_profile
echo "fi" >> ~/.bash_profile

OSX tweaks

Settings
  • Trackpad
    • Trykk for å klikke
    • Markørhastighet: 9/10
# Show hidden files in Finder
defaults write com.apple.finder AppleShowAllFiles true

# Show the ~/Library folder
chflags nohidden ~/Library

# Store screenshots in subfolder in Documents
mkdir ~/Pictures/Screenshots
defaults write com.apple.screencapture location ~/Pictures/Screenshots

# Add a context menu item for showing the Web Inspector in web views
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true

# Show full folder path in finder
defaults write com.apple.finder ShowPathbar -bool true

# Show filename extensions by default
defaults write NSGlobalDomain AppleShowAllExtensions -bool true

# Turn off smart quotes and dashes in Notes
defaults write com.apple.Notes SmartQuotes -bool false
defaults write com.apple.Notes SmartDashes -bool false

# allow apps from anywhere to run (restores "anywhere" option in system prefs)
sudo spctl --master-disable

# set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 2

# set a shorter Delay until key repeat
defaults write NSGlobalDomain InitialKeyRepeat -int 15

# disable the press and hold feature..
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false

# Enable touchbar sudo
sudo nano /etc/pam.d/sudo
	# Add the following line:
	auth sufficient pam_tid.so

# Add a single space icon to your Dock. Repeat for more spaces (https://www.imore.com/add-space-your-mac-dock)
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment