Skip to content

Instantly share code, notes, and snippets.

@AlexRogalskiy
Last active July 14, 2022 07:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexRogalskiy/f3cb008d3381a9b041ab2df5df67aa7c to your computer and use it in GitHub Desktop.
Save AlexRogalskiy/f3cb008d3381a9b041ab2df5df67aa7c to your computer and use it in GitHub Desktop.
Soft tools
"Gotta be first
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
" ----- Making Vim look good ------------------------------------------
"Plugin 'joshdick/onedark.vim'
Plugin 'sheerun/vim-polyglot'
Plugin 'itchyny/lightline.vim'
" ----- Vim as a programmer's text editor -----------------------------
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'vim-syntastic/syntastic'
Plugin 'nvie/vim-flake8'
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-easytags'
Plugin 'majutsushi/tagbar'
Plugin 'kien/ctrlp.vim'
Plugin 'davidhalter/jedi-vim'
Plugin 'vim-scripts/indentpython.vim'
" ----- Working with Git ----------------------------------------------
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-fugitive'
" ----- Other text editing features -----------------------------------
Plugin 'Raimondi/delimitMate'
call vundle#end()
filetype plugin indent on
" --- General settings ---
set backspace=indent,eol,start
" Show the cursor position
set ruler
" Enable hybrid line numbers
set number
" Show the (partial) command as it’s being typed
set showcmd
" Highlight dynamically as pattern is typed
set incsearch
" Highlight searches
set hlsearch
" Don’t reset cursor to start of line when moving around.
set nostartofline
" Don’t show the intro message when starting Vim
set shortmess=atI
syntax on
set mouse=a
set encoding=utf-8
let python_highlight_all=1
set clipboard=unnamed
" ----- PEP 8 -----
au BufNewFile,BufRead *.py
\ set tabstop=4|
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=79 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix
" ----- Line markers at 79 characters -----
set colorcolumn=79
" ----- Plugin-Specific Settings --------------------------------------
" ----- altercation/vim-colors-solarized settings -----
" Toggle this to "light" for light colorscheme
set background=dark
" Uncomment the next line if your terminal is not configured for solarized
"let g:solarized_termcolors=256
" Set the colorscheme
"colorscheme onedark
" ----- bling/vim-airline settings -----
" Always show statusbar
set laststatus=2
" Fancy arrow symbols, requires a patched font
" To install a patched font, run over to
" https://github.com/abertsch/Menlo-for-Powerline
" download all the .ttf files, double-click on them and click "Install"
" Finally, uncomment the next line
let g:airline_powerline_fonts = 1
" Show PASTE if in paste mode
let g:airline_detect_paste=1
" Show airline for tabs too
let g:airline#extensions#tabline#enabled = 1
" ----- joshdark/onedark.vim -----
" " lightline enable
let g:airline_theme = 'onedark'
" ----- jistr/vim-nerdtree-tabs -----
" " Open/close NERDTree Tabs with \t
nmap <silent> <leader>t :NERDTreeTabsToggle<CR>
" " To have NERDTree always open on startup
let g:nerdtree_tabs_open_on_console_startup = 0
" ----- scrooloose/syntastic settings -----
let g:syntastic_error_symbol = '✘'
let g:syntastic_warning_symbol = "▲"
augroup mySyntastic
au!
au FileType tex let b:syntastic_mode = "passive"
augroup END
" ----- xolox/vim-easytags settings -----
" Where to look for tags files
set tags=./tags;,~/.vimtags
" Sensible defaults
let g:easytags_events = ['BufReadPost', 'BufWritePost']
let g:easytags_async = 1
let g:easytags_dynamic_files = 2
let g:easytags_resolve_links = 1
let g:easytags_suppress_ctags_warning = 1
" ----- majutsushi/tagbar settings -----
" Open/close tagbar with \b
nmap <silent> <leader>b :TagbarToggle<CR>
" Uncomment to open tagbar automatically whenever possible
"autocmd BufEnter * nested :call tagbar#autoopen(0)
" ----- airblade/vim-gitgutter settings -----
" Required after having changed the colorscheme
hi clear SignColumn
" In vim-airline, only display 'hunks' if the diff is non-zero
let g:airline#extensions#hunks#non_zero_only = 1
" ----- Raimondi/delimitMate settings -----
let delimitMate_expand_cr = 1
augroup mydelimitMate
au!
au FileType markdown let b:delimitMate_nesting_quotes = ["`"]
au FileType tex let b:delimitMate_quotes = ""
au FileType tex let b:delimitMate_matchpairs = "(:),[:],{:},`:'"
au FileType python let b:delimitMate_nesting_quotes = ['"', "'"]
augroup END
tap "adoptopenjdk/openjdk"
tap "caskformula/caskformula"
tap "cjbassi/ytop"
tap "dart-lang/dart"
tap "eth-p/software"
tap "getantibody/tap"
tap "github/gh"
tap "heroku/brew"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/cask-versions"
tap "homebrew/core"
tap "homebrew/services"
tap "sass/sass"
tap wix/brew
tap 'artsy/formulas'
tap 'mongodb/brew'
brew 'mongodb-community@4.4', link: true, restart_service: true
brew 'elasticsearch@5.6', restart_service: true
brew install applesimutils
brew install yarn
brew install watchman
brew install node
brew "openssl@1.1"
brew "readline"
brew "python@3.8"
brew "asciinema"
brew "autoconf"
brew "automake"
brew "autopep8"
brew "bat"
brew "bfg"
brew "glib"
brew "cloc"
brew "cmake"
brew "cookiecutter"
brew "coreutils"
brew "ctags"
brew "dos2unix"
brew "exa"
brew "fzf"
brew "git-delta"
brew "git-lfs"
brew "glib-networking"
brew "libksba"
brew "gnu-sed"
brew "gradle"
brew "grep"
brew "icu4c"
brew "libusbmuxd", args: ["HEAD"]
brew "ideviceinstaller"
brew "libtool"
brew "imagemagick"
brew "ios-deploy"
brew "jenv"
brew "jq"
brew "less"
brew "libyaml"
brew "mpg123"
brew "mysql"
brew "nano"
brew "zlib"
brew "neomutt"
brew "neovim"
brew "ondir"
brew "open-mpi"
brew "openslide"
brew "pinentry-mac"
brew "pipenv"
brew "pkg-config"
brew "portaudio"
brew "postgresql"
brew "pypy3"
brew "pyqt"
brew "r"
brew "redis"
brew "rpl"
brew "ruby-install"
brew "sshfs"
brew "trash"
brew "travis"
brew "tree"
brew "uncrustify"
brew "yarn"
brew "yq"
brew "bundle"
brew "rustup-init"
brew "cjbassi/ytop/ytop"
brew "eth-p/software/bat-extras"
brew "getantibody/tap/antibody"
brew "github/gh/gh"
brew "cmake"
brew "ccache"
brew "ninja"
brew "freetype"
brew "cmocka"
brew "swig"
brew "coreutils"
cask "osxfuse"
cask "adoptopenjdk14"
cask "android-platform-tools"
cask "atom"
tap "homebrew/cask-fonts"
tap "zero-sh/tap"
brew "mas" # Mac App Store command-line interface | 🔗 https://github.com/mas-cli/mas
brew "git" # Git | 🔗 https://git-scm.com/
brew "gh" # GitHub CLI | 🔗 https://github.com/cli/cli
brew "node" # Node.js | 🔗 https://nodejs.org/en/
brew "nvm" # NVM - Node Version Manager | 🔗 https://github.com/nvm-sh/nvm
brew "thefuck" # Helps to corrects previous console command. | 🔗 https://github.com/nvbn/thefuck
brew "gitmoji" # Using emojis on commits. | 🔗 https://github.com/carloscuesta/gitmoji-cli
brew "terminal-notifier" # Receive notifications from terminal | | 🔗 https://github.com/julienXX/terminal-notifier
brew "wget" # Download anythings with wget | 🔗 https://www.gnu.org/software/wget/
brew "tldr" # cheatsheets for console commands | 🔗 https://github.com/tldr-pages/tldr
# 🌐 Browsers
cask "google-chrome" # Google Chrome
# 🖥 Developer Tools
cask "github" # Github Desktop App | 🔗 https://desktop.github.com/
cask "fork" # Git client | 🔗 https://git-fork.com/
cask "webstorm" # JavaScript IDE | 🔗 https://www.jetbrains.com/webstorm/
cask "visual-studio-code" # VS Code | 🔗 https://code.visualstudio.com/
cask "sublime-text" # Sublime Text | 🔗 https://www.sublimetext.com/
cask "intellij-idea-ce" # Intellij IDEA | 🔗 https://www.jetbrains.com/idea/
cask "mongodb-compass" # MongoDB Compass | 🔗 https://www.mongodb.com/products/compass
cask "postman" # Postman - The Collaboration Platform for API Development | 🔗 https://www.postman.com/
cask "docker" # Docker | 🔗 https://www.docker.com/
mas "Xcode", id: 497799835
# 🚀 Productivity
cask "skype" # Skype | 🔗 https://www.skype.com/
cask "figma" # Figma - the collaborative interface design tool | 🔗 https://www.figma.com
cask "maccy" # Maccy - macOS clipboard | 🔗 https://maccy.app/
cask "muzzle" # Muzzle - app to silence notifications while screensharing | 🔗 https://muzzleapp.com/
cask "notion" # Notion - notes, tasks, wiki | 🔗 https://www.notion.so/
cask "numi" # Numi - Beautiful calculator app for Mac | 🔗 https://numi.app/
cask "raycast" # Raycast - Spotlight replacement | 🔗 https://www.raycast.com/
mas "1Password 7 - Password Manager", id: 1333542190 # 1Password - Password manager | 🔗 https://1password.com/
mas "Slack for Desktop", id: 803453959 # Slack | 🔗 https://slack.com/intl/en-ua/
mas "Magnet", id: 441258766 # Magnet - Arrange windows with shourtcuts | ❗️💳 PAID | 🔗 https://apps.apple.com/us/app/magnet/id441258766
mas "Noizio", id: 928871589 # Noizio - focus sounds | ❗️💳 PAID | 🔗 https://noiz.io/
mas "Bear", id: 1091189122 # Bear - Markdown notes | 🔗 https://bear.app/
mas "MeetingBar", id: 1532419400 # MeetingBar - shows your calendar events in the status bar | 🔗 https://github.com/leits/MeetingBar
mas "Gifski", id: 1351639930 # Gifski - converts videos to high-quality GIFs | 🔗 https://gif.ski/
mas "OpenIn - Advanced Link Handler", id: 1547147101 # OpenIn - select browser for each link | ❗️💳 PAID | 🔗 https://loshadki.app/openin/
mas "PDF Expert", id: 1055273043 # PDF Expert - PDF editor | 🔗 https://pdfexpert.com/
# 💬 Social
mas "Telegram", id: 747648890 # Telegram - instant messaging | 🔗 https://telegram.org/
# 🛠 Tools
cask "appcleaner" # AppCleaner - uninstall unwanted apps | 🔗 https://freemacsoft.net/appcleaner/
# Other
mas "Unsplash Wallpapers", id: 1284863847 # Unsplash Wallpapers - beautiful wallpapers | 🔗 https://unsplash.com/wallpapers
# 🌐 Safari extensions
mas "AdGuard for Safari", id: 1440147259 # AdGuard for Safari - Ads blocker | 🔗 https://adguard.com/
mas "Grammarly for Safari", id: 1462114288 # Grammarly for Safari - Online Writing Assistant | 🔗 https://app.grammarly.com/
mas "Save to Raindrop.io", id: 1549370672 # Raindrop - All-in-one bookmark manager | 🔗 https://raindrop.io/
# 🔠 FONTS
brew "font-fira-code"
brew "font-roboto"
brew "font-jetbrains-mono"
brew "font-hasklig"
brew "font-source-code-pro"
cask "docker"
cask "firefox"
cask "font-firacode-nerd-font"
cask "font-jetbrainsmono-nerd-font"
cask "google-chrome"
cask "gpg-suite-no-mail"
cask "java11"
cask "jgrasp"
cask "keybase"
cask "michaelvillar-timer"
cask "postman"
cask "rstudio"
cask "visual-studio-code"
cask "zoomus"

Install brew

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

# Homebrew
alias brewc='brew cleanup'
alias brewi='brew install'
alias brewL='brew leaves'
alias brewl='brew list'
alias brewo='brew outdated'
alias brews='brew search'
alias brewu='brew upgrade'
alias brewx='brew uninstall'

# Homebrew Cask
alias caski='brew install --cask'
alias caskl='brew list --cask'
alias casko='brew outdated --cask'
alias casks='brew search --cask'
alias casku='brew upgrade --cask'
alias caskx='brew uninstall --cask'

alias cai='cask install'
alias cau='cask update'
alias caI='cask init'
alias cae='cask exec'

# Make sure we’re using the latest Homebrew
echo 'Update hombrew…'
brew update

# Upgrade any already-installed formulae
echo 'Upgrade hombrew…'
brew upgrade

# add to .bash_profile (recommended) or .bashrc
export PATH="/usr/local/bin:$PATH"
sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells'
chsh -s /usr/local/bin/bash

# Install GNU core utilities (those that come with OS X are outdated)
brew install coreutils
# echo "Don’t forget to add $(brew --prefix coreutils)/libexec/gnubin to \$PATH."

# Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
brew install findutils

# Install Bash 4
brew install bash

brew cleanup
npm cache clean --force
yarn cache clean
docker system prune
xcrun simctl delete unavailable
rm -rf ~/.Trash/*

# Brew casks
echo "Install apps and fonts with with 'brew cask' …"

# Must be pre-installed for Inkscape
brew install xquartz

brew install librsvg
brew install ripgrep

brew tap dbcli/tap
brew install athenacli
brew install litecli
brew install pgcli

# Install more recent versions of some OS X tools
# brew tap homebrew/dupes
# TODO

# Miscellaneous
brews=(
  # ag
  bat
  # colordiff
  # csvkit  # Utilities for converting to and working with CSV
  diskus
  dockutil
  exa
  # exiftool
  fd
  fnm
  # fdupes
  fish
  gcal
  git
  git-extras
  gnu-sed
  # gnuplot  # A graph plotter with support for various formats
  # go  # Go programming language
  gopass
  # graphviz
  htop
  # httpie
  # hunspell
  # imagemagick
  # kubectl
  mas
  # micro
  # mongodb
  # node
  mpv  # Media player
  # ocrmypdf  # Add an OCR text layer to scanned PDF files
  # optipng
  # osx-cpu-temp
  # pandoc
  # pandoc-citeproc
  pinentry-mac  # Needed for gopass
  pkg-config  # Necessary for stack
  # platypus  # CLI tool only (GUI gets installed with brew cask)
  # poppler
  ripgrep
  # ruby  # Programming language
  rustup-init  # Installer for Rust programming language
  # s3cmd  # Command-line tool for the Amazon S3 service
  # shellcheck  # Linter for bash scripts
  stack  # Haskell tool stack
  tealdeer  # Fast implementation of tldr in Rust
  # tokei  # Display statistics about code
  topgrade
  trash
  translate-shell
  tree
  # tesseract  # OCR (Optical Character Recognition) tool
  # tesseract-lang  # All supported languages
  # uchardet  # Encoding detection library
  # watchexec  # Executes commands in response to file modifications
  # xsv  # CSV command line toolkit written in Rust
  # yarn
  zoxide
)

for brew in "${brews[@]}"
do
  brew install "$brew"
done

casks=(
  affinity-photo
  affinity-designer
  # alfred
  # arduino
  # android-file-transfer
  # atom
  # automap-server FIXME: missing
  # betterzipql  # Preview archives  FIXME: missing
  brave-browser
  # blender
  # calibre
  # cheatsheet
  # chromium
  # cloudcompare FIXME: missing
  # db-browser-for-sqlite
  # dedrm FIXME: missing
  discord
  # disk-inventory-x
  docker
  dropbox
  # duet
  # electron-cash
  # electrum
  element
  # emacs
  # filezilla
  firefox
  # flux
  # fman  # Dual pane file manager
  # forklift  # Better file manager than Finder
  # franz
  # fritzing
  font-hasklug-nerd-font
  gimp
  # gitup
  # google-chrome
  # google-cloud-sdk
  # handbrake
  # hex-fiend
  # homebrew/cask-versions/microsoft-remote-desktop-beta
  # ichm
  # imageplay
  # inkscape
  iterm2
  # kindle
  # kindlegen
  # librecad
  # libreoffice
  logitech-options
  # mactex  # Full installation:
  mactex-no-gui  # Full installation without bundled applications
  mas  # Mac App Store command line interface
  # microsoft-remote-desktop-beta
  # mongodb-compass
  # musescore
  night-owl
  notion
  # nvidia-geforce-now
  # onyx
  # opera
  # platypus
  qlstephen  # Preview plain text files without a file extension
  # quicksilver
  # rawtherapee
  # send-to-kindle
  shiftit
  # sigil
  # silverlight
  # sketch
  # sketchup
  # skype
  # slack
  # slic3r
  # squeak FIXME: missing
  # sourcetree
  # speedcrunch    #  Calculator
  spotify
  sublime-merge
  sublime-text
  # table-tool
  # tad
  # teensy
  telegram
  # texstudio
  # textmate
  thunderbird
  # tor-browser
  # tunnelblick BUGGY
  # universal-control FIXME: missing
  # vienna
  # virtualbox
  visual-studio-code
  vlc
  # vmware-fusion
  whatsapp
  xquartz
)

for cask in "${casks[@]}"
do
  brew install "$cask"
done

# Remove outdated versions from the cellar
brew cleanup

Install deb

# Cleans the cache.
alias debc='sudo apt-get clean && sudo apt-get autoclean'

# Displays a file's package.
alias debf='apt-file search --regexp'

# Installs packages from repositories.
alias debi='sudo apt-get install'

# Installs packages from files.
alias debI='sudo dpkg -i'

# Displays package information.
alias debq='apt-cache show'

# Updates the package lists.
alias debu='sudo apt-get update'

# Upgrades outdated packages.
alias debU='sudo apt-get update && sudo apt-get dist-upgrade'

# Removes packages.
alias debx='sudo apt-get remove'

# Removes packages, their configuration, and unneeded dependencies.
alias debX='sudo apt-get remove --purge && sudo apt-get autoremove --purge'

# Searches for packages.
if (( $+commands[aptitude] )); then
  alias debs='aptitude -F "* %p -> %d \n(%v/%V)" --no-gui --disable-columns search'
else
  alias debs='apt-cache search'
fi

# Creates a basic deb package.
alias deb-build='time dpkg-buildpackage -rfakeroot -us -uc'

# Removes all kernel images and headers, except for the ones in use.
alias deb-kclean='sudo aptitude remove -P "?and(~i~nlinux-(ima|hea) ?not(~n$(uname -r)))"'

Install web

open "https://google.com/search?q=$*"
open "http://www.thesaurus.com/browse/$*"
open "https://www.google.com/search?q=$*&btnI"
open "https://en.wikipedia.org/wiki/$*"
open "https://en.wiktionary.org/wiki/$1"

Install gopass

brew tap gopasspw/gopass
brew install gopass
gopass list --flat \
| rg "$@" \
| while read -r secret
  do
    echo "===== $secret ====="
    gopass "$secret"
    echo ""
  done

gopass show --clip "$@"

summon --provider conjur -f secrets.yml chef-client --once
summon --provider conjur -f secrets.yml docker run --env-file @SUMMONENVFILE myapp

Install qemu

brew update
brew install qemu
cd ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/
qemu-img info Docker.qcow2   # shows you current disk size
qemu-img resize Docker.qcow2 +100G  # make it 100GB larger
qemu-img info Docker.qcow2    # check the new size
qemu-system-x86_64 -drive file=Docker.qcow2  -m 512 -cdrom ~/Downloads/gparted-live-0.27.0-1-i686.iso -boot d -device usb-mouse -usb

docker run --rm --privileged debian:jessie df -h

Install sql

brew install pspg
pspg select * from user_tables;
pspg -s 17 --csv "datas.csv"

# add tap
$ brew tap xo/xo

# install xo
$ brew install xo

# install usql with "most" drivers
$ brew install usql

# install xo with oracle support
$ brew install --with-oracle xo

# install usql with oracle and odbc support
$ brew install --with-oracle --with-odbc usql

Install docker

brew install --cask ad-si/tap/perspec

brew install imagemagick
brew install ghostscript

curl -L \
	https://download.imagemagick.org/ImageMagick/download/binaries/ImageMagick-x86_64-apple-darwin20.1.0.tar.gz \
	-o imagemagick.tar.gz
tar -xzf imagemagick.tar.gz

rm -rf imagemagick
mv ImageMagick-7.* imagemagick

Install docker

# Docker
alias dk='docker'
alias dka='docker attach'
alias dkb='docker build'
alias dkd='docker diff'
alias dkdf='docker system df'
alias dke='docker exec'
alias dkE='docker exec -it'
alias dkh='docker history'
alias dki='docker images'
alias dkin='docker inspect'
alias dkim='docker import'
alias dkk='docker kill'
alias dkl='docker logs'
alias dkli='docker login'
alias dklo='docker logout'
alias dkls='docker ps'
alias dkp='docker pause'
alias dkP='docker unpause'
alias dkpl='docker pull'
alias dkph='docker push'
alias dkps='docker ps'
alias dkpsa='docker ps -a'
alias dkr='docker run'
alias dkR='docker run -it --rm'
alias dkRe='docker run -it --rm --entrypoint /bin/bash'
alias dkRM='docker system prune'
alias dkrm='docker rm'
alias dkrmi='docker rmi'
alias dkrn='docker rename'
alias dks='docker start'
alias dkS='docker restart'
alias dkss='docker stats'
alias dksv='docker save'
alias dkt='docker tag'
alias dktop='docker top'
alias dkup='docker update'
alias dkV='docker volume'
alias dkv='docker version'
alias dkw='docker wait'
alias dkx='docker stop'

## Container (C)
alias dkC='docker container'
alias dkCa='docker container attach'
alias dkCcp='docker container cp'
alias dkCd='docker container diff'
alias dkCe='docker container exec'
alias dkCin='docker container inspect'
alias dkCk='docker container kill'
alias dkCl='docker container logs'
alias dkCls='docker container ls'
alias dkCp='docker container pause'
alias dkCpr='docker container prune'
alias dkCrn='docker container rename'
alias dkCS='docker container restart'
alias dkCrm='docker container rm'
alias dkCr='docker container run'
alias dkCR='docker container run -it --rm'
alias dkCRe='docker container run -it --rm --entrypoint /bin/bash'
alias dkCs='docker container start'
alias dkCss='docker container stats'
alias dkCx='docker container stop'
alias dkCtop='docker container top'
alias dkCP='docker container unpause'
alias dkCup='docker container update'
alias dkCw='docker container wait'

## Image (I)
alias dkI='docker image'
alias dkIb='docker image build'
alias dkIh='docker image history'
alias dkIim='docker image import'
alias dkIin='docker image inspect'
alias dkIls='docker image ls'
alias dkIpr='docker image prune'
alias dkIpl='docker image pull'
alias dkIph='docker image push'
alias dkIrm='docker image rm'
alias dkIsv='docker image save'
alias dkIt='docker image tag'

## Volume (V)
alias dkV='docker volume'
alias dkVin='docker volume inspect'
alias dkVls='docker volume ls'
alias dkVpr='docker volume prune'
alias dkVrm='docker volume rm'

## Network (N)
alias dkN='docker network'
alias dkNs='docker network connect'
alias dkNx='docker network disconnect'
alias dkNin='docker network inspect'
alias dkNls='docker network ls'
alias dkNpr='docker network prune'
alias dkNrm='docker network rm'

## System (Y)
alias dkY='docker system'
alias dkYdf='docker system df'
alias dkYpr='docker system prune'

## Stack (K)
alias dkK='docker stack'
alias dkKls='docker stack ls'
alias dkKps='docker stack ps'
alias dkKrm='docker stack rm'

## Swarm (W)
alias dkW='docker swarm'

## CleanUp (rm)
# Clean up exited containers (docker < 1.13)
alias dkrmC='docker rm $(docker ps -qaf status=exited)'
# Clean up dangling images (docker < 1.13)
alias dkrmI='docker rmi $(docker images -qf dangling=true)'
# Clean up dangling volumes (docker < 1.13)
alias dkrmV='docker volume rm $(docker volume ls -qf dangling=true)'

# Docker Machine (m)
alias dkm='docker-machine'
alias dkma='docker-machine active'
alias dkmcp='docker-machine scp'
alias dkmin='docker-machine inspect'
alias dkmip='docker-machine ip'
alias dkmk='docker-machine kill'
alias dkmls='docker-machine ls'
alias dkmpr='docker-machine provision'
alias dkmps='docker-machine ps'
alias dkmrg='docker-machine regenerate-certs'
alias dkmrm='docker-machine rm'
alias dkms='docker-machine start'
alias dkmsh='docker-machine ssh'
alias dkmst='docker-machine status'
alias dkmS='docker-machine restart'
alias dkmu='docker-machine url'
alias dkmup='docker-machine upgrade'
alias dkmv='docker-machine version'
alias dkmx='docker-machine stop'

# Docker Compose (c)
alias dkc='docker-compose'
alias dkcb='docker-compose build'
alias dkcB='docker-compose build --no-cache'
alias dkcd='docker-compose down'
alias dkce='docker-compose exec'
alias dkck='docker-compose kill'
alias dkcl='docker-compose logs'
alias dkcls='docker-compose ps'
alias dkcp='docker-compose pause'
alias dkcP='docker-compose unpause'
alias dkcpl='docker-compose pull'
alias dkcph='docker-compose push'
alias dkcps='docker-compose ps'
alias dkcr='docker-compose run'
alias dkcR='docker-compose run --rm'
alias dkcrm='docker-compose rm'
alias dkcs='docker-compose start'
alias dkcsc='docker-compose scale'
alias dkcS='docker-compose restart'
alias dkcu='docker-compose up'
alias dkcU='docker-compose up -d'
alias dkcv='docker-compose version'
alias dkcx='docker-compose stop'

images=(
  alpine
  go
  haskell
  node
  python
  ruby
  rust
  ubuntu
)

echo "Pull various Docker images…"

for image in "${images[@]}"
do
  docker pull "$image"
done

Install lektor

curl -sf https://www.getlektor.com/installer.py | sudo python3

Install dnf

alias dnfc='sudo dnf clean all'    # Cleans the cache.
alias dnfh='dnf history'           # Displays history.
alias dnfi='sudo dnf install'      # Installs package(s).
alias dnfl='dnf list'              # Lists packages.
alias dnfL='dnf list installed'    # Lists installed packages.
alias dnfq='dnf info'              # Displays package information.
alias dnfr='sudo dnf remove'       # Removes package(s).
alias dnfs='dnf search'            # Searches for a package.
alias dnfu='sudo dnf update'       # Updates packages.
alias dnfU='sudo dnf upgrade'      # Upgrades packages.

Install git

# Git
alias g='git'

# Branch (b)
alias gb='git branch'
alias gba='git branch --all --verbose'
alias gbc='git checkout -b'
alias gbd='git branch --delete'
alias gbD='git branch --delete --force'
alias gbl='git branch --verbose'
alias gbL='git branch --all --verbose'
alias gbm='git branch --move'
alias gbM='git branch --move --force'
alias gbr='git branch --move'
alias gbR='git branch --move --force'
alias gbs='git show-branch'
alias gbS='git show-branch --all'
alias gbv='git branch --verbose'
alias gbV='git branch --verbose --verbose'
alias gbx='git branch --delete'
alias gbX='git branch --delete --force'

# Commit (c)
alias gc='git commit --verbose'
alias gcS='git commit --verbose --gpg-sign'
alias gca='git commit --verbose --all'
alias gcaS='git commit --verbose --all --gpg-sign'
alias gcm='git commit --message'
alias gcmS='git commit --message --gpg-sign'
alias gcam='git commit --all --message'
alias gco='git checkout'
alias gcO='git checkout --patch'
alias gcf='git commit --amend --reuse-message HEAD'
alias gcfS='git commit --amend --reuse-message HEAD --gpg-sign'
alias gcF='git commit --verbose --amend'
alias gcFS='git commit --verbose --amend --gpg-sign'
alias gcp='git cherry-pick --ff'
alias gcP='git cherry-pick --no-commit'
alias gcr='git revert'
alias gcR='git reset "HEAD^"'
alias gcs='git show'
alias gcsS='git show --pretty=short --show-signature'
alias gcl='git-commit-lost'
alias gcy='git cherry --verbose --abbrev'
alias gcY='git cherry --verbose'

# Conflict (C)
alias gCl='git --no-pager diff --name-only --diff-filter=U'
alias gCa='git add $(gCl)'
alias gCe='git mergetool $(gCl)'
alias gCo='git checkout --ours --'
alias gCO='gCo $(gCl)'
alias gCt='git checkout --theirs --'
alias gCT='gCt $(gCl)'

# Data (d)
alias gd='git ls-files'
alias gdc='git ls-files --cached'
alias gdx='git ls-files --deleted'
alias gdm='git ls-files --modified'
alias gdu='git ls-files --other --exclude-standard'
alias gdk='git ls-files --killed'
alias gdi='git status --porcelain --short --ignored | sed -n "s/^!! //p"'

# Fetch (f)
alias gf='git fetch'
alias gfa='git fetch --all'
alias gfc='git clone'
alias gfcr='git clone --recurse-submodules'
alias gfm='git pull'
alias gfma='git pull --autostash'
alias gfr='git pull --rebase'
alias gfra='git pull --rebase --autostash'

# Flow (F)
alias gFi='git flow init'
alias gFf='git flow feature'
alias gFb='git flow bugfix'
alias gFl='git flow release'
alias gFh='git flow hotfix'
alias gFs='git flow support'

alias gFfl='git flow feature list'
alias gFfs='git flow feature start'
alias gFff='git flow feature finish'
alias gFfp='git flow feature publish'
alias gFft='git flow feature track'
alias gFfd='git flow feature diff'
alias gFfr='git flow feature rebase'
alias gFfc='git flow feature checkout'
alias gFfm='git flow feature pull'
alias gFfx='git flow feature delete'

alias gFbl='git flow bugfix list'
alias gFbs='git flow bugfix start'
alias gFbf='git flow bugfix finish'
alias gFbp='git flow bugfix publish'
alias gFbt='git flow bugfix track'
alias gFbd='git flow bugfix diff'
alias gFbr='git flow bugfix rebase'
alias gFbc='git flow bugfix checkout'
alias gFbm='git flow bugfix pull'
alias gFbx='git flow bugfix delete'

alias gFll='git flow release list'
alias gFls='git flow release start'
alias gFlf='git flow release finish'
alias gFlp='git flow release publish'
alias gFlt='git flow release track'
alias gFld='git flow release diff'
alias gFlr='git flow release rebase'
alias gFlc='git flow release checkout'
alias gFlm='git flow release pull'
alias gFlx='git flow release delete'

alias gFhl='git flow hotfix list'
alias gFhs='git flow hotfix start'
alias gFhf='git flow hotfix finish'
alias gFhp='git flow hotfix publish'
alias gFht='git flow hotfix track'
alias gFhd='git flow hotfix diff'
alias gFhr='git flow hotfix rebase'
alias gFhc='git flow hotfix checkout'
alias gFhm='git flow hotfix pull'
alias gFhx='git flow hotfix delete'

alias gFsl='git flow support list'
alias gFss='git flow support start'
alias gFsf='git flow support finish'
alias gFsp='git flow support publish'
alias gFst='git flow support track'
alias gFsd='git flow support diff'
alias gFsr='git flow support rebase'
alias gFsc='git flow support checkout'
alias gFsm='git flow support pull'
alias gFsx='git flow support delete'

# Grep (g)
alias gg='git grep'
alias ggi='git grep --ignore-case'
alias ggl='git grep --files-with-matches'
alias ggL='git grep --files-without-matches'
alias ggv='git grep --invert-match'
alias ggw='git grep --word-regexp'

# Index (i)
alias gia='git add'
alias giA='git add --patch'
alias giu='git add --update'
alias gid='git diff --no-ext-diff --cached'
alias giD='git diff --no-ext-diff --cached --word-diff'
alias gii='git update-index --assume-unchanged'
alias giI='git update-index --no-assume-unchanged'
alias gir='git reset'
alias giR='git reset --patch'
alias gix='git rm -r --cached'
alias giX='git rm -r --force --cached'

# Log (l)
alias gl='git log --topo-order --pretty=format:"$_git_log_medium_format"'
alias gls='git log --topo-order --stat --pretty=format:"$_git_log_medium_format"'
alias gld='git log --topo-order --stat --patch --full-diff --pretty=format:"$_git_log_medium_format"'
alias glo='git log --topo-order --pretty=format:"$_git_log_oneline_format"'
alias glg='git log --topo-order --graph --pretty=format:"$_git_log_oneline_format"'
alias glb='git log --topo-order --pretty=format:"$_git_log_brief_format"'
alias glc='git shortlog --summary --numbered'
alias glS='git log --show-signature'

# Merge (m)
alias gm='git merge'
alias gmC='git merge --no-commit'
alias gmF='git merge --no-ff'
alias gma='git merge --abort'
alias gmt='git mergetool'

# Push (p)
alias gp='git push'
alias gpf='git push --force-with-lease'
alias gpF='git push --force'
alias gpa='git push --all'
alias gpA='git push --all && git push --tags'
alias gpt='git push --tags'
alias gpc='git push --set-upstream origin "$(git-branch-current 2> /dev/null)"'
alias gpp='git pull origin "$(git-branch-current 2> /dev/null)" && git push origin "$(git-branch-current 2> /dev/null)"'

# Rebase (r)
alias gr='git rebase'
alias gra='git rebase --abort'
alias grc='git rebase --continue'
alias gri='git rebase --interactive'
alias grs='git rebase --skip'

# Remote (R)
alias gR='git remote'
alias gRl='git remote --verbose'
alias gRa='git remote add'
alias gRx='git remote rm'
alias gRm='git remote rename'
alias gRu='git remote update'
alias gRp='git remote prune'
alias gRs='git remote show'
alias gRb='git-hub-browse'

# Stash (s)
alias gs='git stash'
alias gsa='git stash apply'
alias gsx='git stash drop'
alias gsX='git-stash-clear-interactive'
alias gsl='git stash list'
alias gsL='git-stash-dropped'
alias gsd='git stash show --patch --stat'
alias gsp='git stash pop'
alias gsr='git-stash-recover'
alias gss='git stash save --include-untracked'
alias gsS='git stash save --patch --no-keep-index'
alias gsw='git stash save --include-untracked --keep-index'

# Submodule (S)
alias gS='git submodule'
alias gSa='git submodule add'
alias gSf='git submodule foreach'
alias gSi='git submodule init'
alias gSI='git submodule update --init --recursive'
alias gSl='git submodule status'
alias gSm='git-submodule-move'
alias gSs='git submodule sync'
alias gSu='git submodule update --remote --recursive'
alias gSx='git-submodule-remove'

# Tag (t)
alias gt='git tag'
alias gtl='git tag --list'
alias gts='git tag --sign'
alias gtv='git verify-tag'

# Working Copy (w)
alias gws='git status --ignore-submodules=$_git_status_ignore_submodules --short'
alias gwS='git status --ignore-submodules=$_git_status_ignore_submodules'
alias gwd='git diff --no-ext-diff'
alias gwD='git diff --no-ext-diff --word-diff'
alias gwr='git reset --soft'
alias gwR='git reset --hard'
alias gwc='git clean --dry-run'
alias gwC='git clean --force'
alias gwx='git rm -r'
alias gwX='git rm -r --force'

Install macports

alias portc='sudo port clean --all installed'
alias porti='sudo port install'
alias ports='port search'
alias portU='sudo port selfupdate && sudo port upgrade outdated'
alias portu='sudo port upgrade'
alias portX='sudo port -u uninstall'
alias portx='sudo port uninstall'

Install sqlite3

sqlite3 "$db" 'DELETE FROM LSQuarantineEvent; VACUUM'
sqlite3 "$db" 'SELECT LSQuarantineDataURLString FROM LSQuarantineEvent'

Install perl

plenv init - --no-rehash zsh
alias pl='perl'
alias pld='perldoc'
alias ple='perl -wlne'

alias plb='perlbrew'
alias plba='perlbrew available'
alias plbi='perlbrew install'
alias plbl='perlbrew list'
alias plbo='perlbrew off'
alias plbO='perlbrew switch-off'
alias plbs='perlbrew switch'
alias plbu='perlbrew use'
alias plbx='perlbrew uninstall'
  
alias plv='plenv'
alias plvc='plenv commands'
alias plvl='plenv local'
alias plvg='plenv global'
alias plvs='plenv shell'
alias plvi='plenv install'
alias plvu='plenv uninstall'
alias plvr='plenv rehash'
alias plvv='plenv version'
alias plvV='plenv versions'
alias plvw='plenv which'
alias plvW='plenv whence'
alias plvm='plenv list-modules'
alias plvM='plenv migrate-modules'
alias plvI='plenv install-cpanm'

Install curl/wget

alias aria2c='aria2c --continue --remote-time --max-tries=0'
alias curl ='curl --continue-at - --location --progress-bar --remote-name --remote-time'
alias wget = 'wget --continue --progress=bar --timestamping'

Install bundle

alias ror='bundle exec rails'
alias rorc='bundle exec rails console'
alias rordc='bundle exec rails dbconsole'
alias rordm='bundle exec rake db:migrate'
alias rordM='bundle exec rake db:migrate db:test:clone'
alias rordr='bundle exec rake db:rollback'
alias rorg='bundle exec rails generate'
alias rorl='tail -f "$(ruby-app-root)/log/development.log"'
alias rorlc='bundle exec rake log:clear'
alias rorp='bundle exec rails plugin'
alias rorr='bundle exec rails runner'
alias rors='bundle exec rails server'
alias rorsd='bundle exec rails server --debugger'
alias rorx='bundle exec rails destroy'

Install yum

alias yumc='sudo yum clean all'    # Cleans the cache.
alias yumh='yum history'           # Displays history.
alias yumi='sudo yum install'      # Installs package(s).
alias yuml='yum list'              # Lists packages.
alias yumL='yum list installed'    # Lists installed packages.
alias yumq='yum info'              # Displays package information.
alias yumr='sudo yum remove'       # Removes package(s).
alias yums='yum search'            # Searches for a package.
alias yumu='sudo yum update'       # Updates packages.
alias yumU='sudo yum upgrade'      # Upgrades packages.

Install latexmk

sudo tlmgr install latexmk

latexmk -pdf -pv myfile.tex
latexmk -xelatex -output-directory='.build' resume.tex

latexmk -C

cat << EOF
$dvi_previewer = 'start xdvi -watchfile 1.5';
$ps_previewer  = 'start gv --watch';
$pdf_previewer = 'start evince';

$pdf_previewer = 'open -a Skim';
$pdflatex = 'pdflatex -synctex=1 -interaction=nonstopmode';
@generated_exts = (@generated_exts, 'synctex.gz');
EOF
>> $HOME/.latexmkrc

Install tokei

# Homebrew
brew install tokei
# MacPorts
sudo port selfupdate
sudo port install tokei
# Manual
cargo install --git https://github.com/XAMPPRocky/tokei.git tokei
tokei ./foo
tokei ./foo --output json
tokei --columns 80

Install pandoc

brew install pandoc
pandoc -f markdown -t html5 --standalone "$1" | lynx -stdin
#pandoc -s -f markdown -t man $1 | groff -T utf8 -man | less
#markdown README.md | lynx -stdin
  pandoc \
    --pdf-engine pdflatex \
    --output "$outputName" \
    "$inputFile"

pandoc \
  --variable papersize:a4 \
  --variable margin-top:20mm \
  --variable margin-right:20mm \
  --variable margin-bottom:20mm \
  --variable margin-left:20mm \
  --output "$1".pdf \
  "$1"

pandoc $(SHARED_PANDOC_OPTIONS) \
		-t html5 \
		--standalone \
		-S \
		--toc \
		--chapters \
		"--metadata=subtitle:$(VERSION)" \
		--no-highlight \
		-c docs.css \
		-o docs/index.html \
		--base-header-level=2 \
		--template=docs/template.html \
	$(MD_SOURCES)

Install hasura

brew install datasette
pip3 install datasette
datasette serve path/to/database.db
datasette ~/Library/Application\ Support/Google/Chrome/Default/History
open http://localhost:8001/History/download
 
datasette serve fivethirtyeight.db -m metadata.json

cat >> metadata.json << EOF
{
    "title": "Five Thirty Eight",
    "license": "CC Attribution 4.0 License",
    "license_url": "http://creativecommons.org/licenses/by/4.0/",
    "source": "fivethirtyeight/data on GitHub",
    "source_url": "https://github.com/fivethirtyeight/data"
}
EOF

datasette publish heroku database.db
datasette publish cloudrun database.db

Install hasura

  • install client/server
# in a new directory run
wget https://raw.githubusercontent.com/hasura/graphql-engine/stable/install-manifests/docker-compose/docker-compose.yaml
# or run
curl https://raw.githubusercontent.com/hasura/graphql-engine/stable/install-manifests/docker-compose/docker-compose.yaml -o docker-compose.yml


curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | INSTALL_PATH=$HOME/bin bash
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | VERSION=v2.2.0 bash


# install as a devDependency of your project
npm install --save-dev hasura-cli[@tag|@version]

# or install globally on your system
npm install --global hasura-cli[@tag|@version]

# Bash
    # Linux
      # Add Bash completion file using:
      $ sudo hasura completion bash --file=/etc/bash_completion.d/hasura
    # Mac
      # Install bash-completion using homebrew:
      $ brew install bash-completion
      # Add to your ~/.bash_profile:
      if [ -f $(brew --prefix)/etc/bash_completion ]; then
          . $(brew --prefix)/etc/bash_completion
      fi
      # Add the completion file:
      $ sudo hasura completion bash --file=$(brew --prefix)/etc/bash_completion.d/hasura
    # Windows (Git Bash)
      # open git bash
      $ mkdir -p ~/.bash_completion.d
      # Add the completion file:
      $ cd ~ && hasura completion bash --file=.bash_completion.d/hasura
      # Add the following to ~/.bash_profile
        if [ -f ~/.bash_completion.d/hasura ]; then
          . ~/.bash_completion.d/hasura
        fi
      # restart git bash

  # Zsh (using oh-my-zsh)
    $ mkdir -p $HOME/.oh-my-zsh/completions
    $ hasura completion zsh --file=$HOME/.oh-my-zsh/completions/_hasura

  # Reload the shell for the changes to take effect!
  • command flags and options
hasura init "<folder>" --endpoint <endpoint> --admin-secret <secret>

hasura migrate create "<table>_<operation>_<name>"
hasura migrate status
hasura migrate apply
hasura migrate apply --version <migration_version>
hasura migrate apply --type down --version <migration_version>

hasura seed create "<table>_<operation>_<name>"
hasura seed apply
hasura seed apply --file seeds/<table>_<operation>_<name>.sql

hasura metadata export
hasura metadata apply
hasura metadata inconsistency list

hasura update-cli --version=2.4.0

Install docker

 sudo apt-get update
 sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
 
apt-cache madison docker-ce

sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
sudo docker run hello-world

docker save -o kubernetes-syslog-<version>.tar kubernetes-syslog:<version>
docker load -i kubernetes-syslog-<version>.tar

Install preoomkiller

Install (to /usr/local/bin): `$ curl -sSf https://raw.githubusercontent.com/izakp/docker-preoomkiller/master/install-preoomkiller.sh | sh`
Use:
  - Put this in your docker-entrypoint script to run in the background): `exec /usr/local/bin/preoomkiller &`
  - Set ENABLE_PREOOMKILLER=1 in the container's environment to enable
  - Set PREOOMKILLER_MEMORY_USE_FACTOR, PREOOMKILLER_POLL_INTERVAL, PREOOMKILLER_KILL_SIGNAL, PREOOMKILLER_KILL_PID as desired

Install ffmpeg

curl https://ffmpeg.org/ffmpeg-devel.asc | gpg --import
gpg --verify ffmpeg-4.3.2.tar.xz.asc ffmpeg-4.3.2.tar.xz

VIDEO="Source/Stage15.mov"
AUDIO="../Assets/Audio/RE_15sec mixB_0911.wav"
RENDER="Render/Attack-15sec-Projection.mov"
PREVIEW="Render/Attack-15sec-Projection.mp4"

ffmpeg -y -i "$VIDEO" -r 59.94 -c:v hap -an "$RENDER"
ffmpeg -y -i "$RENDER" -i "$AUDIO" -pix_fmt yuv420p "$PREVIEW"

VIDEO="Source/Stage30.mov"
AUDIO="../Assets/Audio/30sec A 0912.wav"
RENDER="Render/Attack-30sec-Projection.mov"
PREVIEW="Render/Attack-30sec-Projection.mp4"

ffmpeg -y -i "$VIDEO" -r 59.94 -c:v hap -an "$RENDER"
ffmpeg -y -i "$RENDER" -i "$AUDIO" -pix_fmt yuv420p "$PREVIEW"

ffmpeg -i Temp.mov -vcodec copy -ss 4 -t 8 Room.mov

ffmpeg -y \
  -i Transition.mov \
  -c:v libvpx -b:v 10M -an \
  -pix_fmt yuva420p -auto-alt-ref 0 \
  -vf 'tmix=frames=7:weights="1 1 1 1 1 1 1"' \
  -r 30 \
  Transition.webm

ffmpeg -y \
  -i Bumper.mov -i ../Assets/Audio/Bumper.wav \
  -c:v libvpx -b:v 10M -b:a 120k \
  -pix_fmt yuva420p -auto-alt-ref 0 \
  -vf 'tmix=frames=7:weights="1 2 3 4 3 2 1"' \
  -r 30 \
  Bumper.webm

now="$(date -u "+%Y-%m-%dt%H%M")"
filename="${now}_webcam_shot.jpg"
outFile="${*:-$filename}"

ffmpeg \
  -f avfoundation \
  -video_size 1280x720 \
  -framerate 30 \
  -i 0 \
  -vframes 1 \
  "$outFile"

# Convert to .webm
ffmpeg \
  -i "$1" \
  -vcodec libvpx \
  -qmin 0 \
  -qmax 40 \
  -crf 4 \
  -b:v 3M \
  -acodec libvorbis \
  -movflags +faststart \
  -threads 0 \
  "$(echo "$1" | sed 's/\.[a-z]*$/\.webm/g')"

ffprobe -show_entries format=duration -v quiet -of csv=p=0 -i "$FILENAME"
ffplay -ss $1 -t ${2:-1} -loglevel quiet -nodisp -autoexit "$FILENAME"
ffmpeg ${2:+-ss $1} -t ${2:-$1} -i "$FILENAME" "$(echo $FILENAME | sed -e 's/\.\([^.]*\)$/.clipped.\1/')" && rm "$FILENAME"
ffplay -autoexit "$(echo $FILENAME | sed -e s/\.[^.]*$//)"*

# Convert to .webm
ffmpeg \
  -i "$1" \
  -vcodec h264 \
  -acodec aac \
  -crf 25 \
  -movflags +faststart \
  -threads 0 \
  "$(echo "$1" | sed 's/\.[a-z]*$/\.mp4/g')"

Install cargo

curl https://sh.rustup.rs -sSf | sh

curl https://sh.rustup.rs -sSf | sh

OPT="--release"
TARGET_ARM="aarch64-apple-darwin"
TARGET_X86="x86_64-apple-darwin"

cargo build $OPT --target=$TARGET_ARM
cargo build $OPT --target=$TARGET_X86

packages=(
  eva  # Basic calculator REPL
  hexyl  # Simple hex viewer for the terminal
  peep  # CLI text viewer that works like less on just a few lines
  unic-cli  # Tool for Unicode (generating, transforming, inspecting strings)
)

for package in "${packages[@]}"
do
  cargo install "$package"
done

Install wget

mkdir downloaded-images && cd downloaded-images
wget -r -l 1 -A jpeg,jpg,bmp,gif,png ${firstParameter}

Install envman

sh -c "$(curl -fsSL https://raw.githubusercontent.com/guarinogabriel/mac-cli/master/mac-cli/tools/update)"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/guarinogabriel/mac-cli/master/mac-cli/tools/uninstall)"

Install envman

envman add --key MY_TEST_ENV_KEY --value 'test value for test key'
envman run bash -c 'echo "Environment test: $MY_TEST_ENV_KEY"'
envman add --key SOME_KEY --value 'some value'
echo "some value" | envman add --key SOME_KEY
envman add --key SOME_KEY --valuefile /path/to/file/which/contains/the/value --expand false

Install aws

if ! which aws;
then
  echo "installing aws"
  # install awscli
  curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
  unzip -o -qq awscliv2.zip
  sudo ./aws/install

  # configure awscli
  mkdir -p ~/.aws
  touch ~/.aws/config
  echo "[default]" >> ~/.aws/config
  echo "region = us-east-1" >> ~/.aws/config
  echo "output = json" >> ~/.aws/config
else
  echo "aws already installed"
fi

Install atom

apm upgrade --no-confirm

packages=(
  AtLilyPond
  Stylus
  atom-terminal
  autocomplete-emojis
  autocomplete-paths
  autocomplete-plus
  coffee-compiler
  devdocs
  distraction-free-mode
  emmet
  file-type-icons
  file-types
  git-control
  git-plus
  hex
  language-arduino
  language-jade
  language-openscad
  language-smalltalk
  linter
  linter-coffeelint
  linter-jscs
  linter-jshint
  linter-shellcheck
  npm-docs
  preview-plus
  sort-lines
  tabs-to-spaces
  terminal-panel
  travis-ci-status
)

for package in "${packages[@]}"
do
  apm install "$package"
done

Install pipenv

brew install python3 # if you don't have pip already
brew install pipenv
pipenv --three
pipenv shell
pipenv install

Install nvm

# install nvm (Node Version Nanager, https://github.com/nvm-sh/nvm)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

echo 'NVM_DIR="$HOME/.nvm"' >> $BASHRC
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"' >> $BASHRC
    
NVM_DIR="$HOME/.nvm"
[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh"


nvm install $NODE_VERSION
nvm alias default $NODE_VERSION

Install crowdin

brew tap crowdin/crowdin
brew install crowdin@3

Install deno

brew install deno
curl -fsSL https://deno.land/x/install/install.sh | sh
iwr https://deno.land/x/install/install.ps1 -useb | iex
deno --version
deno run --reload=https://deno.land/std/http/server.ts index.js
deno run --reload index.js
deno run --reload=module1,moduleN index.js
deno run --reload=https://deno.land/std index.js

"lint": "deno lint --unstable --ignore=node_modules",
"fmt": "deno fmt --ignore=node_modules",
"fmt:check": "deno fmt --ignore=node_modules --check"

deno install --allow-read --allow-run --allow-write -f --unstable https://deno.land/x/denon/denon.ts 
denon index.ts

Install gibo

brew install gibo
gibo dump Swift Xcode >> .gitignore

Install bit.dev

npx @teambit/bvm install
npx @teambit/bvm upgrade
#!/bin/bash
ENV=$1
hub_domain_login='https://bitsrc.io/bit-login'
hub_domain='hub.bitsrc.io'
analytics_domain='https://analytics.bitsrc.io/'
registry='https://node.bitsrc.io'
if [[ -z $ENV ]] 
then
ENV='prodcution'
fi
echo 'setting config for env:' ${ENV}
if [  $ENV = 'stage'  ];
then
    hub_domain_login='https://stg.bitsrc.io/bit-login'
    hub_domain='hub-stg.bitsrc.io'
    analytics_domain='https://analytics-stg.bitsrc.io/'
    registry='https://node-stg.bitsrc.io'
fi
bit config set registry $registry
bit config set anonymous_reporting false
bit config set error_reporting false
bit config set analytics_reporting false
bit config set analytics_domain $analytics_domain
bit config set hub_domain_login $hub_domain_login
bit config set hub_domain $hub_domain
bit logout
bit login

Install godownloader

curl https://raw.githubusercontent.com/wjdp/htmltest/master/godownloader.sh | bash

Install antigen

echo "Installing antigen..."
curl -L git.io/antigen > ~/.antigen/antigen.zsh

Install spicetify

curl -fsSL https://raw.githubusercontent.com/spicetify/spicetify-cli/master/install.sh | sh
curl -fsSL https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/install.sh | sh
brew install khanhas/tap/spicetify-cli

Install kots

curl https://kots.io/install | bash

Install node

alias install-node="curl -sfLS https://install-node.vercel.app | bash -s --"
install-node 14 -y --prefix=$HOME/node14

alias npmi='npm install'
alias npml='npm list'
alias npmo='npm outdated'
alias npmp='npm publish'
alias npmP='npm prune'
alias npmr='npm run'
alias npms='npm search'
alias npmt='npm test'
alias npmu='npm update'
alias npmx='npm uninstall'

alias npmci='npm ci'
alias npmcit='npm cit'
alias npmit='npm it'

packages=(
  # forever
  insect              # Calculator
  # live-server         # Development server with auto reloading
  # markdown-link-check
  # msee                # Markdown terminal renderer
  # nodemon             # Development server for node.js
  npm-check-updates
  # pageres             # Capture website screenshots
  # pulp
  # purescript
  qrcode              # Display QR code as ANSI art
  # serverless
  # supervisor
  surge               # Deploy static websites
  # tldr              # Simple & community driven man pages (currently installed with brew)
  trash               # Move files and folders to the trash
)

npm install --global "${packages[@]}"

Install dotnet SDK

apt install apt-transport-https dirmngr gnupg ca-certificates -yq  \
    && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \
    && echo "deb https://download.mono-project.com/repo/debian stable-buster main" | tee /etc/apt/sources.list.d/mono-official-stable.list \
    && apt update -yq  \
    && apt install mono-devel -yq 

Install golang

curl -fsSL https://golang.org/dl/go1.16.8.linux-amd64.tar.gz | tar -C /usr/local -xz
PATH="${PATH}:/usr/local/go/bin"

packages=(
  gitbatch  # Manage git repositories in one place
)

for package in "${packages[@]}"
do
  go get -u "$package"
done

Install haskell

# Get Stack and GHC
curl -sSL https://get.haskellstack.org/ | sh -s - -d /usr/bin
stack setup --resolver ghc-$GHCVER
stack init --resolver nightly --ignore-subdirs
stack build --resolver nightly --haddock --test --bench --no-run-benchmarks

Install nodejs

curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && apt-get install -yq nodejs 

Install visual-studio

brew cask install visual-studio-code

Install watchman

brew install pcre
brew link pcre
brew install watchman --HEAD

Install yarn

npm install -g yarn

packages=(
  insect  # High precision scientific calculator with support for physical units
)

yarn global add "${packages[@]}"

Install nvm

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

Install asyncapi

npm install -g @asyncapi/generator
ag asyncapi.yaml @asyncapi/html-template
ag https://bit.ly/asyncapi @asyncapi/html-template
ag asyncapi.yaml @asyncapi/html-template -o ./docs
ag asyncapi.yaml @asyncapi/html-template -o ./docs -p title='Hello from param'

npx -p @asyncapi/generator ag ./asyncapi.yaml @asyncapi/html-template

docker run --rm -it \
-v [ASYNCAPI SPEC FILE LOCATION]:/app/asyncapi.yml \
-v [GENERATED FILES LOCATION]:/app/output \
asyncapi/generator [COMMAND HERE]

# Example that you can run inside generator directory after cloning this repository. First you specify mount in location of your AsyncAPI specification file and then you mount in directory where generation result should be saved.
docker run --rm -it \
-v ${PWD}/test/docs/dummy.yml:/app/asyncapi.yml \
-v ${PWD}/output:/app/output \
asyncapi/generator -o /app/output /app/asyncapi.yml @asyncapi/html-template --force-write

Install banzailint

BANZAILINT_VERSION = 0.0.1
curl -L https://github.com/banzaicloud/banzailint/releases/download/v${BANZAILINT_VERSION}/banzailint_${BANZAILINT_VERSION}_${OS}_amd64.tar.gz | tar -zOxf - banzailint > ./bin/banzailint-${BANZAILINT_VERSION} && chmod +x ./bin/banzailint-${BANZAILINT_VERSION}

Install cosign

# https://docs.sigstore.dev/cosign/installation/
brew install cosign
cosign version

# Sign all images from 'images' file

cosign --timeout 20m sign "$@" $(cat images)

Install kurun

brew install banzaicloud/tap/kurun
go get github.com/banzaicloud/kurun

python -m SimpleHTTPServer 4443
kurun port-forward --servicename python-server localhost:4443
kurun port-forward --servicename pipeline https://localhost:9090

kubectl create secret tls kurun-cert --cert "tls.crt" --key "tls.key"
kurun port-forward --servicename kurun https://localhost:9090 --tlssecret kurun-cert

kubectl run alpine --rm --image alpine -it

Install circleci

curl -fLSs https://circle.ci/cli | DESTDIR=${workdir}/bin bash
find . -maxdepth 1 -name '*.yml' -exec bin/circleci orb validate {} \;

Install kustomize

#!/usr/bin/env bash

version=3.1.0
opsys=$(echo "$(uname -s)" | awk '{print tolower($0)}')

# download the release
curl -O -L https://github.com/kubernetes-sigs/kustomize/releases/download/v${version}/kustomize_${version}_${opsys}_amd64
# move to bin
mkdir -p bin
mv kustomize_*_${opsys}_amd64 bin/kustomize
chmod u+x bin/kustomize

Install Visual Studio

brew install --cask visual-studio-code
code --install-extension ms-python.python
code --install-extension dongli.python-preview
code --install-extension ms-python.vscode-pylance
code --install-extension batisteo.vscode-django
code --install-extension vscjava.vscode-java-dependency
code --install-extension avli.clojure

Install Visual earthly

brew install earthly/earthly/earthly && earthly bootstrap
sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'

Install Visual taskdev

brew install go-task/tap/go-task

Install Visual werf

curl -sSLO https://werf.io/install.sh && chmod +x install.sh
./install.sh --version 1.2 --channel stable
werf version

Install fish

brew install fish
chsh -s /usr/local/bin/fish
curl -L https://get.oh-my.fish | fish
omf theme idan

Install mas

brew install mas
mas install 497799835
mas install 1496833156
mas install 1274495053
mas install 441258766

Install nanorc

# install better nanorc config
# https://github.com/scopatz/nanorc
curl https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh | sh

Install greenframe

curl https://assets.greenframe.io/install.sh | bash

Install watchman

brew install watchman
brew install --HEAD watchman

watchman watch ~/src
# the single quotes around '*.css' are important!
watchman -- trigger ~/src buildme '*.css' -- minify-css

Install s3-tools

brew tap peak/s5cmd https://github.com/peak/s5cmd
brew install s5cmd

brew tap peakgames/s3hash https://github.com/peakgames/s3hash
brew install s3hash

sudo port selfupdate
sudo port install s5cmd

Install awscli

export DEBIAN_FRONTEND=noninteractive
sudo apt-get update && sudo apt-get install -y screen python-pip gocryptfs
sudo apt-get clean
pip install awscli

apt-get update && apt-get install -y gocryptfs

mkdir -p /tmp/cloudstomp-$SESSION/crypt
aws s3 sync s3://cloudstomp-$SESSION/ /tmp/cloudstomp-$SESSION/crypt
gocryptfs /tmp/cloudstomp-$SESSION/crypt /tmp/cloudstomp-$SESSION/plain

Install redirection.io

sudo apt install redirectionio-agent

proxies:
    -
	listen: "0.0.0.0:80"
	forward: "http://127.0.0.1:8080"
	project_key: SOME_PROJECT_KEY_HERE

Install rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env
rustup default stable
rustup update
rustc --version

rustup-init -y --default-toolchain=stable
cargo install --force cargo-make
cargo install --force duckscript_cli
cargo make flowy_dev

Install nixos

sh <(curl -L https://nixos.org/nix/install) --no-daemon
sh <(curl -L https://nixos.org/nix/install)

Install fly

curl -L https://fly.io/install.sh | sh
fly apps create --org personal --port 5000
# Choose a name and the Image builder
# Enter `benbusby/whoogle-search:latest` as the image name
fly deploy

Install scm

git clone git://github.com/scmbreeze/scm_breeze.git ~/.scm_breeze
~/.scm_breeze/install.sh
source ~/.bashrc   # or source "${ZDOTDIR:-$HOME}/.zshrc"

Install long-waiting

sudo curl -L https://github.com/nvbn/we-are-waiting/releases/download/0.1/waiting-`uname -s`-`uname -m` -o /usr/local/bin/waiting
./long-script.sh | waiting

Install yarn

yarn global add expo-cli
yarn

Install hermit

curl -fsSL https://github.com/cashapp/hermit/releases/download/stable/install.sh | /bin/bash

Install hermit

curl -fsSL https://github.com/cashapp/hermit/releases/download/stable/install.sh | /bin/bash

Install vagrant

brew install --cask vagrant
vagrant plugin install vagrant-vbguest

Install arkade

curl -sLS https://get.arkade.dev | sudo sh
arkade app install postgresql
arkade app install openfaas

Install openfaas

curl -sLSf https://cli.openfaas.com | sudo sh

Install blsd

(bash <(curl -fL https://raw.githubusercontent.com/junegunn/blsd/master/install) && mv blsd ~/bin)

Install statikk

yarn global add statikk
statikk --port "$port" .

Install ship

brew tap replicatedhq/ship
brew install ship

Install kurl

curl https://kurl.sh/latest | sudo bash

Update brew, install brew cask

# make sure we’re using the latest Homebrew.
brew update

# upgrade any already-installed formulae.
brew upgrade

# install GNU core utilities (those that come with macOS are outdated).
# Don’t forget to add `$(brew --prefix coreutils)/libexec/gnubin` to `$PATH`.
brew install coreutils
ln -s "${BREW_PREFIX}/bin/gsha256sum" "${BREW_PREFIX}/bin/sha256sum"

# install some other useful utilities like `sponge`.
brew install moreutils

# install GNU `find`, `locate`, `updatedb`, and `xargs`, `g`-prefixed.
brew install findutils

# install GNU `sed`, overwriting the built-in `sed`.
brew install gnu-sed --with-default-names

# install a modern version of Bash.
brew install bash
brew install bash-completion2

# switch to using brew-installed bash as default shell
if ! fgrep -q "${BREW_PREFIX}/bin/bash" /etc/shells; then
  echo "${BREW_PREFIX}/bin/bash" | sudo tee -a /etc/shells;
  chsh -s "${BREW_PREFIX}/bin/bash";
fi;

# OSX native apps
brew tap caskroom/cask
brew tap phinze/homebrew-cask

brew install brew-cask

brew install jpeg-turbo
brew install optipng
brew install readline

# clean brew cache
brew cleanup

Install skaffold

curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-darwin-arm64
sudo install skaffold /usr/local/bin/
brew install skaffold

minikube start --profile custom
skaffold config set --global local-cluster true
eval $(minikube -p custom docker-env)

skaffold init --compose-file docker-compose.yaml

Install kompose

# Linux
curl -L https://github.com/kubernetes/kompose/releases/download/v1.25.0/kompose-linux-amd64 -o kompose

# macOS
curl -L https://github.com/kubernetes/kompose/releases/download/v1.25.0/kompose-darwin-amd64 -o kompose

chmod +x kompose
sudo mv ./kompose /usr/local/bin/kompose

Install emacs

git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
brew tap d12frosted/emacs-plus
brew install emacs-plus --HEAD --with-natural-title-bars
brew linkapps emacs-plus

Install fonts

brew tap bramstein/webfonttools
brew install sfnt2woff
brew install sfnt2woff-zopfli
brew install woff2

brew tap caskroom/fonts
### programming fonts
brew cask install font-fira-mono-for-powerline
brew cask install font-fira-code
### SourceCodePro + Powerline + Awesome Regular (for powerlevel 9k terminal icons)
cd ~/Library/Fonts && { curl -O 'https://github.com/Falkor/dotfiles/blob/master/fonts/SourceCodePro+Powerline+Awesome+Regular.ttf?raw=true' ; cd -; }

Install vultr

brew tap vultr/vultr-cli
brew install vultr-cli

Install plugins

brew cask install qlcolorcode # syntax highlighting in preview
brew cask install qlstephen  # preview plaintext files without extension
brew cask install qlmarkdown  # preview markdown files
brew cask install qlimagesize
brew cask install webpquicklook
brew cask install suspicious-package
brew cask install quicklookase
brew cask install qlvideo
brew cask install quicklook-json  # preview json files
brew cask install epubquicklook  # preview epubs, make nice icons
brew cask install quicklook-csv  # preview csvs

Install python

brew install python
pip3 install --upgrade pip
pip3 install --user pylint
pip3 install --user flake8
brew install pyenv

pip3 install --class="pln" > user termtosvg

pip install localstack

packages=(
  cheat
  img2pdf  # Lossless conversion of raster images to PDF
)

for package in "${packages[@]}"
do
  pip3 install "$package"
done

Install arduino

brew install avrdude
brew cask install arduino

Install cosign

brew install sigstore/tap/cosign
cosign verify -key https://raw.githubusercontent.com/stefanprodan/podinfo/master/cosign/cosign.pub \
ghcr.io/stefanprodan/podinfo-deploy:latest

Install crane

brew install crane
crane export ghcr.io/stefanprodan/podinfo-deploy:latest -| tar -xf -

Install pod-dive

kubectl krew install pod-dive
kubectl pod-dive

Install framework

brew tap kframework/k
brew install framework

Install conduktor

brew tap conduktor/brew
brew install conduktor

Install kcctl

brew install kcctl/tap/kcctl
wget https://raw.githubusercontent.com/kcctl/kcctl/main/kcctl_completion
. kcctl_completion
xattr -r -d com.apple.quarantine path /to/kcctl-1.0.0-SNAPSHOT-osx-x86_64/

Install microk8s

brew install ubuntu/microk8s/microk8s
microk8s install
microk8s status --wait-ready
microk8s enable dashboard dns registry istio
microk8s kubectl get all --all-namespaces
microk8s dashboard-proxy

Install krew

https://krew.sigs.k8s.io/docs/user-guide/setup/install/

Install macports

https://www.macports.org/install.php

Install teleport

helm repo add teleport https://charts.releases.teleport.dev
helm install teleport teleport/teleport

Install sdkman

curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"

sdk install maven
sdk install gradle 3.1

Install kustomize

curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"  | bash

Install skaffold

curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-darwin-arm64
sudo install skaffold /usr/local/bin/

Install dokku

wget https://raw.githubusercontent.com/dokku/dokku/v0.25.1/bootstrap.sh
sudo DOKKU_TAG=v0.25.1 bash bootstrap.sh

Install multipass

sudo multipass set local.driver=virtualbox

Install vagrant

brew tap hashicorp/tap
brew install vagrant

Install packer

brew tap hashicorp/tap
brew install hashicorp/tap/packer
brew upgrade hashicorp/tap/packer

Install k3d/s/x

wget https://k3d.io

Install portainer

wget https://documentation.portainer.io/quickstart/?hsCtaTracking=cb3a059b-7f57-4333-a92f-b06202ef8690%7C4427d7bc-1ae8-4a30-812c-d30ee496008f

Install tilt

kubectl config use-context docker-desktop
curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash

Install telepresence

brew install datawire/blackbird/telepresence

Install nave

# setup nave
cd ~/Documents/repos
git clone --branch prioritize-home-bin-path https://github.com/ruyadorno/nave.git
ln -s ~/Documents/repos/nave/nave.sh ~/bin/nave

# setup node
nave install latest
exec nave use latest

Install multiwerf

export PATH=$PATH:$HOME/bin

echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc
echo 'if [ -f "$HOME/.bashrc" ]; then' >> ~/.bash_profile
echo '  . "$HOME/.bashrc"' >> ~/.bash_profile
echo 'fi' >> ~/.bash_profile

mkdir -p ~/bin
cd ~/bin
curl -L https://raw.githubusercontent.com/werf/multiwerf/master/get.sh | bash

source $(multiwerf use 1.2 ea --as-file)
werf version

echo '. $(multiwerf use 1.2 ea --as-file)' >> ~/.bashrc

Install kubestack

curl -LO "https://github.com/kbst/kbst/releases/download/$(curl -s https://www.kubestack.com/cli-latest.txt)/kbst_darwin_amd64.zip"
sudo unzip -d /usr/local/bin/ kbst_darwin_amd64.zip kbst
kbst --version

Install tools

  • dev editors
brew cask install visual-studio-code
brew cask install pycharm
  • find app ids with: mas search "app name"
brew install mas

mas install 907364780  # Tomato One - Pomodoro timer
mas install 485812721  # Tweetdeck
mas install 668208984  # GIPHY Capture. The GIF Maker (For recording my screen as gif)
mas install 1351639930 # Gifski, convert videos to gifs
mas install 414030210  # Limechat, IRC app.
  • writing
brew cask install evernote
brew cask install macdown
brew cask install notion
  • conferences, blogging, screencasts
brew cask install deckset
brew cask install ImageOptim
brew cask install screenflow
  • soft
brew cask install docker
brew install postgresql
brew install redis
  • productivity
brew cask install wavebox
brew cask install google-chrome
brew cask install alfred
brew cask install dropbox
brew cask install sensiblesidebuttons

brew cask install timing
brew cask install keycastr
brew cask install betterzip
brew cask install caffeine
brew cask install skitch
brew cask install muzzle
brew cask install flux
  • keyboard & mouse
brew cask install karabiner-elements
brew cask install scroll-reverser
  • command line tools
brew install git  # upgrade to latest
brew install git-lfs # track large files in git https://github.com/git-lfs/git-lfs

# Install `wget` with IRI support.
brew install wget --with-iri

# Install GnuPG to enable PGP-signing commits.
brew install gnupg

# Install more recent versions of some macOS tools.
brew install vim --with-override-system-vi

arch -x86_64 /usr/local/bin/brew install gtk+3 adwaita-icon-theme ffmpeg librsvg

brew install grep
brew install openssh
brew install screen
brew install php
brew install gmp

brew install --cask altair-graphql-client
brew install sampler

brew install node
brew install z
brew install ag
brew install ack
brew install fd
brew install ffind
brew install fpp
brew install tmux
brew install watchman
brew install yarn
brew install git-crypt
brew install zsh # zshell
brew install tmux
brew install tree
brew link curl --force
brew install grep --with-default-names
brew install trash  # move to osx trash instead of rm
brew install less

brew install pv
brew install fdupes
fdupes -r .

brew cask install --appdir="~/Applications" imageoptim --force

brew install bash-completion
echo 'if [ -f $(brew --prefix)/etc/bash_completion ]; then source $(brew --prefix)/etc/bash_completion; fi' >> ~/.bashrc

brew install docker-slim
brew install skopeo
brew install envoy
brew install astronomer/tap/astro
brew install kubectl
brew install minikube
brew install derailed/k9s/k9s
brew install podman
brew install socat
brew install midnight-commander
brew install kind
brew install kops
brew install helm
brew install tilt-dev/tap/ctlptl
brew install dive
brew install jq
brew install gpg
brew cask install dash
brew install ispell
brew cask install atom
brew cask install dropbox
brew cask install google-chrome
brew cask install firefox

brew install patrickhoefler/tap/dockerfilegraph

brew install spotify-tui
brew upgrade spotify-tui

brew reinstall ffmpeg --with-libvpx
brew install fzf
# To install useful key bindings and fuzzy completion:
$(brew --prefix)/opt/fzf/install


brew install Mayowa-Ojo/tap/chmod-cli


# daily
brew install --cask rectangle
brew install --cask 1password
brew install --cask rescuetime

# dev
brew install --cask iterm2
brew install --cask sublime-text
brew install --cask imageoptim

# fun
brew install --cask limechat

# less often
brew install --cask disk-inventory-x
brew install --cask screenflow
brew install --cask vlc
brew install --cask gpgtools

brew install --cask spotify

brew tap homebrew/cask-fonts
brew install --cask font-fira-code



# GNU core utilities (those that come with OS X are outdated)
brew install coreutils
brew install moreutils
# GNU `find`, `locate`, `updatedb`, and `xargs`, `g`-prefixed
brew install findutils
# GNU `sed`
brew install gnu-sed



# Updated shells
# Note: don’t forget to add `/usr/local/bin/<EACHSHELL>` to `/etc/shells` before running `chsh`.
brew install bash
brew install zsh
brew install fish

brew install bash-completion@2


# Install wget
brew install wget

# Install more recent versions of some OS X tools
brew install vim
brew install nano
brew install grep
brew install openssh

# z hopping around folders
brew install z

# run this script when this file changes guy.
brew install entr

# github util
brew install gh
# nicer git diffs
brew install git-delta
brew install git


brew cask install sizeup/divvy/spectacles
brew cask install the-unarchiver

# start SizeUp at login
defaults write com.irradiatedsoftware.SizeUp StartAtLogin -bool true

# don’t show the preferences window on next start
defaults write com.irradiatedsoftware.SizeUp ShowPrefsOnNextStart -bool false


# better `top`
brew install glances

brew install shellcheck # linting for .sh files


# mtr - ping & traceroute. best.
brew install mtr

    # allow mtr to run without sudo
    mtrlocation=$(brew info mtr | grep Cellar | sed -e 's/ (.*//') #  e.g. `/Users/paulirish/.homebrew/Cellar/mtr/0.86`
    sudo chmod 4755 $mtrlocation/sbin/mtr
    sudo chown root $mtrlocation/sbin/mtr


