Skip to content

Instantly share code, notes, and snippets.

@jakowicz
Last active May 16, 2024 12:56
Show Gist options
  • Save jakowicz/a9605340fd014d6de6a330e26a80f0d9 to your computer and use it in GitHub Desktop.
Save jakowicz/a9605340fd014d6de6a330e26a80f0d9 to your computer and use it in GitHub Desktop.
Mac Idempotent Configuration Amazingness - MICA
function vscode_install() {
plugin=$1
if [ -x "$(command -v code)" ]; then
code --install-extension $plugin
fi
}
#################
# Install Xcode command line tools
#################
xcode-select --install
#################
# Install Brew
#################
if ! [ -x "$(command -v brew)" ]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
fi
#################
# Install Zsh
#################
if ! [ -x "$(command -v zsh)" ]; then
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
fi
#################
# OS Setup
#################
# Key Tracking
defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms)
# Top bar clock
defaults write com.apple.menuextra.clock IsAnalog -bool false
defaults write com.apple.menuextra.clock DateFormat -string "EEE d MMM HH:mm:ss"
#################
# Brew Casks
#################
# brew install --cask 1password
# brew install --cask adoptopenjdk
brew install --cask docker
brew install --cask dropbox
brew install --cask firefox
brew install --cask google-chrome
brew install --cask iterm2
brew install --cask java cask
brew install --cask keepassx
brew install --cask multipass
brew install --cask osxfuse
brew install --cask slack
brew install --cask spotify
brew install --cask visual-studio-code
brew install --cask virtualbox
brew install --cask landrop # Teraform Landscape
#################
# Brew Taps
#################
brew tap jakowicz/homebrew-tap
brew tap weaveworks/tap # eksctl
#################
# Brew Formulae
#################
brew_install asciinema # Record the terminal
brew install awscli # AWS for the command line
brew install bmon # Network interface monitor
brew install ccat # Coloured cat - genius
brew install cheatsheet # GNU cheatsheets
brew install cowsay # Cows can talk too
brew install curl # See URL
brew install dive # Docker image analyse
brew install elixir # Elixir Lang
brew install eksctl # EKS CLI
brew install etcd # Distributed KV Store
brew install erlang # Erlang
brew install ffmpeg # Video & Audio Processor
brew install fzf # Command line fuzzy finder
brew install go # Golang
brew install go-jira # Command line Jira
brew install gpg # GNU Privacy Guard
brew install groovy # Delusory named programming language
brew install graphviz # Graphing deps
brew install hadolint # Docker linting
brew install helm # Kubernetes package manager
brew install hping # TCP/IP packet assembler for ICMP/TCP/UDP spoofing
brew install htop # Top on roids
brew install hub # Command line GitHub
brew install installinstall hyperfine # Benchmarking
brew install iproute2mac # The ip command
brew install jc # JSON CLI = Turn command outputs in JSON
brew install jenv # Java Envs
brew install jq # JSON processor
brew install kops # Kubernetes Operations
brew install kubectl # CLI for Kubernetes
brew install kubectx # Kubectx for switching clusters and kubens for switching namespaces
brew install kubernetes-helm # Package manager for Kubernetes
# brew install landscape; # Terraform plan formatting of the gods
brew install libmagic; # Implementation of file(1)
brew install links; # Browser from the terminal
brew install lolcat # Colour the shit out of your terminal
brew install masscan # Mass IP port scanner
brew install maven # Javaaaaaa Builddd Tooool
brew install minikube # Minikube
brew install mtr # Traceroute on roids
brew install neofetch # Pretty system information*
brew install nmap # Network exploration and port scanner
brew install nvm # Node Version Manager
brew install packer # Package da VM
brew install postgres@13 # Postgres version 13 an 14 as fucked
brew install pre-commit # Git pre-commit hooks made simples
brew install pyenv # Install multiple versions of Python
brew install pyenv-virtualenv # Allows you to create Python virtual envs for Pyenv
brew install pyenv-virtualenvwrapper # Allows you to create Python virtual envs for Pyenv with the virtualenvwrapper
brew install rbenv # Ruby Version Manager
brew install recent # Find the commands you fund most of for each bin
brew install rpm2cpio # Reverse engineer an rpm file
brew install s3fs # AWS S3 Filesystem
brew install shpotify # Command line Spotify
brew install snapcraft # Package programs in the snap format
brew install telnet # Yeah
brew install terraform-doc # Doco generator for Terraform
brew install tfenv # Multiple Terraform versions
brew install tflint # Terraform (>0.12) linting
brew install tldr # Snippets of GNU commands
brew install tree # Tree of directory structures
brew install wget # Super duper network receiver
brew install youtube-dl # Youtube downloader
# Additions php, mysql, mongodb, golang
#################
# Download Files
#################
wget https://gist.githubusercontent.com/jakowicz/251b1e2ac7628f773594c499671bc72b/raw/1b50ec8a12f71729109e2365cf7b1f8eb6fda820/.initrc ~/.initrc
wget https://gist.githubusercontent.com/jakowicz/60d36c1a830ced7b9324ccc93d0656aa/raw/f41f1fb45ac520a7e8b928be424411343a20bba7/aliases -O ~/.aliases
#################
# Install Pip
#################
if ! [ -x "$(command -v pip)" ]; then
pushd /tmp
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
popd
fi
#################
# Python Packages
#################
# stevedore is required by virtualenvwrapper for dynamic module loading
if ! [ -x "$(command -v virtualenvwrapper)" ]; then
sudo pip install —no-deps stevedore virtualenvwrapper
fi
# Ansible because we have to
if ! [ -x "$(command -v ansible)" ]; then
sudo pip install —no-deps ansible
fi
# pep8
if ! [ -x "$(command -v pep8)" ]; then
sudo pip install pep8
fi
# pylint
if ! [ -x "$(command -v pylint)" ]; then
sudo pip install pylint
fi
# iredis
# https://iredis.io/
if ! [ -x "$(command -v iredis)" ]; then
sudo pip install iredis
fi
#################
# Vscode Plugins
#################
if ! [ -x "$(command -v code)" ]; then
echo "VScode "code" command wasn't found. Once created, run the following:"; echo
fi
# https://marketplace.visualstudio.com/items?itemName=42Crunch.vscode-openapi
# Support for OpenAPI, previously Swagger, in JSON or YAML format
vscode_install 42Crunch.vscode-openapi
# https://marketplace.visualstudio.com/items?itemName=felixfbecker.eamodio.gitlens
# Visualize Git blames and inline annotations
vscode_install felixfbecker.eamodio.gitlens
# https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-intellisense
# PHP autocomplete and signature help and workspace symbol search
vscode_install felixfbecker.php-intellisense
# https://marketplace.visualstudio.com/items?itemName=jeremyljackson.vs-docblock
# Docblocks for C, Java, JavaScript, PHP, SCSS, TypeScript, Vue.js
vscode_install jeremyljackson.vs-docblock
# https://marketplace.visualstudio.com/items?itemName=mauve.terraform
# Terraform autocomplete, highlighting, linting, formatting, etc
vscode_install mauve.terraform
# https://marketplace.visualstudio.com/items?itemName=mjmcloug.vscode-elixir
# Elixir syntax hiughlighting, snippets, autocomplete
vscode_install mjmcloug.vscode-elixir
# https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker
# Docker autocomplete, image and network views, Docker Compose autocomplete
vscode_install ms-azuretools.vscode-docker
# https://marketplace.visualstudio.com/items?itemName=ms-kubernetes-tools.vscode-kubernetes-tools
# Kubernetes autocomplete and command runs
vscode_install ms-kubernetes-tools.vscode-kubernetes-tools
# https://marketplace.visualstudio.com/items?itemName=ms-python.python
# Python autocomplete and support
vscode_install ms-python.python
# https://marketplace.visualstudio.com/items?itemName=ms-vscode.Go
# Golang autocomplete and support
vscode_install ms-vscode.Go
# https://marketplace.visualstudio.com/items?itemName=mtxr.sqltools
# Runn commands on MySQL, MSSQL, Postgres, Redshift, Cassandra, MariaDB, SAPHana, SQLite, OracleDB
vscode_install mtxr.sqltools
# https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring
# Generate docstrings for Python
vscode_install njpwerner.autodocstring
# https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml
# YAML support
vscode_install redhat.vscode-yaml
# https://marketplace.visualstudio.com/items?itemName=tht13.python
# Python linting with pylintrc (pyLint) or setup.cfg (flake8)
vscode_install tht13.python
# https://marketplace.visualstudio.com/items?itemName=vscoss.vscode-ansible
# Ansible autocomplete and support
vscode_install vscoss.vscode-ansible
# https://marketplace.visualstudio.com/items?itemName=ZainChen.json
# JSON support
vscode_install ZainChen.json
#################
# Install Terraform Versions
#################
tfenv install 0.12.29
tfenv install 0.13.2
#################
# Install Python Versions
#################
pyenv install 2.7.14
pyenv install 3.6.5
pyenv install 3.7.6
pyenv install 3.8.1
pyenv global 3.8.1
#################
# Global Pip install
#################
pip install jenkins-job-builder # Deploy Jenkins Job in YAML or JSON
#################
# Python Extas
#################
# Install Poetry
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
# Add Poetry autocomplete to zsh
mkdir $ZSH/plugins/poetry
poetry completions zsh > $ZSH/plugins/poetry/_poetry
#################
# ZSH Config
#################
echo "source ~/.initrc" >> .zshrc
echo "source ~/.aliases" >> .zshrc
sed -i '' 's/ZSH_THEME=.*/ZSH_THEME="af-magic"/g' .zshrc
sed -i '' "s/plugins=.*/plugins=(git colored-man colorize github jira vagrant virtualenv py brew osxzsh-syntax-highlighting poetry)/g" .zshrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment