Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Stevens authored and Miguel Stevens committed Aug 17, 2021
0 parents commit 5b87fed
Show file tree
Hide file tree
Showing 11 changed files with 664 additions and 0 deletions.
42 changes: 42 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Taps
tap 'homebrew/cask'
tap 'homebrew/cask-fonts'
tap 'homebrew/cask-versions'
tap 'homebrew/bundle'

brew 'curl'
brew 'vim'
brew 'mas'

brew 'zsh'
brew 'z'
brew 'git'
brew 'mysql'
brew 'nginx'
brew 'node'
brew 'yarn'

cask 'dash'
cask 'alfred'
cask 'iterm2'
cask 'rectangle'
cask 'docker'
cask 'figma'
cask 'firefox'
cask 'insomnia'
cask 'tableplus'
cask 'slack'
cask 'zoom'
cask 'visual-studio-code'
cask 'qlmarkdown'
cask 'quicklook-json'
cask 'syncthing'

cask 'font-lato'
cask 'font-open-sans'
cask 'font-roboto'
cask 'font-source-code-pro'
cask 'font-source-sans-pro'
cask 'font-source-serif-pro'

mas 'Spark', id: 1176895641
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### Generate a new SSH key (from Dries's repository)
`curl https://raw.githubusercontent.com/driesvints/dotfiles/HEAD/ssh.sh | sh -s "<YOUR EMAIL ADDRESS>"`

### Install

Clone this repository
`git clone ..... ~/.dotfiles`

Run the install script
`~/.dotfiles/install.sh`


### Manual steps

- `xcode-select --install`
- import rectangle config from ./rectangle.json
- Set your email in git config
17 changes: 17 additions & 0 deletions git/gitconfig.symlink
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[user]
name = Miguel Stevens
[core]
editor = vim
excludesfile = ./.gitignore_global

[init]
defaultBranch = main

[credential]
helper = osxkeychain

[pull]
rebase = true

[help]
autocorrect = 1
58 changes: 58 additions & 0 deletions git/gitignore_global.symlink
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Editors #
###########
.vscode
.idea
*.swp
*~
*.profraw

# Compiled source #
###################
# *.com # this shit is causing vendor/cloud.google.com to be ignored.
*.class
*.dll
*.exe
*.o
*.so
dist/

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Terraform files #
###################
.terraform
*.tfstate.backup

# envrc files (contains secrets) #
##################################
.envrc

# Redis state file
dump.rdb
95 changes: 95 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#!/bin/sh

DOTFILES=$HOME/.dotfiles
DOTLOCAL=$HOME/.local/share/dotfiles

echo "Let's get started..."

# Clone this repo
cd "$HOME" || exit
rm -rf "$DOTFILES"
git clone [email protected]:joshtronic/dotfiles.git "$DOTFILES"
cd "$DOTFILES" || exit

# Create default folders
mkdir -p $HOME/Code
mkdir -p $HOME/Syncthing

# Setup .symlink files
setup_symlinks() {
echo "Setting up symlinks"

for file in find -H "$DOTFILES" -maxdepth 3 -name '*.symlink' ; do
target="$HOME/.$(basename "$file" '.symlink')"
if [ -e "$target" ]; then
echo "~${target#$HOME} already exists... Skipping."
else
echo "Creating symlink for $file"
ln -s "$file" "$target"
fi
done
}

# Setup Homebrew and brewfile
setup_homebrew() {
echo "Setting up Homebrew"

if test ! "$(command -v brew)"; then
echo "Homebrew not installed. Installing."
# Run as a login shell (non-interactive) so that the script doesn't pause for user input
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh | bash --login
fi

# install brew dependencies from Brewfile
brew bundle
}

# Setup Shell
setup_shell() {
echo "Configuring shell"

[[ -n "$(command -v brew)" ]] && zsh_path="$(brew --prefix)/bin/zsh" || zsh_path="$(which zsh)"
if ! grep "$zsh_path" /etc/shells; then
echo "adding $zsh_path to /etc/shells"
echo "$zsh_path" | sudo tee -a /etc/shells
fi

if [[ "$SHELL" != "$zsh_path" ]]; then
chsh -s "$zsh_path"
echo "default shell changed to $zsh_path"
fi
}