# Install other useful binaries
brew install the_silver_searcher # ack is an alternative, tbh i forget which i like more.
brew install fzf

brew install imagemagick
brew install node # This installs `npm` too using the recommended installation method
brew install rename
brew install tree
brew install zopfli
brew install ffmpeg

# json stuff
brew install jq gron

# brew install android-platform-tools
# brew install pidcat   # colored logcat guy

brew install ncdu # find where your diskspace went


brew install scrcpy # control/view android phone from PC. amazing
brew install youtube-dl

# will probably need these at some point
brew install automake cmake go rust

brew install devutils
brew cask install lastfm
brew cask install marshallofsound-google-play-music-player
brew cask install 1password
brew cask install licecap
brew cask install skitch
brew cask install slack
brew cask install kap

brew install fluxcd/tap/flux
brew cask install iterm2
brew cask install charles
brew cask install imagealpha
brew cask install imageoptim
brew cask install iterm2
brew cask install macvim
brew install wget
brew install hub
brew install restic

brew install gts
brew install graphviz

brew install patrickhoefler/tap/dockerfilegraph
dockerfilegraph

brew install patrickhoefler/tap/ghtop
ghtop

brew install patrickhoefler/tap/cloudbuildgraph
cloudbuildgraph

curl -fsSL https://toolctl.io/install | sh

# If running Bash 3.2
brew install bash-completion

# or, if running Bash 4.1+
brew install bash-completion@2

source "$(brew --prefix)/etc/profile.d/bash_completion.sh"
source <(stern --completion=bash)

brew untap wix/brew
brew cask reinstall detox-instruments

brew install the_silver_searcher
brew install git
brew install python3
brew install irssi
brew install unrar
brew install trash
brew install tree
brew install wget
brew install tig
brew install ffind
brew install wifi-password
brew install gpg
brew install gpg2
brew install pinentry-mac
brew install hub
brew install asciinema
brew install neovim
brew install tmux
brew install fd
brew install ccache
brew install github/gh/gh
brew install bat
brew install hyperfine
brew install exa
  • ctf
brew install aircrack-ng
brew install bfg
brew install binutils
brew install binwalk
brew install cifer
brew install dex2jar
brew install dns2tcp
brew install fcrackzip
brew install foremost
brew install hashpump
brew install hydra
brew install john
brew install knock
brew install netpbm
brew install nmap
brew install pngcheck
brew install socat
brew install sqlmap
brew install tcpflow
brew install tcpreplay
brew install tcptrace
brew install ucspi-tcp # `tcpserver` etc.
brew install xpdf
brew install xz
brew install homebrew/cask/android-platform-tools
brew install egoist/tap/dum
brew install --cask eul

gem install --user-install html-proofer -v 3.15.0
htmlproofer --allow-hash-href --check-html --empty-alt-ignore --url-ignore /kots.io/css/ "./public"

# Install other useful binaries.
brew tap caskroom/versions
brew tap homebrew/cask-versions
brew install --cask cakebrew
brew install --cask topnotch
brew install --cask bartender
brew install --cask firefox
brew install --cask brave-browser
brew install --cask slack
brew install --cask telegram
brew install --cask zoom
brew install --cask discord
brew install --cask iterm2
brew install --cask openinterminal
brew install --cask appcleaner
brew install --cask vlc
brew install --cask spotify
brew install --cask dropbox
brew install --cask cyberduck
brew install --cask virtualbox
brew install --cask dash
brew install --cask db-browser-for-sqlite
brew install --cask dbeaver-community
brew install --cask beekeeper-studio
brew install --cask ganache
brew install git git-flow git-extras git-lfs
brew install hub
brew install --cask sourcetree
brew install --force-bottle coreutils
brew install --force-bottle diffutils
brew install gnu-which --with-default-names
brew install gnu-sed --with-default-names
brew install --force-bottle findutils --with-default-names
brew install gnu-indent
brew install grep --with-default-names
brew install --cask the-unarchiver
brew install gnu-tar --with-default-names
brew install unrar xz gzip
brew install golang
brew install python@3.9 ipython pyenv
brew install erlang rebar3
brew install elixir
brew install --cask java
brew install clojure/tools/clojure leiningen

brew install --cask binance
brew install --cask ledger-live

brew tap caskroom/fonts
brew tap homebrew/cask-fonts
brew update

fonts=(
  font-input
  font-hasklig
  font-fira-code
  font-hack-nerd-font
  font-anonymous-pro
  font-inconsolidata
)
brew install --cask "${fonts[@]}"

brew install --cask tor-browser
brew install --cask gpg-suite
brew install openssh
brew install openssl
brew install --cask 1password
brew install --cask authy
brew install --cask tunnelbear
brew install --cask nordvpn
brew install --cask cloudflare-warp

# Install `wget` with IRI support.
brew install wget --with-iri

brew install gnupg

# Install more recent versions of some macOS tools.
brew install vim --with-override-system-vi
brew install grep
brew install openssh
brew install screen

# Install other useful binaries.
brew install git
brew install git-lfs
brew install imagemagick --with-webp

brew install --cask jetbrains-toolbox
brew install --cask pycharm
brew install --cask webstorm
brew install --cask goland
brew install --cask clion
brew install --cask rubymine
brew install --cask datagrip
brew install --cask intellij-idea

utils=(
    mtr
    tmux
    ngrok
    hping
    telnet
    tcpdump
    tcpflow
    tcptrace
    tcpreplay
    prettyping
)

for package in "${utils[@]}"; do
  brew install "${package}"
done


brew install --cask wireshark
brew install --cask angry-ip-scanner
brew install nvm node typescript deno

dev_utils=(
  jq
  fzf
  bat
  wget
  tree
  trash
  tokei
   rename
  httpie
  neovim
  ffmpeg
  libjpeg
  gettext
  readline
  hadolint
  automake
  readline
  hyperfine
  shellcheck
  screenfetch
)

for package in "${dev_utils[@]}"; do
  brew install "${package}"
done

brew install ack
#brew install exiv2
brew install git
brew install git-lfs
brew install gs
brew install goaccess
brew install imagemagick --with-webp
brew install lua
brew install lynx
brew install p7zip
brew install pigz
brew install pv
brew install rename
brew install rlwrap
brew install ssh-copy-id
brew install tree
brew install vbindiff
brew install zopfli
brew install redis
brew install -s starship

brew tap universal-ctags/universal-ctags
brew install --HEAD universal-ctags
  
brew install diskonaut

brew install fastlane