# Setup VSCode
setup_vscode() {

ln -sv $HOME/.dotfiles/vscode/settings.json $HOME/Library/Application\ Support/Code/User/settings.json
ln -sv $HOME/.dotfiles/vscode/keybindings.json $HOME/Library/Application\ Support/Code/User/keybindings.json
ln -sv $HOME/.dotfiles/vscode/snippets/ $HOME/Library/Application\ Support/Code/User/snippets

cat ~/.dotfiles/vscode/extensions | while read extension
do
code --install-extension $extension --force
done
}

# Go
setup_symlinks
setup_homebrew
setup_shell
setup_vscode

# ZSH Plugins
ZSHPLUGS=(
"zsh-completions"
"zsh-history-substring-search"
"zsh-syntax-highlighting"
)

for INDEX in ${!ZSHPLUGS[*]}; do
ZSHPLUG="${ZSHPLUGS[$INDEX]}"
git clone --depth=1 "https://github.com/zsh-users/$ZSHPLUG.git" "$DOTLOCAL/$ZSHPLUG"
done

# MacOS Preferences
source ./mac/.macos
137 changes: 137 additions & 0 deletions macos/.macos
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
osascript -e 'tell application "System Preferences" to quit'

sudo -v

while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &

sudo scutil --set ComputerName "MacBook Miguel"
sudo scutil --set HostName "MacBook Miguel"
sudo scutil --set LocalHostName "MacBook Miguel"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "MacBook Miguel"

sudo nvram SystemAudioVolume=" "

defaults write NSGlobalDomain NSWindowResizeTime -float 0.001

defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
defaults write com.apple.LaunchServices LSQuarantine -bool false
sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40

defaults write NSGlobalDomain AppleLanguages -array "en" "nl"
defaults write NSGlobalDomain AppleLocale -string "en_US@currency=EUR"
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters"
defaults write NSGlobalDomain AppleMetricUnits -bool true
sudo systemsetup -settimezone "Europe/Brussels" > /dev/null


launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null

sudo pmset -a lidwake 1
sudo pmset -a autorestart 1
sudo systemsetup -setrestartfreeze on
sudo pmset -c sleep 0
sudo pmset -b sleep 5
sudo pmset -a standbydelay 86400
sudo pmset -a hibernatemode 0

defaults write com.apple.finder DisableAllAnimations -bool true
defaults write com.apple.finder AppleShowAllFiles -bool true
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
defaults write com.apple.finder ShowPathbar -bool true
defaults write com.apple.finder _FXSortFoldersFirst -bool true
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist

/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist

/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist

defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
defaults write com.apple.finder WarnOnEmptyTrash -bool false
chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library

defaults write com.apple.finder FXInfoPanesExpanded -dict \
General -bool true \
OpenWith -bool true \
Privileges -bool true

defaults write com.apple.dock minimize-to-application -bool true
defaults write com.apple.dock persistent-apps -array
defaults write com.apple.dock static-only -bool true
defaults write com.apple.dock launchanim -bool false
defaults write com.apple.dashboard mcx-disabled -bool true
defaults write com.apple.dock dashboard-in-overlay -bool true
defaults write com.apple.dock mru-spaces -bool false
defaults write com.apple.dock autohide-delay -float 0
defaults write com.apple.dock autohide-time-modifier -float 0
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock showhidden -bool true
defaults write com.apple.dock show-recents -bool false

find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete

defaults write com.apple.dock wvous-tr-corner -int 10
defaults write com.apple.dock wvous-tr-modifier -int 0

defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true

defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true

defaults write com.apple.Safari IncludeDevelopMenu -bool true
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true

defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true

defaults write com.apple.terminal StringEncodings -array 4
defaults write com.googlecode.iterm2 PromptOnQuit -bool false
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
defaults write com.apple.ActivityMonitor IconType -int 5
defaults write com.apple.ActivityMonitor ShowCategory -int 0
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
defaults write com.apple.ActivityMonitor SortDirection -int 0

defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true

for app in "Activity Monitor" \
"Address Book" \
"Calendar" \
"cfprefsd" \
"Contacts" \
"Dock" \
"Finder" \
"Google Chrome Canary" \
"Google Chrome" \
"Mail" \
"Messages" \
"Opera" \
"Photos" \
"Safari" \
"SizeUp" \
"Spectacle" \
"SystemUIServer" \
"Terminal" \
"Transmission" \
"Tweetbot" \
"Twitter" \
"iCal"; do
killall "${app}" &> /dev/null
done

echo "Done. Note that some of these changes require a logout/restart to take effect."
Loading

0 comments on commit 5b87fed

Please sign in to comment.