# load autojump
[[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh

brew install \
  fd ag ripgrep ant cmake cmus coreutils cscope exiftool doxygen liboauth \
  fish git graphviz imagemagick leiningen sbt gnupg \
  maven ranger tree vim wget zsh jq macvim ruby python go highlight bat \
  reattach-to-user-namespace pinentry-mac bash-completion tmux gnuplot w3m yarn \
  translate-shell
    
brew install --cask xquartz iterm2 keepingyouawake spectacle \
  mat visualvm rstudio r mactex osxfuse karabiner-elements maccy adoptopenjdk8
    
brew install gh nvm trash tree httpie jq htop antigen fzf ripgrep git-delta bat exa git
brew install --cask raycast

brew install --cask oktadeveloper/tap/okta
brew reinstall okta
brew uninstall okta
brew untap oktadeveloper/tap
brew install --cask oktadeveloper/tap/okta

brew install zsh zsh-completions
brew install shyaml


sudo apt-get install -y buffer pv &&
sudo wget https://github.com/0k/pgm/raw/master/bin/pgm -O /usr/local/bin/pgm &&
sudo chmod +x /usr/local/bin/pgm
  • games
brew cask install steam
brew cask install minecraft
brew cask install openttd
  • chat/video conference
brew cask install slack
brew cask install microsoft-teams
brew cask install zoomus
brew cask install signal
brew cask install right-zoom
brew cask install limechat
  • music and video
brew cask install marshallofsound-google-play-music-player
brew cask install vlc

xcode-select --install
brew install portaudio
brew install mpg123
gem install soundcloud9000
  • missing tools
# switch from bash 3 to bash 5
brew install bash 
sudo chsh -s /usr/local/bin/bash root
echo /usr/local/bin/bash' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/unzip/bin:$PATH"' >> ~/.bashrc
. ~/.zshrc


go get -u github.com/slothking-online/gql

gem install brew-go

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

brew tap jandedobbeleer/oh-my-posh
brew install oh-my-posh

git lfs install

git remote set-url origin $(current_origin=$(git remote get-url origin --push) && echo ${current_origin/OldUsername/NewUsername})

brew install ots

brew tap sniptt-official/tap
brew install snip
brew install ots


brew update && brew install --cask motrix

System tweaks

  • local setup
sysctl -a | grep -E --color 'machdep.cpu.features|VMX'
  • Xcode setup
sudo xcodebuild -license
  • close any open System Preferences panes, to prevent them from overriding settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
  • start screensaver
open -a ScreenSaverEngine
  • configure volume/mute
osascript -e "set volume output muted true"
osascript -e "set volume output muted false"
osascript -e 'output muted of (get volume settings)'
  • Set not disturb mode
osascript >/dev/null <<'END'
try
	tell application "System Events"
		tell process "SystemUIServer"
			key down option
			click menu bar item "Notification Center" of menu bar 1
			key up option
		end tell
	end tell
end try
END

killall NotificationCenter
  • Minimize all the windows
osascript <<'END'
tell application "System Events"
    repeat with p in every application process whose visible is true
        click (first button of every window of p whose role description is "minimize button")
    end repeat
end tell
END
  • Display clock in Terminal
exec -a macClock bash -c 'while sleep 1;do tput sc;tput cup 0 $(($(tput cols)-29));date;tput rc;done' &
  • Show hidden files
defaults write com.apple.finder AppleShowAllFiles YES; killall Finder
  • Get macOS Info
sw_vers
  • Lock Mac
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
  • Restart Mac
osascript -e 'tell app "loginwindow" to «event aevtrrst»'
  • Sleep
pmset sleepnow
  • Shutdown Mac
osascript -e 'tell app "loginwindow" to «event aevtrsdn»'
  • Hide hidden files
defaults write com.apple.finder AppleShowAllFiles NO; killall Finder
  • Check bluetooth status
defaults read /Library/Preferences/com.apple.Bluetooth ControllerPowerState | awk '{ if($1 != 0) {print "Bluetooth: ON"} else { print "Bluetooth: OFF" }  }'
  • Enable bluetooth
sudo defaults write /Library/Preferences/com.apple.Bluetooth ControllerPowerState -int 1 && sudo killall -HUP bluetoothd
  • Disable bluetooth
sudo defaults write /Library/Preferences/com.apple.Bluetooth ControllerPowerState -int 0 && sudo killall -HUP bluetoothd
  • Enable wifi
networksetup -setairportpower ${_W_DEVICE} on
  • Disable wifi
networksetup -setairportpower ${_W_DEVICE} off
  • Show wifi password for current network
security find-generic-password -D "AirPort network password" -a "$ssid" -gw
  • Add blank space to the dock
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'
  • Eject all mounted volumes and disk
osascript -e 'tell application "Finder" to eject (every disk whose ejectable is true)'
  • disable transparency in the menu bar and elsewhere on Yosemite
defaults write com.apple.universalaccess reduceTransparency -bool true
  • finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons
defaults write com.apple.finder QuitMenuItem -bool true
  • keep folders on top when sorting by name
defaults write com.apple.finder _FXSortFoldersFirst -bool true
  • expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
  • save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
  • finder: show hidden files by default
defaults write com.apple.finder AppleShowAllFiles -bool true
  • finder: show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
  • Don’t display the annoying prompt when quitting iTerm
defaults write com.googlecode.iterm2 PromptOnQuit -bool false
  • Terminal & iTerm 2
defaults write com.apple.terminal StringEncodings -array 4
  • remove the auto-hiding Dock delay
defaults write com.apple.dock autohide-delay -float 0
  • automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true
  • only Show Open Applications In The Dock
defaults write com.apple.dock static-only -bool true
  • display full POSIX path as Finder window title
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
  • disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
  • automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
  • disable the “Are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
  • avoid creating .DS_Store files on network or USB volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
  • use list view in all Finder windows by default
    Four-letter codes for the other view modes: icnv, clmv, Flwv
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
  • minimize windows into their application’s icon
defaults write com.apple.dock minimize-to-application -bool true
  • automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true
  • don’t show recent applications in Dock
defaults write com.apple.dock show-recents -bool false
  • menu bar: hide the Time Machine, User icons, but show the volume Icon.
for domain in ~/Library/Preferences/ByHost/com.apple.systemuiserver.*; do \
	defaults write "${domain}" dontAutoLoad -array \
	"/System/Library/CoreServices/Menu Extras/TimeMachine.menu" \
	"/System/Library/CoreServices/Menu Extras/User.menu" \
done
defaults write com.apple.systemuiserver menuExtras -array \
  "/System/Library/CoreServices/Menu Extras/Volume.menu" \
  "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" \
  "/System/Library/CoreServices/Menu Extras/AirPort.menu" \
  "/System/Library/CoreServices/Menu Extras/Battery.menu" \
  "/System/Library/CoreServices/Menu Extras/Clock.menu"
  • disable smart quotes and smart dashes
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
  • disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
  • use function F1, F, etc keys as standard function keys
defaults write NSGlobalDomain com.apple.keyboard.fnState -bool true
  • require password immediately after sleep or screen saver begins
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
  • save screenshots
screencapture \
  -o \
  -W \
  ~/Desktop/terminal-screenshot.png &
  • save screenshots to the desktop
defaults write com.apple.screencapture location -string "$HOME/Desktop"
  • save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
defaults write com.apple.screencapture type -string "png"
  • disable shadow in screenshots
defaults write com.apple.screencapture disable-shadow -bool true
  • use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText -int 0
  • get battery information
pmset -g batt
  • hide Spotlight tray-icon (and subsequent helper)
# sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search
# Disable Spotlight indexing for any volume that gets mounted and has not yet
# been indexed before.
# Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume.
sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes"
# Load new settings before rebuilding the index
killall mds
  • disable the sound effects on boot
sudo nvram SystemAudioVolume=" "
  • kill all affected applications
killall Dock Finder SystemUIServer
  • remove the spring loading delay for directories
defaults write NSGlobalDomain com.apple.springing.delay -float 0
  • disable all window animations and the animation when opening the info window in Finder
defaults write com.apple.finder DisableAllAnimations -bool true
  • showing a toolbar or menu bar in full screen
defaults write -g NSToolbarFullScreenAnimationDuration -float 0
  • increase window resize speed for Cocoa applications
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
  • don’t automatically rearrange Spaces based on most recent use
defaults write com.apple.dock mru-spaces -bool false
  • showing the Dock
defaults write com.apple.dock autohide-time-modifier -float 0.3
defaults write com.apple.dock autohide-delay -float 0
  • opening and closing Quick Look windows
defaults write -g QLPanelAnimationDuration -float 0
  • launchpad’s show and hide durations can be set independently
defaults write com.apple.dock springboard-show-duration -int 0
defaults write com.apple.dock springboard-hide-duration -float 0
defaults write com.apple.dock springboard-page-duration -float 0
  • speed up Mission Control animation
defaults write com.apple.dock expose-animation-duration -float 0.0
  • launching an app from the Dock
defaults write com.apple.dock launchanim -bool false
  • opening and closing windows and popovers
defaults write -g NSAutomaticWindowAnimationsEnabled -bool false
  • expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
  • expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
  • remove the spring loading delay for directories
defaults write NSGlobalDomain com.apple.springing.delay -float 0
  • avoid creating .DS_Store files on network or USB volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
  • set the icon size of Dock items to 36 pixels
defaults write com.apple.dock tilesize -int 36
  • change minimize/maximize window effect
defaults write com.apple.dock mineffect -string "scale"
  • enable highlight hover effect for the grid view of a stack (Dock)
defaults write com.apple.dock mouse-over-hilite-stack -bool true
  • expand the following File Info panes: “General”, “Open with”, and “Sharing & Permissions”
defaults write com.apple.finder FXInfoPanesExpanded -dict \
	General -bool true \
	OpenWith -bool true \
	Privileges -bool true
  • remove Dropbox’s green checkmark icons in Finder
file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns
[ -e "${file}" ] && mv -f "${file}" "${file}.bak"
  • show the /Volumes folder
sudo chflags nohidden /Volumes
  • show the ~/Library folder
chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library
  • enable AirDrop over Ethernet and on unsupported Macs running Lion
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true
  • disable the warning before emptying the Trash
defaults write com.apple.finder WarnOnEmptyTrash -bool false
  • use list view in all Finder windows by default
# Four-letter codes for the other view modes: `icnv`, `clmv`, `glyv`
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
  • increase the size of icons on the desktop and in other icon views
/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
  • increase grid spacing for icons on the desktop and in other icon views
/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
  • enable snap-to-grid for icons on the desktop and in other icon views
/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
  • show the full URL in the address bar (note: this still hides the scheme)
defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true
  • prevent Safari from opening ‘safe’ files automatically after downloading
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
  • change indexing order and disable some search results
# Yosemite-specific search results (remove them if you are using macOS 10.9 or older):
# 	MENU_DEFINITION
# 	MENU_CONVERSION
# 	MENU_EXPRESSION
# 	MENU_SPOTLIGHT_SUGGESTIONS (send search queries to Apple)
# 	MENU_WEBSEARCH             (send search queries to Apple)
# 	MENU_OTHER
defaults write com.apple.spotlight orderedItems -array \
	'{"enabled" = 1;"name" = "APPLICATIONS";}' \
	'{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \
	'{"enabled" = 1;"name" = "DIRECTORIES";}' \
	'{"enabled" = 1;"name" = "PDF";}' \
	'{"enabled" = 1;"name" = "FONTS";}' \
	'{"enabled" = 0;"name" = "DOCUMENTS";}' \
	'{"enabled" = 0;"name" = "MESSAGES";}' \
	'{"enabled" = 0;"name" = "CONTACT";}' \
	'{"enabled" = 0;"name" = "EVENT_TODO";}' \
	'{"enabled" = 0;"name" = "IMAGES";}' \
	'{"enabled" = 0;"name" = "BOOKMARKS";}' \
	'{"enabled" = 0;"name" = "MUSIC";}' \
	'{"enabled" = 0;"name" = "MOVIES";}' \
	'{"enabled" = 0;"name" = "PRESENTATIONS";}' \
	'{"enabled" = 0;"name" = "SPREADSHEETS";}' \
	'{"enabled" = 0;"name" = "SOURCE";}' \
	'{"enabled" = 0;"name" = "MENU_DEFINITION";}' \
	'{"enabled" = 0;"name" = "MENU_OTHER";}' \
	'{"enabled" = 0;"name" = "MENU_CONVERSION";}' \
	'{"enabled" = 0;"name" = "MENU_EXPRESSION";}' \
	'{"enabled" = 0;"name" = "MENU_WEBSEARCH";}' \
	'{"enabled" = 0;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}'

# Load new settings before rebuilding the index
killall mds > /dev/null 2>&1
# Make sure indexing is enabled for the main volume
sudo mdutil -i on / > /dev/null
# Rebuild the index from scratch
sudo mdutil -E / > /dev/null
  • disable automatic spell checking
defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled"
  • disable inline attachments (just show the icons)
defaults write com.apple.mail DisableInlineAttachmentViewing -bool true
  • display emails in threaded mode, sorted by date (oldest at the top)
defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes"
defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortedDescending" -string "yes"
defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortOrder" -string "received-date"
  • add the keyboard shortcut ⌘ + Enter to send an email in Mail.app
defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" "@\U21a9"
  • copy email addresses as foo@example.com instead of Foo Bar <foo@example.com> in Mail.app
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
  • disable send and reply animations in Mail.app
defaults write com.apple.mail DisableReplyAnimations -bool true
defaults write com.apple.mail DisableSendAnimations -bool true
  • update extensions automatically
defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true
  • enable “Do Not Track”
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true
  • hide Safari’s bookmarks bar by default
defaults write com.apple.Safari ShowFavoritesBar -bool false
  • disable auto-playing video
#defaults write com.apple.Safari WebKitMediaPlaybackAllowsInline -bool false
#defaults write com.apple.SafariTechnologyPreview WebKitMediaPlaybackAllowsInline -bool false
#defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false
#defaults write com.apple.SafariTechnologyPreview com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false
  • block pop-up windows
defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false
  • disable Java
defaults write com.apple.Safari WebKitJavaEnabled -bool false
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled -bool false
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabledForLocalFiles -bool false
  • disable plug-ins
defaults write com.apple.Safari WebKitPluginsEnabled -bool false
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2PluginsEnabled -bool false
  • warn about fraudulent websites
defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true
  • disable AutoFill
defaults write com.apple.Safari AutoFillFromAddressBook -bool false
defaults write com.apple.Safari AutoFillPasswords -bool false
defaults write com.apple.Safari AutoFillCreditCardData -bool false
defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false
  • kill affected applications 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
- bypass the annoyingly slow t.co URL shortener
```sh
defaults write com.tapbots.TweetbotMac OpenURLsDirectly -bool true
  • hide the app in the background if it’s not the front-most window
defaults write com.twitter.twitter-mac HideInBackground -bool true
  • show full names rather than Twitter handles
defaults write com.twitter.twitter-mac ShowFullNames -bool true
  • allow closing the ‘new tweet’ window by pressing Esc
defaults write com.twitter.twitter-mac ESCClosesComposeWindow -bool true
  • open links in the background
defaults write com.twitter.twitter-mac openLinksInBackground -bool true
  • enable the hidden ‘Develop’ menu
defaults write com.twitter.twitter-mac ShowDevelopMenu -bool true
  • show the app window when clicking the menu bar icon
defaults write com.twitter.twitter-mac MenuItemBehavior -int 1
  • disable smart quotes as it’s annoying for code tweets
defaults write com.twitter.twitter-mac AutomaticQuoteSubstitutionEnabled -bool false
  • randomize port on launch
defaults write org.m0k.transmission RandomPort -bool true
  • IP block list.
defaults write org.m0k.transmission BlocklistNew -bool true
defaults write org.m0k.transmission BlocklistURL -string "http://john.bitsurge.net/public/biglist.p2p.gz"
defaults write org.m0k.transmission BlocklistAutoUpdate -bool true
  • hide the legal disclaimer
defaults write org.m0k.transmission WarningLegal -bool false
  • hide the donate message
defaults write org.m0k.transmission WarningDonate -bool false
  • trash original torrent files
defaults write org.m0k.transmission DeleteOriginalTorrent -bool true
  • don’t prompt for confirmation before removing non-downloading active transfers
defaults write org.m0k.transmission CheckRemoveDownloading -bool true
  • don’t prompt for confirmation before downloading
defaults write org.m0k.transmission DownloadAsk -bool false
defaults write org.m0k.transmission MagnetOpenAsk -bool false
  • use ~/Downloads to store completed downloads
defaults write org.m0k.transmission DownloadLocationConstant -bool true
  • use ~/Documents/Torrents to store incomplete downloads
defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true
defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Documents/Torrents"
  • set up my preferred keyboard shortcuts
cp -r init/spectacle.json ~/Library/Application\ Support/Spectacle/Shortcuts.json 2> /dev/null
  • install Sublime Text settings
cp -r init/Preferences.sublime-settings ~/Library/Application\ Support/Sublime\ Text*/Packages/User/Preferences.sublime-settings 2> /dev/null
  • don’t show the preferences window on next start
defaults write com.irradiatedsoftware.SizeUp ShowPrefsOnNextStart -bool false
  • start SizeUp at login
defaults write com.irradiatedsoftware.SizeUp StartAtLogin -bool true
  • expand the print dialog by default
defaults write com.operasoftware.Opera PMPrintingExpandedStateForPrint2 -boolean true
defaults write com.operasoftware.OperaDeveloper PMPrintingExpandedStateForPrint2 -boolean true
  • disable signing emails by default
defaults write ~/Library/Preferences/org.gpgtools.gpgmail SignNewEmailsByDefault -bool false
  • expand the print dialog by default
defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true
defaults write com.google.Chrome.canary PMPrintingExpandedStateForPrint2 -bool true
  • use the system-native print preview dialog
defaults write com.google.Chrome DisablePrintPreview -bool true
defaults write com.google.Chrome.canary DisablePrintPreview -bool true
  • disable the all too sensitive backswipe on Magic Mouse
defaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -bool false
defaults write com.google.Chrome.canary AppleEnableMouseSwipeNavigateWithScrolls -bool false
  • Add scroll via mouse.
defaults write com.googlecode.iterm2 AlternateMouseScroll -bool true
  • Change default screenshot location
mkdir ~/screenshots
defaults write com.apple.screencapture location ~/screenshots
killall SystemUIServer
  • disable the all too sensitive backswipe on trackpads
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false
defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false
  • prevent Photos from opening automatically when devices are plugged in
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
  • disable continuous spell checking
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false
  • disable smart quotes as it’s annoying for messages that contain code
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false
  • disable automatic emoji substitution (i.e. use plain text smileys)
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false
  • allow the App Store to reboot machine on macOS updates
defaults write com.apple.commerce AutoUpdateRestartRequired -bool true
  • turn on app auto-update
defaults write com.apple.commerce AutoUpdate -bool true
  • automatically download apps purchased on other Macs
defaults write com.apple.SoftwareUpdate ConfigDataInstall -int 1
  • install System data files & security updates
defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1
  • download newly available updates in background
defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1
  • disable auto-correct
defaults write com.apple.Safari WebAutomaticSpellingCorrectionEnabled -bool false
  • avoid appearing your name in local networks and in various preference files
sudo scutil --set ComputerName "${COMPUTER_NAME}"
sudo scutil --set HostName "${HOSTNAME}"
sudo scutil --set LocalHostName "${LOCAL_HOSTNAME}"
  • sleep the display after 15 minutes
sudo pmset -a displaysleep 10
  • disable machine sleep while charging
sudo pmset -c sleep 0
  • set machine sleep to 5 minutes on battery
sudo pmset -b sleep 5
  • disable shit I hate
defaults write com.apple.dashboard mcx-disabled -boolean YES
  • disable rubber scrolling
defaults write -g NSScrollViewRubberbanding -int 0
  • scrollbars visible when scrolling
defaults write NSGlobalDomain AppleShowScrollBars -string "WhenScrolling"
  • maximize windows on double clicking them
defaults write -g AppleActionOnDoubleClick 'Maximize'
  • require password immediately after sleep or screen saver begins
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
  • don’t send search queries to Apple
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
  • improve security
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled -bool false
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabledForLocalFiles -bool false
  • enable the Develop menu and the Web Inspector in Safari
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
  • show the full URL in the address bar (note: this still hides the scheme)
defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true
  • set Safari’s home page to about:blank for faster loading
defaults write com.apple.Safari HomePage -string "about:blank"
  • disable Safari’s thumbnail cache for History and Top Sites
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
  • enable Safari’s debug menu
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
  • disable AutoFill
defaults write com.apple.Safari AutoFillFromAddressBook -bool false
defaults write com.apple.Safari AutoFillPasswords -bool false
defaults write com.apple.Safari AutoFillCreditCardData -bool false
defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false
  • enable “Do Not Track”
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true
  • update extensions automatically
defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true
  • show Finder path bar
defaults write com.apple.finder ShowPathbar -bool true
  • show the main window when launching Activity Monitor
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
  • disable autocorrect
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
  • disable auto-capitalization
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
  • notification dismiss timeout
defaults write com.apple.notificationcenterui bannerTime -int 4
  • turn on app auto-update
defaults write com.apple.commerce AutoUpdate -bool true
  • automatically download apps purchased on other Macs
defaults write com.apple.SoftwareUpdate ConfigDataInstall -int 1
  • download newly available updates in background
defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1
  • auto-play videos when opened with QuickTime Player
defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen -bool true
  • sort Activity Monitor results by CPU usage
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
defaults write com.apple.ActivityMonitor SortDirection -int 0
  • show all processes in Activity Monitor
defaults write com.apple.ActivityMonitor ShowCategory -int 0
  • prevent Time Machine from prompting to use new hard drives as backup volume
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
  • don’t display the annoying prompt when quitting iTerm
defaults write com.googlecode.iterm2 PromptOnQuit -bool false
  • only use UTF-8 in Terminal.app
defaults write com.apple.terminal StringEncodings -array 4
  • don’t show recent applications in Dock
defaults write com.apple.dock show-recents -bool false
  • speed up Mission Control animations
defaults write com.apple.dock expose-animation-duration -float 0.1
  • show indicator lights for open applications in the Dock
defaults write com.apple.dock show-process-indicators -bool true
  • minimize windows into their application’s icon
defaults write com.apple.dock minimize-to-application -bool true
  • show the ~/Library folder
chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library
  • disable the warning before emptying the Trash
defaults write com.apple.finder WarnOnEmptyTrash -bool false
  • empty Trash securely by default
defaults write com.apple.finder EmptyTrashSecurely -bool true
  • avoid creating .DS_Store files on network or USB volumes
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
  • disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
  • when performing a search, search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
  • keep folders on top when sorting by name
defaults write com.apple.finder _FXSortFoldersFirst -bool true
  • display full POSIX path as Finder window title
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
  • show all filename extensions in Finder
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
  • save screenshots in PNG format
defaults write com.apple.screencapture type -string "png"
  • save screenshots to the desktop
defaults write com.apple.screencapture location -string "${HOME}/Desktop"
  • disable crash reporter
defaults write com.apple.CrashReporter DialogType none
  • don't save documents to iCloud by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
  • show icons for hard drives, servers, and removable media on the desktop
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
  • enable continuous spellchecking
defaults write com.apple.Safari WebContinuousSpellCheckingEnabled -bool true
  • add a context menu item for showing the Web Inspector in web views
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
  • enable the Develop menu and the Web Inspector in Safari
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
  • enable the WebKit Developer Tools in the Mac App Store
defaults write com.apple.appstore WebKitDeveloperExtras -bool true
  • auto-play videos when opened with QuickTime Player
defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen -bool true
  • enable the debug menu in Disk Utility
defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true
defaults write com.apple.DiskUtility advanced-image-options -bool true
  • open and save files as UTF-8 in TextEdit
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
  • use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText -int 0
  • enable the debug menu in iCal (pre-10.8)
defaults write com.apple.iCal IncludeDebugMenu -bool true
  • enable Dashboard dev mode (allows keeping widgets on the desktop)
defaults write com.apple.dashboard devmode -bool true
  • enable the debug menu in Address Book
defaults write com.apple.addressbook ABShowDebugMenu -bool true
  • sort Activity Monitor results by CPU usage
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
defaults write com.apple.ActivityMonitor SortDirection -int 0
  • show all processes in Activity Monitor
defaults write com.apple.ActivityMonitor ShowCategory -int 0
  • visualize CPU usage in the Activity Monitor Dock icon
defaults write com.apple.ActivityMonitor IconType -int 5
  • show the main window when launching Activity Monitor
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
  • remove useless icons from Safari’s bookmarks bar
defaults write com.apple.Safari ProxiesInBookmarksBar "()"
  • make Safari’s search banners default to Contains instead of Starts With
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
  • enable Safari’s debug menu
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
  • disable Safari’s thumbnail cache for History and Top Sites
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
  • hide Safari’s sidebar in Top Sites
defaults write com.apple.Safari ShowSidebarInTopSites -bool false
  • allow hitting the Backspace key to go to the previous page in history
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true
  • set Safari’s home page to about:blank for faster loading
defaults write com.apple.Safari HomePage -string "about:blank"
  • automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true
  • press Tab to highlight each item on a web page
defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true
  • privacy: don’t send search queries to Apple
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
  • add a spacer to the left side of the Dock (where the applications are)
defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'
  • hot corners
# Possible values:
#  0: no-op
#  2: Mission Control
#  3: Show application windows
#  4: Desktop
#  5: Start screen saver
#  6: Disable screen saver
#  7: Dashboard
# 10: Put display to sleep
# 11: Launchpad
# 12: Notification Center
# 13: Lock Screen
# Top left screen corner → Mission Control
defaults write com.apple.dock wvous-tl-corner -int 2
defaults write com.apple.dock wvous-tl-modifier -int 0
# Top right screen corner → Desktop
defaults write com.apple.dock wvous-tr-corner -int 4
defaults write com.apple.dock wvous-tr-modifier -int 0
# Bottom left screen corner → Start screen saver
defaults write com.apple.dock wvous-bl-corner -int 5
defaults write com.apple.dock wvous-bl-modifier -int 0
  • add a spacer to the right side of the Dock (where the Trash is)
defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}'
  • add iOS & Watch Simulator to Launchpad
sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" "/Applications/Simulator.app"
sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator (Watch).app" "/Applications/Simulator (Watch).app"
  • reset Launchpad, but keep the desktop wallpaper intact
find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete
  • disable the Launchpad gesture (pinch with thumb and three fingers)
defaults write com.apple.dock showLaunchpadGestureEnabled -int 0
  • don’t show recent applications in Dock
defaults write com.apple.dock show-recents -bool false
  • make Dock icons of hidden applications translucent
defaults write com.apple.dock showhidden -bool true
  • show item info to the right of the icons on the desktop
/usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist
  • show item info near icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
  • automatically open a new Finder window when a volume is mounted
defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true
  • disable disk image verification
defaults write com.apple.frameworks.diskimages skip-verify -bool true
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
  • enable spring loading for directories
defaults write NSGlobalDomain com.apple.springing.enabled -bool true
  • disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
  • when performing a search, search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
  • keep folders on top when sorting by name
defaults write com.apple.finder _FXSortFoldersFirst -bool true
  • display full POSIX path as Finder window title
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
  • finder: show path bar
defaults write com.apple.finder ShowPathbar -bool true
  • finder: show status bar
defaults write com.apple.finder ShowStatusBar -bool true
  • disable “natural” (Lion-style) scrolling
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
  • stop iTunes from responding to the keyboard media keys
launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null
  • trackpad: enable tap to click for this user and for the login screen
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
  • disable force click and haptic feedback
defaults write ~/Library/Preferences/com.apple.AppleMultitouchTrackpad.plist ForceSuppressed -bool true
  • mouse settings
defaults write com.apple.driver.AppleBluetoothMultitouch.mouse.plist MouseOneFingerDoubleTapGesture -int 0
defaults write com.apple.driver.AppleBluetoothMultitouch.mouse.plist MouseTwoFingerDoubleTapGesture -int 3
defaults write com.apple.driver.AppleBluetoothMultitouch.mouse.plist MouseTwoFingerHorizSwipeGesture -int 2
defaults write ~/Library/Preferences/.GlobalPreferences.plist com.apple.mouse.scaling -float 3
defaults write ~/Library/Preferences/.GlobalPreferences.plist com.apple.swipescrolldirection -boolean NO
  • enable the automatic update check
defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true
  • download newly available updates in background
defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1
  • check for software updates daily, not just once per week
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
  • enable the automatic update check
defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true
  • enable Debug Menu in the Mac App Store
defaults write com.apple.appstore ShowDebugMenu -bool true
  • increase window resize speed for Cocoa applications
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
  • expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
  • expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
  • save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
  • minimize windows into their application’s icon
defaults write com.apple.dock minimize-to-application -bool true
  • wipe all (default) app icons from the Dock
# This is only really useful when setting up a new Mac, or if you don’t use
# the Dock to launch apps.
#defaults write com.apple.dock persistent-apps -array
  • remove the animation when hiding/showing the Dock
defaults write com.apple.dock autohide-time-modifier -float 0
  • remove the auto-hiding Dock delay
defaults write com.apple.dock autohide-delay -float 0
  • don’t automatically rearrange Spaces based on most recent use
defaults write com.apple.dock mru-spaces -bool false
  • don’t show Dashboard as a Space
defaults write com.apple.dock dashboard-in-overlay -bool true
  • disable Dashboard
defaults write com.apple.dashboard mcx-disabled -bool true
  • don’t group windows by application in Mission Control
# (i.e. use the old Exposé behavior instead)
defaults write com.apple.dock expose-group-by-app -bool false
  • speed up Mission Control animations
defaults write com.apple.dock expose-animation-duration -float 0.1
  • don’t animate opening applications from the Dock
defaults write com.apple.dock launchanim -bool false
  • show only open applications in the Dock
defaults write com.apple.dock static-only -bool true
  • show indicator lights for open applications in the Dock
defaults write com.apple.dock show-process-indicators -bool true
  • disable local Time Machine backups
hash tmutil &> /dev/null && sudo tmutil disablelocal
  • prevent Time Machine from prompting to use new hard drives as backup volume
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
  • enable spring loading for all Dock items
defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true
  • automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
  • disable the “Are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
  • remove duplicates in the “Open With” menu (also see lscleanup alias)
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
  • display ASCII control characters using caret notation in standard text views
# Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt`
defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true
  • disable Resume system-wide
defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false
  • disable automatic termination of inactive apps
defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true
  • disable the crash reporter
defaults write com.apple.CrashReporter DialogType -string "none"
  • set Help Viewer windows to non-floating mode
defaults write com.apple.helpviewer DevMode -bool true
# Commented out, as this is known to cause problems in various Adobe apps :(
# See https://github.com/mathiasbynens/dotfiles/issues/237
#echo "0x08000100:0" > ~/.CFUserTextEncoding
  • reveal IP address, hostname, OS version, etc. when clicking the clock in the login window
sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName
  • use a modified version of the Solarized Dark theme by default in Terminal.app
osascript <<EOD
tell application "Terminal"
	local allOpenedWindows
	local initialOpenedWindows
	local windowID
	set themeName to "Solarized Dark xterm-256color"
	(* Store the IDs of all the open terminal windows. *)
	set initialOpenedWindows to id of every window
	(* Open the custom theme so that it gets added to the list
	   of available terminal themes (note: this will open two
	   additional terminal windows). *)
	do shell script "open '$HOME/init/" & themeName & ".terminal'"
	(* Wait a little bit to ensure that the custom theme is added. *)
	delay 1
	(* Set the custom theme as the default terminal theme. *)
	set default settings to settings set themeName
	(* Get the IDs of all the currently opened terminal windows. *)
	set allOpenedWindows to id of every window
	repeat with windowID in allOpenedWindows
		(* Close the additional windows that were opened in order
		   to add the custom theme to the list of terminal themes. *)
		if initialOpenedWindows does not contain windowID then
			close (every window whose id is windowID)
		(* Change the theme for the initial opened terminal windows
		   to remove the need to close them in order for the custom
		   theme to be applied. *)
		else
			set current settings of tabs of (every window whose id is windowID) to settings set themeName
		end if
	end repeat
end tell
EOD
  • don’t display the annoying prompt when quitting iTerm
defaults write com.googlecode.iterm2 PromptOnQuit -bool false
  • install the Solarized Dark theme for iTerm
open "${HOME}/init/Solarized Dark.itermcolors"
  • disable the annoying line marks
defaults write com.apple.Terminal ShowLineMarks -int 0
  • enable Secure Keyboard Entry in Terminal.app
defaults write com.apple.terminal SecureKeyboardEntry -bool true
  • enable “focus follows mouse” for Terminal.app and all X11 apps
# i.e. hover over a window and start typing in it without clicking first
#defaults write com.apple.terminal FocusFollowsMouse -bool true
#defaults write org.x.X11 wm_ffm -bool true
  • only use UTF-8 in Terminal.app
defaults write com.apple.terminal StringEncodings -array 4
  • disable Notification Center and remove the menu bar icon
launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null
  • disable automatic capitalization as it’s annoying when typing code
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
  • disable smart dashes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
  • disable automatic period substitution as it’s annoying when typing code
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
  • disable smart quotes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
  • disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
  • Set a custom wallpaper image. DefaultDesktop.jpg is already a symlink, and all wallpapers are in /Library/Desktop Pictures/. The default is Wave.jpg.
rm -rf ~/Library/Application Support/Dock/desktoppicture.db
sudo rm -rf /System/Library/CoreServices/DefaultDesktop.jpg
sudo ln -s /path/to/your/image /System/Library/CoreServices/DefaultDesktop.jpg
  • install System data files & security updates
defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1
  • show language menu in the top right corner of the boot screen
sudo defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool true
  • set the timezone; see sudo systemsetup -listtimezones for other values
sudo systemsetup -settimezone "Europe/Brussels" > /dev/null
  • stop iTunes from responding to the keyboard media keys
launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null
  • sleep the display after 15 minutes
sudo pmset -a displaysleep 15
  • finder: show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
  • finder: show hidden files by default
defaults write com.apple.finder AppleShowAllFiles -bool true
  • show icons for hard drives, servers, and removable media on the desktop
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
  • set Desktop as the default location for new Finder windows
# For other paths, use `PfLo` and `file:///full/path/here/`
defaults write com.apple.finder NewWindowTarget -string "PfDe"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/"
  • finder: disable window animations and Get Info animations
defaults write com.apple.finder DisableAllAnimations -bool true
  • finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons
defaults write com.apple.finder QuitMenuItem -bool true
  • enable HiDPI display modes (requires restart)
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true
  • enable subpixel font rendering on non-Apple LCDs
defaults write NSGlobalDomain AppleFontSmoothing -int 1
  • disable shadow in screenshots
defaults write com.apple.screencapture disable-shadow -bool true
  • save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
defaults write com.apple.screencapture type -string "png"
  • save screenshots to the desktop
defaults write com.apple.screencapture location -string "${HOME}/Desktop"
  • require password immediately after sleep or screen saver begins
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
  • remove the sleep image file to save disk space
sudo rm /private/var/vm/sleepimage
# Create a zero-byte file instead…
sudo touch /private/var/vm/sleepimage
# …and make sure it can’t be rewritten
sudo chflags uchg /private/var/vm/sleepimage
  • hibernation mode
# 0: Disable hibernation (speeds up entering sleep mode)
# 3: Copy RAM to disk so the system state can still be restored in case of a
#    power failure.
sudo pmset -a hibernatemode 0
  • never go into computer sleep mode
sudo systemsetup -setcomputersleep Off > /dev/null
  • set standby delay to 24 hours (default is 1 hour)
sudo pmset -a standbydelay 86400
  • set machine sleep to 5 minutes on battery
sudo pmset -b sleep 5
  • disable machine sleep while charging
sudo pmset -c sleep 0
  • restart automatically if the computer freezes
sudo systemsetup -setrestartfreeze on
  • restart automatically on power loss
sudo pmset -a autorestart 1
  • enable lid wakeup
sudo pmset -a lidwake 1
  • trackpad: enable tap to click for this user and for the login screenpdates
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
  • trackpad: map bottom right corner to right-click
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1
defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true
  • disable “natural” (Lion-style) scrolling
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
  • increase sound quality for Bluetooth headphones/headsets
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
  • enable full keyboard access for all controls
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
  • use scroll gesture with the Ctrl (^) modifier key to zoom
defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
# Follow the keyboard focus while zoomed in
defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true
  • prevent Photos from opening automatically when devices are plugged in
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
  • disable press-and-hold for keys in favor of key repeat
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
  • set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write NSGlobalDomain InitialKeyRepeat -int 10
  • set language and text formats
# Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with
# `Inches`, `en_GB` with `en_US`, and `true` with `false`.
defaults write NSGlobalDomain AppleLanguages -array "en" "nl"
defaults write NSGlobalDomain AppleLocale -string "en_GB@currency=EUR"
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters"
defaults write NSGlobalDomain AppleMetricUnits -bool true
  • disable system-wide resume
defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false
  • disable the menubar transparency
defaults write com.apple.universalaccess reduceTransparency -bool true
  • speeding up wake from sleep to 24 hours from an hour
sudo pmset -a standbydelay 86400
  • increasing sound quality for Bluetooth headphones/headsets
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
  • enabling full keyboard access for all controls (enable Tab in modal dialogs, menu windows, etc.)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
  • disabling press-and-hold for special keys in favor of key repeat
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
  • setting a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 0
defaults write -g KeyRepeat -int 1
defaults write -g InitialKeyRepeat -int 10
  • Multi Dock
echo "Installing following App Store Apps:"

echo "Affinity Photo (https://itunes.apple.com/de/app/affinity-photo/id824183456?l=en&mt=12)"
echo "Affinity Designer (https://itunes.apple.com/de/app/affinity-designer/id824171161?l=en&mt=12)"
echo "MainStage 3  (https://itunes.apple.com/de/app/mainstage-3/id634159523?l=en&mt=12)"
echo "Xcode (https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12)"
echo "Logic Pro X (https://itunes.apple.com/de/app/logic-pro-x/id634148309?l=en&mt=12)"
echo "Final Cut Pro (https://itunes.apple.com/de/app/final-cut-pro/id424389933?l=en&mt=12)"


appIds=(
  824171161  # Affinity Designer
  824183456  # Affinity Photo
  424389933  # Final Cut Pro
  405399194  # Kindle
  634148309  # Logic Pro X
  634159523  # MainStage 3
  504700302  # PDF Squeezer
  497799835  # XCode
)

for appId in "${appIds[@]}"
do
  mas install "$appId"
done

echo "Disable window animations"
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false

echo "Disable auto-reopen for Quicktime"
defaults write com.apple.QuickTimePlayerX NSQuitAlwaysKeepsWindows -bool false

echo "Disable auto reopen for Preview"
defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false

echo "Open plain text files per default with SublimeText 4"
defaults write com.apple.LaunchServices/com.apple.launchservices.secure \
  LSHandlers -array-add \
  '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.4;}'


echo "===== Configure the Dock ====="

echo "Remove default app icons"
defaults write com.apple.dock persistent-apps -array

echo "Set icon size to 48px"
defaults write com.apple.dock tilesize -int 48px

echo "Remove slide-in delay"
defaults write com.apple.dock autohide-delay -float 0

echo "Enable autohide"
defaults write com.apple.dock autohide -bool true

echo "Set animation speed to 0.5s"
defaults write com.apple.dock autohide-time-modifier -float 0.5

echo "Restart Dock"
killall Dock


echo "Disable startup chime"
sudo nvram SystemAudioVolume=%80

echo "Disable creation of .DS_Store files"
defaults write com.apple.desktopservices DSDontWriteNetworkStores true

defaults write com.apple.finder QLEnableTextSelection -bool true
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true

defaults write com.apple.screencapture disable-shadow -bool true
defaults write com.apple.screencapture location /Users/adrian/Desktop/Screenshots

defaults write NSNavPanelExpandedStateForSaveMode -bool TRUE

# TODO:
# Set preferences with systemsetup
# e.g. systemsetup -setnetworktimeserver us.pool.ntp.org

echo 'TODO: Disable "Add period with double space"'

echo 'TODO: Disable "Use smart quotes and dashes"'

# echo "Setup atom editor"
# ./bin/setup-atom


killall Finder
  • Add apps to Dock
dockutil --add /Applications/Spotify.app

dockutil --add /Applications/Affinity\ Photo.app
dockutil --add /Applications/Affinity\ Designer.app
dockutil --add /Applications/Perspec.app

dockutil --add /Applications/WhatsApp.app
dockutil --add /Applications/Element.app
dockutil --add /Applications/Telegram.app
dockutil --add /Applications/Discord.app
dockutil --add /Applications/Slack.app

dockutil --add /Applications/Brave\ Browser.app
dockutil --add /Applications/Firefox.app

dockutil --add /Applications/Thunderbird.app
dockutil --add /Applications/Calendar.app

dockutil --add /Applications/Sublime\ Merge.app
dockutil --add /Applications/Sublime\ Text.app
dockutil --add /Applications/Visual\ Studio\ Code.app
dockutil --add /Applications/iTerm2.app

dockutil --add /Applications/Notion.app
  • disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
  • setting trackpad & mouse speed to a reasonable number
defaults write -g com.apple.trackpad.scaling 2
defaults write -g com.apple.mouse.scaling 2.5
  • turn off keyboard illumination when computer is not used for 5 minutes
defaults write com.apple.BezelServices kDimTime -int 300
  • disable display from automatically adjusting brightness
sudo defaults write /Library/Preferences/com.apple.iokit.AmbientLightSensor "Automatic Display Enabled" -bool false
  • disable keyboard from automatically adjusting backlight brightness in low light
sudo defaults write /Library/Preferences/com.apple.iokit.AmbientLightSensor "Automatic Keyboard Enabled" -bool false
  • requiring password immediately after sleep or screen saver begins
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
  • where do you want screenshots
defaults write com.apple.screencapture location -string "${screenshot_location}"
  • what format should screenshots be saved as
defaults write com.apple.screencapture type -string "png"
defaults write com.apple.screencapture type -string "$screenshot_format"
  • disable the all too sensitive backswipe on trackpads
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false
  • enabling subpixel font rendering on non-Apple LCDs
defaults write NSGlobalDomain AppleFontSmoothing -int 2
  • enabling HiDPI display modes (requires restart)
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true
  • show icons for hard drives, servers, and removable media on the desktop
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
  • show hidden files in Finder by default
defaults write com.apple.Finder AppleShowAllFiles -bool true
  • show dotfiles in Finder by default
defaults write com.apple.finder AppleShowAllFiles TRUE
  • show all filename extensions in Finder by default
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
  • show all filename extensions in Finder by default
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
  • increase the size of icons on the desktop and in other icon views
/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
  • increase grid spacing for icons on the desktop and in other icon views
/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
  • automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
  • finder: show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
  • wipe all (default) app icons from the Dock
defaults write com.apple.dock persistent-apps -array
  • setting the icon size of Dock items to 36 pixels for optimal size/screen-realestate
defaults write com.apple.dock tilesize -int 36
  • speeding up Mission Control animations and grouping windows by application
defaults write com.apple.dock expose-animation-duration -float 0.1
defaults write com.apple.dock "expose-group-by-app" -bool true
  • disable the over-the-top focus ring animation
defaults write NSGlobalDomain NSUseAnimatedFocusRing -bool false
  • hide the menu bar
defaults write "Apple Global Domain" "_HIHideMenuBar" 1
  • set highlight color to green
defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600"
  • set sidebar icon size to medium
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2
  • always show scrollbars
defaults write NSGlobalDomain AppleShowScrollBars -string "Always"
  • set Dock to auto-hide and remove the auto-hiding delay
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock autohide-delay -float 0
defaults write com.apple.dock autohide-time-modifier -float 0
  • don't send search queries to Apple
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
  • hiding Safari's bookmarks bar by default
defaults write com.apple.Safari ShowFavoritesBar -bool false
  • hiding Safari's sidebar in Top Sites
defaults write com.apple.Safari ShowSidebarInTopSites -bool false
  • disabling Safari's thumbnail cache for History and Top Sites
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
  • enabling Safari's debug menu
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
  • making Safari's search banners default to Contains instead of Starts With
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
  • removing useless icons from Safari's bookmarks bar
defaults write com.apple.Safari ProxiesInBookmarksBar "()"
  • enabling the Develop menu and the Web Inspector in Safari
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
  • adding a context menu item for showing the Web Inspector in web views
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
  • disabling the annoying backswipe in Chrome
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false
defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false
  • using the system-native print preview dialog in Chrome
defaults write com.google.Chrome DisablePrintPreview -bool true
defaults write com.google.Chrome.canary DisablePrintPreview -bool true
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
  • enabling UTF-8 ONLY in Terminal.app and setting the Pro theme by default
defaults write com.apple.terminal StringEncodings -array 4
defaults write com.apple.Terminal "Default Window Settings" -string "Pro"
defaults write com.apple.Terminal "Startup Window Settings" -string "Pro"
  • prevent Time Machine from prompting to use new hard drives as backup volume
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
  • disable automatic emoji substitution in Messages.app? (i.e. use plain text smileys)
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false
  • disable smart quotes in Messages.app? (it's annoying for messages that contain code)
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false
  • disable continuous spell checking in Messages.app
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false
  • do you use Sublime Text 3 as your editor of choice, and is it installed
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
git config --global core.editor "subl -n -w"
  • do you use Transmission for torrenting
mkdir -p ~/Downloads/Incomplete

echo "Setting up an incomplete downloads folder in Downloads"
defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true
defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Downloads/Incomplete"

echo "Setting auto-add folder to be Downloads"
defaults write org.m0k.transmission AutoImportDirectory -string "${HOME}/Downloads"

echo "Don't prompt for confirmation before downloading"
defaults write org.m0k.transmission DownloadAsk -bool false

echo "Trash original torrent files after adding them"
defaults write org.m0k.transmission DeleteOriginalTorrent -bool true

echo "Hiding the donate message"
defaults write org.m0k.transmission WarningDonate -bool false

echo "Hiding the legal disclaimer"
defaults write org.m0k.transmission WarningLegal -bool false

echo "Auto-resizing the window to fit transfers"
defaults write org.m0k.transmission AutoSize -bool true

echo "Auto updating to betas"
defaults write org.m0k.transmission AutoUpdateBeta -bool true

echo "Setting up the best block list"
defaults write org.m0k.transmission EncryptionRequire -bool true
defaults write org.m0k.transmission BlocklistAutoUpdate -bool true
defaults write org.m0k.transmission BlocklistNew -bool true
defaults write org.m0k.transmission BlocklistURL -string "http://john.bitsurge.net/public/biglist.p2p.gz"
  • disable local Time Machine backups? (This can take up a ton of SSD space on <128GB SSDs)
hash tmutil &> /dev/null && sudo tmutil disablelocal
  • disable the over-the-top focus ring animation
defaults write NSGlobalDomain NSUseAnimatedFocusRing -bool false
  • disable smooth scrolling
defaults write NSGlobalDomain NSScrollAnimationEnabled -bool false
  • save to disk, rather than iCloud, by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
  • displaying ASCII control characters using caret notation in standard text views
defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true
  • disable the sudden motion sensor
sudo pmset -a sms 0
  • finder: show status bar
defaults write com.apple.finder ShowStatusBar -bool true
  • show status bar in Finder by default
defaults write com.apple.finder ShowStatusBar -bool true
  • display full POSIX path as Finder window title
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
  • disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
  • use column view in all Finder windows by default
defaults write com.apple.finder FXPreferredViewStyle Clmv
  • avoid creation of .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
  • disable disk image verification
defaults write com.apple.frameworks.diskimages skip-verify -bool true
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
  • allowing text selection in Quick Look/Preview in Finder by default
defaults write com.apple.finder QLEnableTextSelection -bool true
  • show item info near icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
fi
  • show item info to the right of the icons on the desktop
/usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist
  • enable snap-to-grid for icons on the desktop and in other icon views
/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
  • finder: allow text selection in Quick Look
defaults write com.apple.finder QLEnableTextSelection -bool true
  • disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
  • avoid creating .DS_Store files on network or USB volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
  • reveal IP address, hostname, OS version, etc. when clicking the clock in the login window
sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName
  • enable snap-to-grid for icons on the desktop and in other icon views
/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
  • save screenshots to the desktop
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferencesdefaults write com.apple.screencapture location -string "${HOME}/Desktop"
  • save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
defaults write com.apple.screencapture type -string "png"
  • сheck for software updates daily, not just once per week
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
  • removing duplicates in the 'Open With' menu
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
  • disable shadow in screenshots
defaults write com.apple.screencapture disable-shadow -bool true
  • disable smart quotes and smart dashes
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
  • add ability to toggle between Light and Dark mode in Yosemite using ctrl+opt+cmd+t
sudo defaults write /Library/Preferences/.GlobalPreferences.plist _HIEnableThemeSwitchHotKey -bool true
  • disable Photos.app from starting everytime a device is plugged in
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
  • disable hibernation (speeds up entering sleep mode)
sudo pmset -a hibernatemode 0
  • remove the sleep image file to save disk space
sudo rm /Private/var/vm/sleepimage
echo "Creating a zero-byte file instead"
sudo touch /Private/var/vm/sleepimage
echo "and make sure it can't be rewritten"
sudo chflags uchg /Private/var/vm/sleepimage
  • use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText -int 0
  • open and save files as UTF-8 in TextEdit
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
  • prevent Time Machine from prompting to use new hard drives as backup volume
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
  • change indexing order and disable some search results
# Yosemite-specific search results (remove them if you are using macOS 10.9 or older):
#   MENU_DEFINITION
#   MENU_CONVERSION
#   MENU_EXPRESSION
#   MENU_SPOTLIGHT_SUGGESTIONS (send search queries to Apple)
#   MENU_WEBSEARCH             (send search queries to Apple)
#   MENU_OTHER
defaults write com.apple.spotlight orderedItems -array \
  '{"enabled" = 1;"name" = "APPLICATIONS";}' \
  '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \
  '{"enabled" = 0;"name" = "DIRECTORIES";}' \
  '{"enabled" = 0;"name" = "PDF";}' \
  '{"enabled" = 0;"name" = "FONTS";}' \
  '{"enabled" = 0;"name" = "DOCUMENTS";}' \
  '{"enabled" = 0;"name" = "MESSAGES";}' \
  '{"enabled" = 0;"name" = "CONTACT";}' \
  '{"enabled" = 0;"name" = "EVENT_TODO";}' \
  '{"enabled" = 0;"name" = "IMAGES";}' \
  '{"enabled" = 0;"name" = "BOOKMARKS";}' \
  '{"enabled" = 0;"name" = "MUSIC";}' \
  '{"enabled" = 0;"name" = "MOVIES";}' \
  '{"enabled" = 0;"name" = "PRESENTATIONS";}' \
  '{"enabled" = 0;"name" = "SPREADSHEETS";}' \
  '{"enabled" = 0;"name" = "SOURCE";}' \
  '{"enabled" = 0;"name" = "MENU_DEFINITION";}' \
  '{"enabled" = 0;"name" = "MENU_OTHER";}' \
  '{"enabled" = 0;"name" = "MENU_CONVERSION";}' \
  '{"enabled" = 0;"name" = "MENU_EXPRESSION";}' \
  '{"enabled" = 0;"name" = "MENU_WEBSEARCH";}' \
  '{"enabled" = 0;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}'
# Load new settings before rebuilding the index
killall mds > /dev/null 2>&1
# Make sure indexing is enabled for the main volume
sudo mdutil -i on / > /dev/null
# Rebuild the index from scratch
sudo mdutil -E / > /dev/nule

Shell tweaks

  • general
# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`
    colorflag="--color"
    export LS_COLORS='no=00:fi=00:di=01;31:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'
else # macOS `ls`
    colorflag="-G"
    export LSCOLORS='BxBxhxDxfxhxhxhxhxcxcx'
fi
  • sips
# iOS and OSX Icon
sips -Z 512 $firstParameter --out mac/icon512.png

sips -Z 120 $firstParameter --out $secondParameter/Icon-60@2x.png
sips -Z 120 $firstParameter --out $secondParameter/Icon-60@2x-1.png
sips -Z 120 $firstParameter --out $secondParameter/Icon-60@2x-2.png
sips -Z 180 $firstParameter --out $secondParameter/Icon-60@3x.png
sips -Z 180 $firstParameter --out $secondParameter/Icon-60@3x-1.png
sips -Z 180 $firstParameter --out $secondParameter/Icon-60@3x-2.png

sips -Z 152 $firstParameter --out $secondParameter/Icon-76@2x.png
sips -Z 152 $firstParameter --out $secondParameter/Icon-76@2x-1.png
sips -Z 152 $firstParameter --out $secondParameter/Icon-76@2x-2.png

sips -Z 76 $firstParameter --out $secondParameter/Icon-76.png
sips -Z 76 $firstParameter --out $secondParameter/Icon-77.png
sips -Z 76 $firstParameter --out $secondParameter/Icon-78.png

# Android Icon
sips -Z 128 $firstParameter --out $secondParameter/Icon-128.png
  • replace by pattern:
grep -RIl "\<string name=\"app_copyright" app/src/main/res | xargs sed -i -e 's/-2017/–2018/g'
grep -RIl "\<string name=\"app_copyright" app/src/main/res | xargs sed -i -e 's/–2017/–2018/g'
  • ssh:
ssh -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i $HOME/.ssh/bitrise $@
  • set zsh as defaut shell:
chsh -s /bin/zsh

sudo sh -c 'echo /usr/local/bin/zsh >> /etc/shells'
chsh -s $(which zsh)

# Reload zsh settings
source ~/.zshrc
  • install oh-my-zsh:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# Edit the ~/.zshrc file (after installing oh-my-zsh)
ZSH_THEME="hyperzsh"

plugins=(gitfast fd nvm vi-mode z)

alias ipt-lg="git log --pretty=format:'%h | %<(80)%s | %<(12)%cr | %<(20)%an | %d' -15 | ipt --size 15 | sed 's#^[^0-9a-z]*\([0-9a-z]*\).*#\1#' | xargs git checkout"
alias ipt-branch="git branch | ipt | xargs git checkout"
alias ipt-bdelete="git branch | ipt -m | xargs git branch -D"
alias ipt-vim="ipt -pm | xargs -o vim"
alias ipt-gvim="ipt -pm | xargs -o gvim --remote-silent"

# Install hyperzsh theme
ln -s ~/Dropbox/dotfiles/hyperzsh.zsh-theme ~/.oh-my-zsh/custom/themes/hyperzsh.zsh-theme

alias gcm="git commit -m"
alias gp="git push"
alias gl="git pull"
alias gpo="git push origin"
alias gcp="git checkout -b"

alias scalescreen="xrandr --output DP1 --scale 0.85x0.85"
alias fixmouse="sudo modprobe -r rmi_smbus;sudo modprobe rmi_smbus"
alias runescape="env "LD_PRELOAD=libcurl.so.3" nxtlauncher"
alias fixdns='sudo sh -c "printf \"nameserver 1.1.1.1\" > /etc/resolv.conf"'
alias ccat='highlight -O ansi --force'
alias cpb='rsync -aP'
alias mpv='mpv --player-operation-mode=cplayer'
alias nano='vim'
alias path='echo -e ${PATH//:/\\n}'
#alias pstree='ps xawf'
alias mv='mv -i -v'
alias cp='cp -i -v'
alias mkdir='mkdir -p -v'
alias printip="dig +short myip.opendns.com @resolver1.opendns.com"
alias pubkey='cat ~/.ssh/id_rsa.pub | xsel --clipboard --input'
alias term='xfce4-terminal --default-working-directory=`pwd`'
alias cpwd='printf $(pwd) | xsel --clipboard --input'
alias cpy='xsel --clipboard --input'
alias pst='xsel --clipboard --output'

alias plog='heroku logs --tail --app bc-prod'
alias alog='heroku logs --tail --app bc-alpha'
alias slog='heroku logs --tail --app bc-stage'
alias dlog='heroku logs --tail --app bc-dev'
alias d2log='heroku logs --tail --app bc-dev-2'

export EDITOR="subl -n -w"

alias cleanBranches="git branch --merged | grep -v master | xargs git branch -D"
alias clearBranches="git branch | grep -v master | xargs git branch -D"
alias lga="git reflog | cut -f 1 -d ' ' | head -n 1000 | xargs git lg"

# cd's
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
alias .......='cd ../../../../../..'
alias ........='cd ../../../../../../..'
alias .........='cd ../../../../../../../..'

alias lesss='less -S'
alias wcl='wc -l'
alias cdd='cd ~/Desktop'

# git
alias gs="git status"
alias gc="git commit"
gcm() {
	git commit -m "$*"
}
alias gca="git commit --amend --no-edit"
alias ga="git add"
alias gau="git add -u"
alias gap="git add -p"
alias gaA="git add -A"
alias gd="git diff"
alias gk='gitk --all &'
alias gr="git rebase"
alias gf="git fetch"
alias gitlog='git log --pretty=" * [%h] %gd %d %s [<%an> %cd]" --date=local -5'


alias la='ls -A'           #  Show (a)ll hidden files
alias l='ls -CF'           #  Column output + indicator
alias lx='ls -lXB'         #  Sort by e(x)tension.
alias lk='ls -lSr'         #  Sort by size (biggest last)
alias lt='ls -ltr'         #  Sort by (t)ime (date, most recent last).
alias lc='ls -ltcr'        #  Sort by (c)hange (most recent last)
alias lu='ls -ltur'        #  Sort by (u)sage/access (most recent last).
# ll: directories first, with alphanumeric sorting:
alias ll="ls -lv --group-directories-first"
alias lm='ll |more'        #  Pipe through '(m)ore'
alias lr='ll -R'           #  (R)ecursive ll.
alias lla='ll -A'          #  Show (a)ll hidden files.
alias tree='tree -C' #  Alternative to 'recursive ls' ...

alias lesss='less -S'
# alias rgrep='grep -r'    # (r)ecursive grep
# alias fgrep='grep -F'    # (F)ixed string list
# alias egrep='grep -E'    # (E)xtended Regex
alias igrep='grep -i'      # case (i)nsensitive
alias h='history'
alias hg='history | grep'

alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

# Update installed Ruby gems, Homebrew, npm, and their installed packages
alias brew_update="brew -v update; brew upgrade --force-bottle --cleanup; brew cleanup; brew cask cleanup; brew prune; brew doctor; npm-check -g -u"
alias update_brew_npm_gem='brew_update; npm install npm -g; npm update -g; sudo gem update --system; sudo gem update --no-document'

killall Finder
killall Dock

# Ignoring duplicates in bash history
export HISTCONTROL=ignoreboth:erasedups

alias k="kubectl"
alias os="openstack"

# tmux shortcuts
alias ta="tmux attach -t"
alias tl="tmux list-session"
alias ts="tmux new-session -s"
alias tks="tmux kill-session -t"

# Clipboard
if [ ! $(uname -s) = "Darwin" ]; then
    alias pbcopy='xsel --clipboard --input'
    alias pbpaste='xsel --clipboard --output'
fi
  • miscellaneous commands
systemctl --no-pager status easywall
systemctl --no-pager daemon-reload

systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target;
systemctl suspend;
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target;
  • xrandr
#!/usr/bin/env bash
xrandr --output eDP-1 --primary --output DP-2-3 --auto --left-of eDP-1 --output DP-2-1 --auto --left-of DP-2-3
  • vlc
#!/usr/bin/sh
vlc --no-video-deco --no-embedded-video --screen-fps=60 --screen-top=0 --screen-left=1600 --screen-width=1920 --screen-height=1080 screen://
  • dpms
#!/usr/bin/sh
xset dpms force off; sleep 2; xset dpms force on
  • awk
FULLTEXT=$(cat /Users/burroughclarke/Desktop/commaseperatedvalues.csv)
printf "$FULLTEXT" | column  -t -s ','

readarray -t ARR < <(cat /Users/burroughclarke/Desktop/commaseperatedvalues.csv | tr "\n" "\n") 
printf '%s\n' "${ARR[@]}" | column  -t -s ','

awk 'NR==FNR{for(i=1;i<=NF;i++) 
        max[i] = length($i) > max[i] ? length($i) : max[i]; next} 
{ for(i=1;i<=NF;i++) printf "%-"max[i]"s  ", $i; printf "\n"}' text.txt text.txt

Git tweaks

  • git configure
git config --list
git reset --soft HEAD~
git log --pretty=oneline
git branch -a
git branch -d $firstParameter
git branch -m $firstParameter
git push origin --delete $firstParameter
git add -u

find . -name '.git' -exec rm -rf {} \;
open `git remote -v | awk '/fetch/{print $2}' | sed -Ee 's#(git@|git://)#http://#' -e 's@com:@com/@'`| head -n1
  • bundle size
git bundle create tmp.bundle --all
echo "\n\nCurrent Git repository size: "
du -sh tmp.bundle
rm tmp.bundle
  • configure git
git clone https://github.com/aframevr/aframe-boilerplate.git
cd aframe-boilerplate && rm -rf .git && npm install && npm start
open http://localhost:3000/

git config blame.ignoreRevsFile .git-blame-ignore-revs
## --ignore-revs-file=""

git config --global init.defaultBranch main
git config --global user.name "Borya"
git config --global user.email "borya@trdl.dev"

git commit -q --allow-empty --amend -m "$commitmsg"
git push -q -f origin $prbranch
git checkout -q -f $relbranch
git branch -q -D $prbranch

git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin
git config --global --unset credential.helper

git config --global core.autocrlf false

git config core.hooksPath .git_hooks

git pull --ff-only --no-stat

git submodule foreach git reset --hard
git submodule update --init --recursive

git config advice.ignoredHook false

git config --global alias.lastchange 'log -p --follow -n 1'

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

git config --global user.name "Your Name Here"
git config --global user.email youremail@example.com
git config --global github.user yourGithubUserNameHere

git config --global commit.gpgsign true
git config --global alias.unstage "reset HEAD --"
git config --global alias.last "log -1 HEAD"
git config --global alias.ci "commit"
git config --global alias.cia "commit --amend"
git config --global alias.cim "commit -m"
git config --global alias.cis "commit -S"
git config --global alias.civ "commit -v"
git config --global alias.co "checkout"
git config --global alias.cp "cherry-pick"
git config --global alias.d "diff"
git config --global alias.newb "checkout -b"
git config --global alias.r "remote"
git config --global alias.rv "remote -v"
git config --global alias.rb "rebase"
git config --global alias.tree "log --graph --oneline --all"
git config --global alias.undo "reset --mixed HEAD^"

# remove every file before switch; except the .git folder
find . -not -path '*.git/*' -not -path '*.git' -delete

git submodule init
git submodule update
git submodule foreach git pull origin master --recurse-submodules
  • create/update ~/.gitconfig
[filter "lfs"]
	clean = git-lfs clean -- %f
	smudge = git-lfs smudge -- %f
	process = git-lfs filter-process
	required = true
[user]
	name = Sayan Goswami
	email = goswami.sayan47@gmail.com
	signingkey = 7B183F66AD1CF1F1
[core]
	editor = vim

[alias]
 	co = checkout
 	ci = commit
	st = status
  	br = branch
  	hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
  	type = cat-file -t
	dump = cat-file -p

[commit]
	gpgsign = true
[gpg]
	program = gpg

; I removed the [user] and [github] blocks on purpose so other people don't copy it by mistake
; you will need to set these values later
[apply]
  whitespace = fix
[color]
  ui = auto
[color "branch"]
  current = yellow reverse
  local = yellow
  remote = green
[color "diff"]
  meta = yellow bold
  frag = magenta bold
  old = red bold
  new = green bold
[color "status"]
  added = yellow
  changed = green
  untracked = cyan
[merge]
  log = true
[push]
  ; "simple" avoid headaches, specially if you use `--force` w/o specifying branch
  ; see: http://stackoverflow.com/questions/13148066/warning-push-default-is-unset-its-implicit-value-is-changing-in-git-2-0
  default = simple
[url "git://github.com/"]
  insteadOf = "github:"
[url "git@github.com:"]
  insteadOf = "gh:"
  pushInsteadOf = "github:"
  pushInsteadOf = "git://github.com/"
[url "git@github.com:millermedeiros/"]
  insteadOf = "mm:"
[url "git@github.com:mout/"]
  insteadOf = "mout:"
[core]
  excludesfile = ~/.gitignore_global
  ; setting the editor fixes git commit bug http://tooky.co.uk/2010/04/08/there-was-a-problem-with-the-editor-vi-git-on-mac-os-x.html
  editor = /usr/bin/vim
[alias]
  ; show merge tree + commits info
  graph = log --graph --date-order -C -M --pretty=format:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=short
  lg = log --graph --pretty=format:'%Cred%h%Creset %C(yellow)%an%d%Creset %s %Cgreen(%cr)%Creset' --date=relative
  ; basic logging for quick browsing
  ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate
  ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate --numstat
  ; log + file diff
  fl = log -u
  ; find paths that matches the string
  f = "!git ls-files | grep -i"
  ; delete all merged branches
  ; dm = !git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
  ; shortcuts
  cp = cherry-pick
  st = status -s
  cl = clone
  ci = commit
  co = checkout
  br = branch
  dc = diff --cached
  • random commit message
git config --global alias.cowsay '!git commit -m "`fortune | cowsay -f tux`"'
git config --global alias.rci '!git commit -m "`curl -s http://whatthecommit.com/index.txt`"'
  • fetch remote branch to local branch
# .git/config

[remote "<remote_name>"]
  url = <remote_url>
  fetch = <remote_branch_name>:<local_branch_name>
  pushurl = no-push
  tagopt = --no-tags
[branch "<local_branch_name>"]
  remote = <remote_name>
  merge = <remote_branch_name>


[user]
  name = ckiehl

[color]
  ui = auto
[color "branch"]
  current = yellow reverse
  local = yellow
  remote = green
[color "diff"]
  meta = yellow bold
  frag = magenta bold
  old = red bold
  new = green bold
[color "status"]
  added = green
  changed = yellow
  untracked = cyan

# grab the new fetch-only branch
git fetch <remote_name>
  • create autoconfiguration
# github.com/jamiew/git-friendly
# the `push` command which copies the github compare URL to my clipboard is heaven
bash < <( curl https://raw.github.com/jamiew/git-friendly/master/install.sh)

# autocompletion for git branch names https://git-scm.com/book/en/v1/Git-Basics-Tips-and-Tricks
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash

Alias tweaks

alias history-stat="history 0 | awk '{print \$2}' | sort | uniq -c | sort -n -r | head"

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'


alias gedit='LANG=en_US gedit'
alias tmux="tmux -2"
alias gti="git"

# Ensure git speaks english
alias git='LANG=en_US git'
# Ensure meld doesn't crash when git speaks english
alias meld='LC_ALL=en_US.utf8 meld'

# List dir contents aliases
# ref: http://ss64.com/osx/ls.html
# Long form no user group, color
alias l="ls -oG"
# Order by last modified, long form no user group, color
alias lt="ls -toG"
# List all except . and ..., color, mark file types, long form no user group, file size
alias la="ls -AGFoh"
# List all except . and ..., color, mark file types, long form no use group, order by last modified, file size
alias lat="ls -AGFoth"

alias l='ls -1A'         # Lists in one column, hidden files.
alias ll='ls -lh'        # Lists human readable sizes.
alias lr='ll -R'         # Lists human readable sizes, recursively.
alias la='ll -A'         # Lists human readable sizes, hidden files.
alias lm='la | "$PAGER"' # Lists human readable sizes, hidden files through pager.
alias lk='ll -Sr'        # Lists sorted by size, largest last.
alias lt='ll -tr'        # Lists sorted by date, most recent last.
alias lc='lt -c'         # Lists sorted by date, most recent last, shows change time.
alias lu='lt -u'         # Lists sorted by date, most recent last, shows access time.
alias sl='ls'            # Correction for common spelling error.

setopt BANG_HIST                 # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY          # Write the history file in the ':start:elapsed;command' format.
setopt SHARE_HISTORY             # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST    # Expire a duplicate event first when trimming history.
setopt HIST_IGNORE_DUPS          # Do not record an event that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS      # Delete an old recorded event if a new event is a duplicate.
setopt HIST_FIND_NO_DUPS         # Do not display a previously found event.
setopt HIST_IGNORE_SPACE         # Do not record an event starting with a space.
setopt HIST_SAVE_NO_DUPS         # Do not write a duplicate event to the history file.
setopt HIST_VERIFY               # Do not execute immediately upon history expansion.
setopt HIST_BEEP                 # Beep when accessing non-existent history.


envsubst < "source.txt" > "destination.txt"
envsubst '\$NGINX_DEFAULT_CONF' < default.conf > /etc/nginx/conf.d/default.conf
envsubst '\$HTPASSWD' < .htpasswd > /etc/nginx/.htpasswd

screen -list 2> /dev/null \
      | sed '1d;$d' \
      | awk '{print $1}' \
      | head -1
exec screen -x "$session"
exec screen -a -A -U -D -R -m "$SHELL" -l

alias scr='screen'
alias scrl='screen -list'
alias scrn='screen -U -S'
alias scrr='screen -a -A -U -D -R'


export LESS='-g -i -M -R -S -w -X -z-4'
export LESSOPEN="| /usr/bin/env $commands[(i)lesspipe(|.sh)] %s 2>&-"


alias mkctl="microk8s kubectl"
mkctl create deployment aging —image nginx
mkctl expose deployment nginx —port 80 —target-port 80 —selector app=nginx —type ClusterIP —name ——

alias git-pr="gh pr list | ipt -u | cut -f 3 -d $'\t' | xargs gh pr checkout"

alias git-iadd="git status -s | sed s/^...// | ipt -m -M 'Select files to add:' | xargs git add"

alias calendar='cal -y --monday'
# Some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Allow aliases to be with sudo
alias sudo="sudo "

# Easier navigation: .., ..., ~ and -
alias ..="cd .."
alias ...="cd ../.."
alias ~="cd ~"
alias -- -="cd -"

# Concatenate and print content of files (add line numbers)
alias catn="cat -n"

# Open file in existing MacVim window
alias gvim="open -a MacVim"
alias mvim="open -a MacVim"

# Single letter git
alias s="git status --short"
alias c="git checkout"
alias b="git branch"

# IP addresses
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ipconfig getifaddr en1"

# Copy my public key to the pasteboard
alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | printf '=> Public key copied to pasteboard.\n'"

# Flush DNS cache
alias flushdns="dscacheutil -flushcache"

# Empty the Trash on all mounted volumes and the main HDD
# Also, clear Apple’s System Logs to improve shell startup speed
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl"

# Show/hide hidden files in Finder
alias showdotfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
alias hidedotfiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"

# Hide/show all desktop icons (useful when presenting)
alias showdeskicons="defaults write com.apple.finder CreateDesktop -bool true && killall Finder"
alias hidedeskicons="defaults write com.apple.finder CreateDesktop -bool false && killall Finder"

# SSH servers
alias cdigitalocean="ssh root@192.241.186.73"

export NVS_HOME="$HOME/.nvs"
git clone https://github.com/jasongin/nvs "$NVS_HOME"
. "$NVS_HOME/nvs.sh" install

sudo xattr -r -d com.apple.quarantine path/to/graalvm/folder/

# Multi CD
cdn () { pushd .; for ((i=1; i<=$1; i++)); do cd ..; done; pwd; }

alias "c=xclip"
alias "v=xclip -o"
alias "cs=xclip -selection clipboard"
alias "vs=xclip -o -selection clipboard"

alias prettyjson='python -m json.tool'

alias hdmi_left='~/.screenlayout/hdmi_left.sh'
alias hdmi_right='~/.screenlayout/hdmi_right.sh'
alias one_screen='~/.screenlayout/one_screen.sh'
alias beamer_right='~/.screenlayout/beamer_right.sh'

# Easier navigation: .., ..., ...., ....., ~ and -
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ~="cd ~" # `cd` is probably faster to type though
alias -- -="cd -"

# Shortcuts
alias d="cd ~/Documents/Dropbox"
alias dl="cd ~/Downloads"
alias dt="cd ~/Desktop"
alias p="cd ~/projects"
alias g="git"

# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`
	colorflag="--color"
	export LS_COLORS='no=00:fi=00:di=01;31:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'
else # macOS `ls`
	colorflag="-G"
	export LSCOLORS='BxBxhxDxfxhxhxhxhxcxcx'
fi

# List all files colorized in long format
alias l="ls -lF ${colorflag}"

# List all files colorized in long format, excluding . and ..
alias la="ls -lAF ${colorflag}"

# List only directories
alias lsd="ls -lF ${colorflag} | grep --color=never '^d'"

# Always use color output for `ls`
alias ls="command ls ${colorflag}"

# Always enable colored `grep` output
# Note: `GREP_OPTIONS="--color=auto"` is deprecated, hence the alias usage.
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

# Enable aliases to be sudo’ed
alias sudo='sudo '

# Get week number
alias week='date +%V'

# Get macOS Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages
alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; npm install npm -g; npm update -g; sudo gem update --system; sudo gem update; sudo gem cleanup'

# Google Chrome
alias chrome='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome'
alias canary='/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary'

# IP addresses
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ipconfig getifaddr en0"
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"

# Show active network interfaces
alias ifactive="ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active'"

# Flush Directory Service cache
alias flush="dscacheutil -flushcache && killall -HUP mDNSResponder"

# Clean up LaunchServices to remove duplicates in the “Open With” menu
alias lscleanup="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder"

# Canonical hex dump; some systems have this symlinked
command -v hd > /dev/null || alias hd="hexdump -C"

# macOS has no `md5sum`, so use `md5` as a fallback
command -v md5sum > /dev/null || alias md5sum="md5"

# macOS has no `sha1sum`, so use `shasum` as a fallback
command -v sha1sum > /dev/null || alias sha1sum="shasum"

# JavaScriptCore REPL
jscbin="/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc";
[ -e "${jscbin}" ] && alias jsc="${jscbin}";
unset jscbin;

# Trim new lines and copy to clipboard
alias c="tr -d '\n' | pbcopy"

# Recursively delete `.DS_Store` files
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete"

# Empty the Trash on all mounted volumes and the main HDD.
# Also, clear Apple’s System Logs to improve shell startup speed.
# Finally, clear download history from quarantine. https://mths.be/bum
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl; sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'"

# Show/hide hidden files in Finder
alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"

# Hide/show all desktop icons (useful when presenting)
alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder"
alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder"

# URL-encode strings
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"'

# Merge PDF files, preserving hyperlinks
# Usage: `mergepdf input{1,2,3}.pdf`
alias mergepdf='gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=_merged.pdf'

# Disable Spotlight
alias spotoff="sudo mdutil -a -i off"
# Enable Spotlight
alias spoton="sudo mdutil -a -i on"

# PlistBuddy alias, because sometimes `defaults` just doesn’t cut it
alias plistbuddy="/usr/libexec/PlistBuddy"

# Airport CLI alias
alias airport='/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport'

# Intuitive map function
# For example, to list all directories that contain a certain file:
# find . -name .gitattributes | map dirname
alias map="xargs -n1"

# One of @janmoesen’s ProTip™s
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do
	alias "${method}"="lwp-request -m '${method}'"
done

# Stuff I never really use but cannot delete either because of http://xkcd.com/530/
alias stfu="osascript -e 'set volume output muted true'"
alias pumpitup="osascript -e 'set volume output volume 100'"

# Kill all the tabs in Chrome to free up memory
# [C] explained: http://www.commandlinefu.com/commands/view/402/exclude-grep-from-your-grepped-output-of-ps-alias-included-in-description
alias chromekill="ps ux | grep '[C]hrome Helper --type=renderer' | grep -v extension-process | tr -s ' ' | cut -d ' ' -f2 | xargs kill"

# Lock the screen (when going AFK)
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"

# Reload the shell (i.e. invoke as a login shell)
alias reload="exec ${SHELL} -l"

# Print each PATH entry on a separate line
alias path='echo -e ${PATH//:/\\n}'

Database tweaks

$mysql -u"$mysql_user" "$mysql_password_arg" -e "SHOW DATABASES;" | tr -d "| " | grep -v Database

$mysqldump -u"$mysql_user" "$mysql_password_arg" --databases $db > `date +%Y%m%d`.$db.sql

sh -c '/Applications/MAMP/Library/bin/mysqld_safe --defaults-file=/Applications/MAMP/tmp/mysql/my.cnf --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --user=gabriel --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log.err --tmpdir=/Applications/MAMP/tmp/mysql/tmpdir --datadir=/Library/Application\ Support/appsolute/MAMP\ PRO/db/mysql &'

sh -c '/Applications/MAMP/Library/bin/mysqladmin -u root -proot --socket=/Applications/MAMP/tmp/mysql/mysql.sock shutdown'

sh -c '/Applications/MAMP/Library/bin/mysqld_safe --defaults-file=/Applications/MAMP/tmp/mysql/my.cnf --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --user=gabriel --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log.err --tmpdir=/Applications/MAMP/tmp/mysql/tmpdir --datadir=/Library/Application\ Support/appsolute/MAMP\ PRO/db/mysql &'

Ruby tweaks

sudo gem update --system; sudo gem update

gem install foreman
forego run -e .env.oss yarn stress

gem install faker
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'master'

gem install sass
gem install -n /usr/local/bin compass
gem install iStats -n/usr/local/bin
istats all

bundle install -j8 > /dev/null || bundle install > /dev/null
bundle exec jekyll build -s $SOURCE -d $DESTINATION --trace
bundle exec jekyll build -s $SOURCE_DIR -d $SOURCE_DIR/_site --profile --trace --verbose

gem install compass

export PATH=$PATH:$HOME/.rbenv/bin:$HOME/.rbenv/shims
curl -sL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash -

if ! rbenv versions | grep -q $RUBY_VERSION; then
    rbenv install $RUBY_VERSION
    rbenv global $RUBY_VERSION

    echo 'export PATH=$PATH:$HOME/.rbenv/bin:$HOME/.rbenv/shims' >> $BASHRC
    echo 'eval "$(rbenv init -)"' >> $BASHRC
fi

Vim tweaks

cat > $HOME/.vimrc <<'EOF'
set nocp
set nu
set nomodeline
set noexpandtab
set nowrap
set backspace=2
set whichwrap+=<,>,h,l
set encoding=utf-8
set termencoding=utf-8
set ruler
set splitbelow
set splitright
set showmode
set cmdheight=1
EOF

Python tweaks

alias py='python'
alias py2='python2'
alias py3='python3'

pip install -U Flask
flask run

pip3 install hotreload

pip install pip-compile-multi

pip install lektor
lektor server -f webpack

flask-docbuilder build --config configs/flask.json

pip list --outdated --format=freeze --local | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip install -U
pip3 list --outdated --format=freeze --local | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip3 install -U

sudo apt-get install python python-pip
sudo apt-get install libssl-dev libcurl4-openssl-dev
pip install pycurl
apt-get install meld

pip install metaflow
metaflow tutorials pull

pip install glances

pip3 install --upgrade translatepy
python3 -c "import translatepy; print(translatepy.__version__)"
translatepy translate --dest-lang Français --text Hello

pip3 install webdiff
pip3 install glitch-this
glitch_this [IMAGE PATH] [GLITCH_LEVEL]

pip install texttoimage
pip install envtpl

Vim tweaks

  • update vim modules
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
    curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

mkdir -p ~/.config/nvim/autoload
ln -s ~/.vim/autoload/pathogen.vim ~/.config/nvim/autoload/pathogen.vim

# Go to bundle folder
cd ~/.vim/bundle/
ln -s ~/.vim/bundle ~/.config/nvim/bundle

# get all plugins
git clone https://github.com/vim-scripts/bufkill.vim
git clone https://github.com/ctrlpvim/ctrlp.vim.git
git clone https://github.com/tpope/vim-fugitive.git
git clone https://github.com/rking/ag.vim
git clone https://github.com/editorconfig/editorconfig-vim.git
git clone https://github.com/simnalamburt/vim-mundo.git
git clone https://github.com/scrooloose/nerdtree.git
git clone https://github.com/scrooloose/syntastic.git
git clone https://github.com/altercation/vim-colors-solarized.git
git clone https://github.com/lifepillar/vim-solarized8
git clone https://github.com/Lokaltog/vim-easymotion.git
git clone https://github.com/nvie/vim-flake8.git
git clone https://github.com/mhinz/vim-signify.git
git clone https://github.com/ruyadorno/vim-statline.git
git clone https://github.com/AndrewRadev/splitjoin.vim.git
git clone https://github.com/elzr/vim-json.git
git clone https://github.com/ap/vim-css-color.git
git clone https://github.com/hail2u/vim-css3-syntax
git clone https://github.com/othree/html5.vim.git
git clone https://github.com/vim-scripts/SyntaxComplete.git
git clone https://github.com/othree/javascript-libraries-syntax.vim.git
git clone https://github.com/mxw/vim-jsx.git
git clone https://github.com/ekalinin/Dockerfile.vim.git
git clone https://github.com/tpope/vim-obsession.git
git clone https://github.com/leafgarland/typescript-vim.git
git clone https://github.com/christoomey/vim-tmux-navigator.git
  • update vim config
wget https://gist.github.com/AlexRogalskiy/a87a67dbb51a905d534d8ecb10e05e29

# create symlink to my vimrc file
ln -s ~/Dropbox/dotfiles/vimrc ~/.vimrc
# install Vundle to manage my plugins (https://github.com/VundleVim/Vundle.vim)
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

Terminal tweaks

  • create/update ~/.tmux.config
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
    | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h"  "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j"  "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k"  "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l"  "select-pane -R"
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
bind-key -T copy-mode-vi C-\ select-pane -l

# refresh 'status-left' and 'status-right' more often
set-option -g status-interval 5

# increase scrollback buffer size
set-option -g history-limit 50000

# address vim mode switching delay (http://superuser.com/a/252717/65504)
set-option -s escape-time 0

# focus events enabled for terminals that support them
set-option -g focus-events on

bind-key C-p previous-window
bind-key C-n next-window

# enable mouse
setw -g mouse on

# set default shell to zsh
set -g default-command /bin/zsh
set -g default-shell /bin/zsh
  • kill affected applications
find ~/Library/Application\ Support/Dock -name "*.db" -maxdepth 1 -delete
for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \
  "Dock" "Finder" "Mail" "Messages" "Safari" "SystemUIServer" \
  "Terminal" "Transmission"; do
  killall "${app}" > /dev/null 2>&1
done
  • symlink /tmp to ~/Downloads
sudo mv ~/Downloads ~/Downloads.bak
sudo ln -s /tmp ~/Downloads

Dotfiles tweaks

cd ~/Documents/repos/
git clone https://github.com/ruyadorno/dotfiles.git
git clone https://github.com/rupa/z.git

cd ~/
mkdir -p .config/nvim
ln -s $HOME/Documents/repos/dotfiles/.bashrc $HOME/.bash_profile
ln -s $HOME/Documents/repos/dotfiles/.gitconfig $HOME/.gitconfig
ln -s $HOME/Documents/repos/dotfiles/.gitignore_global $HOME/.gitignore_global
ln -s $HOME/Documents/repos/dotfiles/.npmrc $HOME/.npmrc
ln -s $HOME/Documents/repos/dotfiles/.vimrc $HOME/.vimrc
ln -s $HOME/Documents/repos/dotfiles/.vimrc $HOME/.config/nvim/init.vim
ln -s $HOME/Documents/repos/dotfiles/.tmux.conf $HOME/.tmux.conf

§eaks

# setup neovim
pip3 install termtosvg

# setup python support for neovim
pip3 install --user neovim

pip install whoogle-search
sudo systemctl daemon-reload
sudo systemctl enable whoogle
sudo systemctl start whoogle

python -m pip install visualdl -i https://mirror.baidu.com/pypi/simpl

pip install pyinstaller
pyinstaller main.py --distpath build --onefile

# Python 2.7
python -m SimpleHTTPServer
# Python 3
python -m http.server

GPG tweaks

## install gpg suite
brew cask install private-internet-access
brew cask install gpg-suite

## link gpg config into place
ln -s $HOME/Documents/repos/dotfiles/gpg.conf $HOME/.gnupg/gpg.conf
ln -s $HOME/Documents/repos/dotfiles/gpg-agent.conf $HOME/.gnupg/gpg-agent.conf

Tmux tweaks

git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
tmux start-server
tmux source ~/.tmux.conf
~/.tmux/plugins/tpm/scripts/install_plugins.sh

Windows tweaks

winget install Microsoft.PowerToys -s winget

Node tweaks

yarn global upgrade

export NVS_HOME="$HOME/.nvs" git clone https://github.com/jasongin/nvs "$NVS_HOME" . "$NVS_HOME/nvs.sh" install ——

npm install --global csvnorm

npm install --global chokidar

npm install --global @warriorjs/cli
warriorjs

npm install --global transity

transity gplot examples/journal.yaml \
| awk '/^$/ || /(EOD|^set terminal)/ || /€/' \
| gnuplot \
| imgcat

transity gplot-cumul examples/journal.yaml \
| awk '/^$/ || /(EOD|^set terminal)/ || /€/' \
| gnuplot \
| imgcat

npm install --save neodoc

npm install -g tree-node-cli
tree -L 2 -I "node_modules"

# Install the CLI tool globally
npm install canvas-sketch-cli -g

npm install -g imageoptim-cli

npm install -g os-cli
npm i -g encrypt-and-decrypt
npm install -g detox-cli

npm install -g ga-wdio

npm install --global fast-cli

node --print_opt_source --print_opt_code ./multiply-many.js

# Make a new folder to hold all your generative sketches
mkdir my-sketches

# Move into that folder
cd my-sketches

# Scaffold a new 'sketch.js' file and open the browser
canvas-sketch sketch.js --new --open

# Start the tool on an existing file and change PNG export folder
canvas-sketch src/foobar.js --output=./tmp/

# Start a new sketch from the Three.js template
canvas-sketch --new --template=three --open

# Build your sketch to a sharable HTML + JS website
canvas-sketch src/foobar.js --build

# Develop with "Hot Reloading" instead of full page reload
canvas-sketch src/foobar.js --hot

npm install budo -g
# serve file on port 9966 and open browser
budo index.js --open

# enable LiveReload on HTML/CSS/JS file changes
budo index.js --live

# default html will use src="static/bundle.js"
budo src/index.js:static/bundle.js

# pass some options to browserify
budo index.js --live -- -t babelify

# use HTTPS and enable CORS headers
budo index.js --ssl --cors

# LiveReload public directory without any bundling
budo --dir public/ --live

npm install jasmine-expect --save-dev

npm install --global giterator

npm install --save got
npm install -g tldr

npm install --global self-help
self-help interactive --source ./path/to/help-document.js
self-help markdown --source ./path/to/help-document.js

npm install -g detox-cli

npm install -g astexplorer.app

npm install -g puppeteer bundle-wizard
bundle-wizard --interact
npx bundle-wizard reddit.com

npm install -g jsonlint
npm install -g eslint
npm install -g eslintme
npm install -g http-server
npm install -g ipt
npm install -g ntl
npm install -g fkill-cli
npm install -g diff-so-fancy
npm install -g svg-term
npm install -g json
npm install -g vmd

npm install -g ipt
npm install -g http-server
npm install -g esformatter
npm install -g prettier
npm install -g eslint
# yeah, haters gonna hate
npm install -g replace

npm install json2ts

npm i -g github-spray
github-spray -t <text> --multiplier <factor> --push --origin <github_repository_url>
github-spray -t hello --multiplier 10 --push --origin https://github.com/John/hello.git
github-spray -t Wald0 --font portable_vengeance
github-spray -t hello --flipvertical
github-spray -t hello --fliphorizontal
github-spray -f patterns/space-invaders.json

# Type `git open` to open the GitHub page or website for a repository.
npm install -g git-open

# fancy listing of recent branches
npm install -g git-recent

npm install -g nmtree
nmtree /path/to/my/lib > my-lib-node-modules.json

# trash as the safe `rm` alternative
npm install --global trash-cli

# more readable git diffs
npm install --global diff-so-fancy

# my preferred statik webserver
npm install -g statikk

npm install --save-dev micro-dev

npm install -g truffle
truffle init
truffle compile

npm install -g yaml2json
npm -g i dot2doc

npm install burnchart -g
burnchart --port 8080
burnchart/3.0.0 started on port 8080

Bash tweaks

# change to bash 4 (installed by homebrew)
BASHPATH=$(brew --prefix)/bin/bash
#sudo echo $BASHPATH >> /etc/shells
sudo bash -c 'echo $(brew --prefix)/bin/bash >> /etc/shells'
chsh -s $BASHPATH # will set for current user only.
echo $BASH_VERSION # should be 4.x not the old 3.2.X
# Later, confirm iterm settings aren't conflicting.

Kotlin tweaks

kotlinc -d main.jar main.kt && kotlin -classpath main.jar MainKt

Misc tweaks

  • general
sudo xattr -r -d com.apple.quarantine path/to/graalvm/folder

softwareupdate -i -a --restart

xcode-select --install
  • max file size
sudo sysctl -w kern.maxfiles=10485760
sudo sysctl -w kern.maxfilesperproc=1048576

Putting the following into a file named /etc/sysctl.conf on macOS will cause these values to persist across reboots:

kern.maxfiles=10485760
kern.maxfilesperproc=1048576
  • update/create computer name
sudo scutil --set ComputerName $COMPUTER_NAME
sudo scutil --set HostName $COMPUTER_NAME
sudo scutil --set LocalHostName $COMPUTER_NAME
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string $COMPUTER_NAME
  • disable the sound effects on boot
sudo nvram SystemAudioVolume=" "
  • renew IP/clean dns cache
В Windows: запустите командную строку (Пуск → Выполнить → cmd.exe). Наберите одну за другой команды ipconfig /release, ipconfig /flushdns и ipconfig/renew, после введения каждой из них нажимая клавишу Enter.

В MacOS: см. п. 3 предыдущего раздела. Откройте вкладку «TCP/IP» и нажмите на кнопку «Обновить DHCP». Зайдите в раздел Finder → Программы → Утилиты, запустите приложение «Терминал.app» и введите команду dscacheutil -flushcache.

Database tweaks

  • list of db folders
ps auxw | grep postgres | grep -- -D
  • list of databases
psql -l
  • create db dump
pg_dump -h localhost -O -F t -c -U postgres <имя_бд> | gzip -c > <имя_файла>.gz
  • create dump of db
pg_dump -h localhost -O -F t -c -U postgres <db> | gzip -c > <file>.gz

where:
-h [host]: имя хоста, значение по умолчанию localhost или значение из переменной окружения PGHOST.
-О: пропускает команды для установки владельца таблиц, видов и т. д.
-F {c|t|p}: формат вывода данных custom, tar, plane text.
-c: добавляет команды для удаления (drop) объектов (таблиц, видов и т. д.).
-U [username]: — пользователь, чьими правами доступа нужно воспользоваться при запросе данных. По умолчанию берется текущий пользователь.
  • create dump of all dbs
pg_dumpall | gzip -c > <file>.gz

SQL tweaks

  • common DDL expressions
CREATE TABLE Submissions (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    age VARCHAR(30) NOT NULL,
    sex VARCHAR(30) NOT NULL,
    future VARCHAR(30) NOT NULL,
    democracy INT(5),
    money INT(5),
    success INT(5),
    education INT(5),
    health INT(5),
    environment INT(5),
    family INT(5),
    futurelist VARCHAR(50),
    changefuture VARCHAR(30),
    climatechange VARCHAR(30),
    sustainability VARCHAR(30) NOT NULL,
    sustainabilityscale INT(5),
    nosustainability VARCHAR(30),
    sustainabilityeveryday VARCHAR(30),
    sustainabilityactions VARCHAR(500),
    nosustainabilitymotivation VARCHAR(30),
    sustainabilitymotivation VARCHAR(500),
    source VARCHAR(30) NOT NULL,
    reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)

CREATE TABLE Signups (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    firstname VARCHAR(30) NOT NULL,
    lastname VARCHAR(30) NOT NULL,
    email VARCHAR(50) NOT NULL UNIQUE,
    age INT(6) NOT NULL,
    message VARCHAR(300),
    reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)

DROP TABLE IF EXISTS task;

CREATE TABLE task (
  id INT AUTO_INCREMENT  PRIMARY KEY,
  name VARCHAR(250) NOT NULL,
  description VARCHAR(250) NOT NULL
);

INSERT INTO task (name, description) VALUES
  ('name1', 'This is name 1'),
  ('name2', 'This is name 2'),
  ('name3', 'This is name 3');
  • common table expressions
WITH <data> AS (
     SELECT * FROM (VALUES
                        ('test-1', 10000),
                        ('test-2', 20000),
                        ('test-3', 30000)
                   )
                   AS t (title, num)
)
UPDATE <table> t SET t.name = data.name
FROM <data>
WHERE t.value = data.value

   WITH TestCTE (UserID, Post, ManagerID)
        AS
        (
                SELECT UserID, Post, ManagerID FROM TestTable 
        )
   SELECT * FROM TestCTE

   WITH TestCTE(UserID, Post, ManagerID, LevelUser)
   AS
   (    
        -- Находим якорь рекурсии
        SELECT UserID, Post, ManagerID, 0 AS LevelUser 
        FROM TestTable WHERE ManagerID IS NULL
        UNION ALL
        --Делаем объединение с TestCTE (хотя мы его еще не дописали)
        SELECT t1.UserID, t1.Post, t1.ManagerID, t2.LevelUser + 1 
        FROM TestTable t1 
        JOIN TestCTE t2 ON t1.ManagerID=t2.UserID
   )
   SELECT * FROM TestCTE ORDER BY LevelUser
   OPTION (MAXRECURSION 5)
  • create table
CREATE TABLE public.author (
    id integer NOT NULL,
    name text NOT NULL
);
CREATE SEQUENCE public.author_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
ALTER SEQUENCE public.author_id_seq OWNED BY public.author.id;
ALTER TABLE ONLY public.author ALTER COLUMN id SET DEFAULT nextval('public.author_id_seq'::regclass);
ALTER TABLE ONLY public.author
    ADD CONSTRAINT author_pkey PRIMARY KEY (id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment