├── .editorconfig ├── .gitignore ├── LICENSE.md ├── README.md ├── apps ├── brewfile ├── install.sh └── npmfile ├── dock ├── dotfiles ├── .bash_history ├── .commands │ ├── $ │ ├── clean │ ├── dock │ ├── download │ ├── finder │ ├── firefox │ ├── images │ ├── mac │ ├── network │ ├── ringtone │ ├── template │ ├── text │ ├── update │ └── video ├── .curlrc ├── .exports ├── .gitconfig ├── .gitignore ├── .gnupg │ ├── gpg-agent.conf │ └── gpg.conf ├── .hushlogin ├── .inputrc ├── .path ├── .profile ├── .ssh │ ├── config_example │ ├── example_rsa │ └── example_rsa.pub ├── .stow-local-ignore ├── .wgetrc └── install.sh ├── hosts ├── preferences ├── primer.sh └── resources ├── Dracula.terminal ├── Package Control.sublime-settings ├── Preferences.sublime-settings └── Sublime Text Steps.txt /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = tab 6 | end_of_line = lf 7 | insert_final_newline = true 8 | trim_trailing_whitespace = true 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dotfiles/.gitconfig 2 | dotfiles/.gnupg 3 | dotfiles/!.gnupg/gpg-agent.conf 4 | dotfiles/!.gnupg/gpg.conf 5 | dotfiles/.private 6 | dotfiles/.ssh 7 | dotfiles/.ssh/*_rsa* 8 | dotfiles/!.ssh/example_rsa* 9 | 10 | hosts 11 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c)
4 | 2015-2022 Barry Anders 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mac Primer 2 | 3 | I use **Mac Primer** to automatically set up my Mac. Feel free to use this as a base for your own setup. 4 | 5 | Use this one-liner to install everything (`apps`, `dotfiles`, `preferences`, `dock`, and `hosts`). This does a lot, so you should customize everything prior to running any installers. 6 | 7 | ```bash 8 | git clone https://github.com/barryanders/mac-primer.git ~/ && ~//primer.sh 9 | ``` 10 | 11 | After installing, I use the [`update`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/update) command to update everything. 12 | 13 | ## Index 14 | 15 | If you don't want to use the one-liner, you can pick and choose from the sections below. 16 | 17 | - [`apps`](#apps): Lists of installable packages 18 | - [`dotfiles`](#dotfiles): Shell commands and configurations 19 | - [`preferences`](#preferences): Presets for system preferences 20 | - [`dock`](#dock): Customize your Dock 21 | - [`hosts`](#hosts): Track your hosts 22 | 23 | ## [Apps](https://github.com/barryanders/mac-primer/tree/main/apps) 24 | 25 | To install my apps, I use [`brewfile`](https://github.com/barryanders/mac-primer/blob/main/apps/brewfile) (an installable list of apps generated by and for [Homebrew](https://github.com/Homebrew/brew)). I rely almost exclusively on Homebrew to manage and update my apps. [Learn how to make your own brewfile](https://github.com/Homebrew/homebrew-bundle). 26 | 27 | ### Install Apps 28 | 29 | Run [this script](https://github.com/barryanders/mac-primer/blob/main/apps/install.sh) to install the packages listed in the apps folder. 30 | 31 | ```bash 32 | ~//apps/install.sh 33 | ``` 34 | 35 | ### Update Apps 36 | 37 | If you want to update your apps only, use the [`update brew`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/update) command. 38 | 39 | ## [Dotfiles](https://github.com/barryanders/mac-primer/tree/main/dotfiles) 40 | 41 | To customize my command line experience, I keep a set of configurations known as [dotfiles](https://dotfiles.github.io/). 42 | 43 | ### Install Dotfiles 44 | 45 | The dotfiles installer requires [GNU Stow](https://www.gnu.org/software/stow/) ([`brew install stow`](https://formulae.brew.sh/formula/stow)). Run [this script](https://github.com/barryanders/mac-primer/blob/main/dotfiles/install.sh) to install dotfiles. 46 | 47 | ```bash 48 | ~//dotfiles/install.sh 49 | ``` 50 | 51 | ### Update Dotfiles 52 | 53 | After installing, the dotfiles in `~//dotfiles` have links in the home directory. You may need to start a new CLI session for your changes to take effect (I use the [`reload`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/$) command). As you add or remove files, simply rerun the installer to sync your changes. Dead links get removed and new links get added. I use the [`update dotfiles`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/update) command to relink mine. 54 | 55 | ### Customize Dotfiles 56 | 57 | #### `.commands` Folder 58 | 59 | The [`.commands`](https://github.com/barryanders/mac-primer/tree/main/dotfiles/.commands) folder is intended for you to add and remove custom commands in a categorical way. Keep what you want. Refer to the [`template`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/template) file for a basic example of how to create your own commands. 60 | 61 | Here's what I've got in there for you: 62 | 63 | - [`$`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/%24): Reasonable Terminal defaults 64 | - [`clean`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/clean): System maintenance 65 | - [`dock`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/dock): Control your Dock 66 | - [`download`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/download): Download links, music, and videos 67 | - [`finder`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/finder): View files, get info, perform actions, extract, compress, etc. 68 | - [`images`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/images): Batch resizing images 69 | - [`mac`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/mac): A CLI for macOS - ex. Spotlight, Wi-Fi, Gatekeeper 70 | - [`network`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/network): Get IP addresses and flush your dns 71 | - [`ringtone`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/ringtone): Turn any mp3 into a ringtone for your phone 72 | - [`text`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/text): Format text and encode/decode in base64, binary, hex, md5, and sha1 73 | - [`update`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/update): Update all the things 74 | - [`video`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/video): Remux, encode, or merge videos 75 | 76 | #### `.path` File 77 | 78 | Append to the `$PATH`. Here's an example `.path` file. 79 | 80 | ```bash 81 | export PATH="/opt/homebrew/bin:$PATH" 82 | ``` 83 | 84 | #### `.private` File 85 | 86 | Add private code that you don't want to commit to a public repository. My `.private` file looks something like this. 87 | 88 | ```bash 89 | # Git credentials 90 | # Not in the repository, to prevent people from accidentally committing under my name 91 | # https://help.github.com/articles/generating-a-gpg-key/ 92 | # Use "gpg --full-generate-key" for a full featured key generation dialog 93 | GIT_AUTHOR_NAME="Username" 94 | GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" 95 | git config --global user.name "$GIT_AUTHOR_NAME" 96 | GIT_AUTHOR_EMAIL="username@users.noreply.github.com" 97 | GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL" 98 | git config --global user.email "$GIT_AUTHOR_EMAIL" 99 | # Use "gpg --list-secret-keys --keyid-format LONG" to find the signing key 100 | # For users with 2 factor authentication enabled: if git asks you to sign in, use an access token as your password 101 | # Get an access token here: https://github.com/settings/tokens 102 | GIT_SIGNING_KEY="starwarsissocool" 103 | git config --global user.signingkey "$GIT_SIGNING_KEY" 104 | ``` 105 | 106 | #### Other Dotfiles 107 | 108 | There are some other dotfiles included like [`.hushlogin`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.hushlogin), [`.wgetrc`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.wgetrc), and [`.gitconfig`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.gitconfig). 109 | 110 | ## [Preferences](https://github.com/barryanders/mac-primer/blob/main/preferences) 111 | 112 | Use [`preferences`](https://github.com/barryanders/mac-primer/blob/main/preferences) to make adjustments you would otherwise set in the System Preferences app. Define this file and reuse it whenever you like. If your settings ever get messed up, this is a great way to restore them. 113 | 114 | ```bash 115 | ~//preferences 116 | ``` 117 | 118 | ## [Dock](https://github.com/barryanders/mac-primer/blob/main/dock) 119 | 120 | Customize your Dock with the [`dock`](https://github.com/barryanders/mac-primer/blob/main/dock) file. Use these commands: 121 | 122 | - `dock add "Terminal"`: Add an application to the macOS Dock 123 | - `dock add:spacer`: Adds an empty space to macOS Dock 124 | - `dock clear`: Removes all persistent icons from macOS Dock 125 | - `dock reset`: Reset macOS Dock to default settings 126 | 127 | Once you're done, run the [`dock`](https://github.com/barryanders/mac-primer/blob/main/dock) file and your Dock will be updated accordingly. 128 | 129 | ```bash 130 | ~//dock 131 | ``` 132 | 133 | ## [Hosts](https://github.com/barryanders/mac-primer/blob/main/hosts) 134 | 135 | Keep track of your hosts in the [`hosts`](https://github.com/barryanders/mac-primer/blob/main/hosts) file. I use [`update hosts`](https://github.com/barryanders/mac-primer/blob/main/dotfiles/.commands/update) to replace my system hosts file with this one. 136 | 137 | ## Author 138 | 139 | 140 | Barry Anders 141 |
142 | Barry Anders 143 |
144 | -------------------------------------------------------------------------------- /apps/brewfile: -------------------------------------------------------------------------------- 1 | tap "homebrew/bundle" 2 | tap "homebrew/services" 3 | # New file format for still image compression 4 | brew "jpeg-xl" 5 | # Bourne-Again SHell, a UNIX command interpreter 6 | brew "bash" 7 | # Programmable completion for Bash 3.2 8 | brew "bash-completion" 9 | # Fish completion for brew-cask 10 | brew "brew-cask-completion" 11 | # Console Matrix 12 | brew "cmatrix" 13 | # GNU File, Shell, and Text utilities 14 | brew "coreutils" 15 | # Cryptography and SSL/TLS Toolkit 16 | brew "openssl@3" 17 | # Get a file from an HTTP, HTTPS or FTP server 18 | brew "curl" 19 | # Terminal visual disk space navigator 20 | brew "diskonaut" 21 | # More intuitive version of du in rust 22 | brew "dust" 23 | # Perl lib for reading and writing EXIF metadata 24 | brew "exiftool" 25 | # Modern, maintained replacement for ls 26 | brew "eza" 27 | # Like neofetch, but much faster because written mostly in C 28 | brew "fastfetch" 29 | # Interpreted, interactive, object-oriented programming language 30 | brew "python@3.12" 31 | # Play, record, convert, and stream audio and video 32 | brew "ffmpeg" 33 | # Command-line downloader for image-hosting site galleries and collections 34 | brew "gallery-dl" 35 | # WebDriver <-> Marionette proxy 36 | brew "geckodriver" 37 | # GitHub command-line tool 38 | brew "gh" 39 | # Distributed revision control system 40 | brew "git" 41 | # GNU Pretty Good Privacy (PGP) package 42 | brew "gnupg" 43 | # LLVM's OpenMP runtime library 44 | brew "libomp", link: true 45 | # Tools and libraries to manipulate images in many formats 46 | brew "imagemagick" 47 | # Next-gen compiler infrastructure 48 | brew "llvm" 49 | # Mac App Store command-line interface 50 | brew "mas" 51 | # Command-line client for Mega.co.nz 52 | brew "megatools" 53 | # Matroska media files manipulation tools 54 | brew "mkvtoolnix" 55 | # Read, create, and modify MP4 files 56 | brew "mp4v2" 57 | # Platform built on V8 to build network applications 58 | brew "node" 59 | # Libraries for security-enabled client and server applications 60 | brew "nss" 61 | # Tools for one-time password authentication systems 62 | brew "oath-toolkit" 63 | # Pinentry for GPG on Mac 64 | brew "pinentry-mac" 65 | # Execute binaries from Python packages in isolated environments 66 | brew "pipx" 67 | # Safe, concurrent, practical language 68 | brew "rust" 69 | # Cross-shell prompt for astronauts 70 | brew "starship" 71 | # Organize software neatly under a single directory tree (e.g. /usr/local) 72 | brew "stow" 73 | # Manipulate and query tags on macOS files 74 | brew "tag" 75 | # Internet file retriever 76 | brew "wget" 77 | # Feature-rich command-line audio/video downloader 78 | brew "yt-dlp" 79 | # Shell extension to navigate your filesystem faster 80 | brew "zoxide" 81 | # Control every piece of your controller 82 | cask "8bitdo-ultimate-software" 83 | # View, print, and comment on PDF documents 84 | cask "adobe-acrobat-reader" 85 | # Collection of apps and services for photography, design, video, web, and UX 86 | cask "adobe-creative-cloud" 87 | # Chromium based browser 88 | cask "arc" 89 | # Tool to remove unnecessary files and folders from disk 90 | cask "cleanmymac" 91 | # Tool to run Windows software 92 | cask "crossover" 93 | # Server and cloud storage browser 94 | cask "cyberduck" 95 | # Data recovery software 96 | cask "disk-drill" 97 | # Emulator to play GameCube and Wii games 98 | cask "dolphin" 99 | # Web browser 100 | cask "firefox" 101 | cask "font-open-sans" 102 | cask "font-raleway" 103 | # Disk space cleaner that finds and deletes duplicated and similar files 104 | cask "gemini" 105 | # Client for the Google Drive storage service 106 | cask "google-drive" 107 | # Free and open-source media player 108 | cask "iina" 109 | # Tool to scan a website checking for broken links 110 | cask "integrity" 111 | # Professional audio software for audio recording, mixing, broadcast and others 112 | cask "izotope-product-portal" 113 | # Tool to prevent the system from going into sleep mode 114 | cask "keepingyouawake" 115 | # File archiver 116 | cask "keka" 117 | # Tool to show what is persistently installed on the computer 118 | cask "knockknock" 119 | # Open-source firewall to block unknown outgoing connections 120 | cask "lulu" 121 | # Network monitor 122 | cask "netiquette" 123 | # Customise and maintain app icons 124 | cask "pictogram" 125 | # Home media player 126 | cask "plex" 127 | # Command-line shell and scripting language 128 | cask "powershell" 129 | # VPN client focusing on security 130 | cask "protonvpn" 131 | # Control your tools with a few keystrokes 132 | cask "raycast" 133 | # Download manager for Spitfire audio libraries 134 | cask "spitfire-audio" 135 | # Video game digital distribution service 136 | cask "steam" 137 | # Git client 138 | cask "sublime-merge" 139 | # Text editor for code, markup and prose 140 | cask "sublime-text" 141 | # Application for inspecting installer packages 142 | cask "suspicious-package" 143 | # AI image enhancer 144 | cask "topaz-photo-ai" 145 | # Charting and social-networking for investment traders 146 | cask "tradingview" 147 | # Rust-based terminal 148 | cask "warp" 149 | # Client to install and activate Waves products 150 | cask "waves-central" 151 | # Video communication and virtual meeting platform 152 | cask "zoom" 153 | mas "Affinity Photo 2", id: 1616822987 154 | mas "compressum", id: 6479709701 155 | mas "Convertum", id: 6480382704 156 | mas "DaVinci Resolve Studio", id: 900392332 157 | mas "Draw Things", id: 6444050820 158 | mas "Infuse", id: 1136220934 159 | mas "Microsoft Excel", id: 462058435 160 | mas "Microsoft Word", id: 462054704 161 | mas "Sasquatch", id: 1465346522 162 | mas "SonicWall Mobile Connect", id: 822514576 163 | mas "Step Two", id: 1448916662 164 | mas "The Unarchiver", id: 425424353 165 | mas "Today", id: 6443714928 166 | mas "Vivid", id: 6443470555 167 | mas "Windows App", id: 1295203466 168 | -------------------------------------------------------------------------------- /apps/install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo 'Installing apps…' 4 | cd ~//apps/ 5 | chmod +x *.sh 6 | 7 | # Brew: The missing package manager for macOS | https://github.com/Homebrew/brew 8 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" 9 | brew tap "homebrew/bundle" 10 | brew bundle 11 | brew cleanup 12 | brew doctor 13 | 14 | # Make brew work 15 | eval $(/opt/homebrew/bin/brew shellenv) 16 | 17 | # Switch to using brew-installed bash as default shell 18 | BREW_PREFIX=$(brew --prefix) # Homebrew's installed location 19 | if ! fgrep -q "${BREW_PREFIX}/bin/bash" /etc/shells; then 20 | echo "${BREW_PREFIX}/bin/bash" | sudo tee -a /etc/shells; 21 | chsh -s "${BREW_PREFIX}/bin/bash"; 22 | fi; 23 | 24 | # npm: a JavaScript package manager | https://github.com/npm/cli 25 | for i in $(cat npmfile); do 26 | npm install -g $i 27 | done 28 | wait 29 | -------------------------------------------------------------------------------- /apps/npmfile: -------------------------------------------------------------------------------- 1 | fast-cli 2 | -------------------------------------------------------------------------------- /dock: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ~//dotfiles/.commands/dock 4 | 5 | dock clear 6 | dock add "Firefox" 7 | dock add "Sublime Text" 8 | dock add "Draw Things" 9 | 10 | killall Dock 11 | -------------------------------------------------------------------------------- /dotfiles/.bash_history: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barryanders/mac-primer/244f61bc023162bc29ca44ae47993105451327e0/dotfiles/.bash_history -------------------------------------------------------------------------------- /dotfiles/.commands/$: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | alias whereami="hostname" 4 | 5 | # `clear` or `c` | Same as ⌘K 6 | alias clear="printf '\033c\e[3J'" 7 | alias c="clear" 8 | 9 | # `reload` or `r` | Reload the shell (i.e. invoke as a login shell) 10 | alias reload="exec $SHELL -l" 11 | alias r="reload" 12 | 13 | # Print each PATH entry on a separate line 14 | alias path='echo -e ${PATH//:/\\n}' 15 | 16 | # admin 17 | #-------# 18 | 19 | # `sudo` | Enable aliases to be sudoed 20 | alias sudo='sudo ' 21 | # `root` | Persistent sudo 22 | alias root="sudo -v; while true; do sudo -n true; sleep 60; kill -0 \"$$\" || exit; done 2>/dev/null &" 23 | 24 | # preserve default commands 25 | #---------------------------# 26 | 27 | function shell() { 28 | case "$1" in 29 | "cd") builtin cd "$2" ;; 30 | "du") du ;; 31 | "ls") ls ;; 32 | esac 33 | } 34 | 35 | # rust replacements for default commands 36 | #----------------------------------------# 37 | 38 | alias du="dust" 39 | alias ls="eza" 40 | alias tree="eza -T" 41 | 42 | # navigation 43 | #------------# 44 | 45 | # Easier navigation 46 | alias ~="cd ~" 47 | alias ..="cd .." 48 | alias ...="cd ../.." 49 | alias ....="cd ../../.." 50 | alias .....="cd ../../../.." 51 | # `cd` | List directory contents with cd 52 | function cd() { builtin cd "$@" && ls; } 53 | # `mkcd` | Create a new directory and enter it 54 | function mkcd() { mkdir -p "$@" && cd "$_"; } 55 | # `mkdir` | Make directories recursively (ex. `my/tree` will make both folders) 56 | alias mkdir="mkdir -p" 57 | -------------------------------------------------------------------------------- /dotfiles/.commands/clean: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function clean() { 4 | case "$1" in 5 | 6 | # `clean apps` | Remove unwanted apps that restore themselves after updates 7 | "apps") 8 | echo 'Removing unwanted apps…'; 9 | sudo rm -rf /Applications/Google\ Docs.app 10 | sudo rm -rf /Applications/Google\ Sheets.app 11 | sudo rm -rf /Applications/Google\ Slides.app 12 | rm -rf ~/Google\ Drive 13 | ;; 14 | 15 | # `clean cache` | Remove cache files 16 | "cache") echo 'Removing cache…'; rm -rf .cache ;; 17 | 18 | # `clean clipboard` | Empty clipboard 19 | "clipboard") echo 'Emptying clipboard…'; pbcopy < /dev/null ;; 20 | 21 | # `clean logs` | Remove Apple's system logs to improve shell startup speed 22 | "logs") echo 'Removing logs…'; sudo rm -rfv /private/var/log/asl/*.asl ;; 23 | 24 | # `clean ssh` | Dedupe ssh known hosts 25 | "ssh") 26 | echo 'Deduping SSH known hosts…' 27 | cat ~//dotfiles/.ssh/known_hosts | uniq > ~//dotfiles/.ssh/known_hosts2; mv ~//dotfiles/.ssh/known_hosts2 ~//dotfiles/.ssh/known_hosts # add "| sort" to list in abc order 28 | ;; 29 | 30 | # `clean` | Run all the clean commands 31 | "") 32 | clean apps 33 | clean cache 34 | clean clipboard 35 | clean logs 36 | clean ssh 37 | ;; 38 | 39 | esac 40 | } 41 | 42 | complete -W "apps cache clipboard logs ssh" clean 43 | 44 | function fix() { 45 | case "$1" in 46 | 47 | # `fix audio` | When audio isn't working 48 | "audio") echo "sudo pkill coreaudiod" ;; 49 | 50 | # `fix app /Applications/name.app` | When an app tells you "This app is damaged and can't be opened. You should move it to the trash." 51 | "app") xattr -rc $2 ;; 52 | 53 | esac 54 | } 55 | 56 | complete -W "audio app" fix 57 | -------------------------------------------------------------------------------- /dotfiles/.commands/dock: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function dock() { 4 | case "$1" in 5 | "add") 6 | shift 1 7 | # `dock add "Terminal"` | Add an application to the macOS Dock 8 | app_name="${1}" 9 | launchservices_path="/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister" 10 | app_path=$(${launchservices_path} -dump | grep -o "/.*${app_name}.app" | grep -v -E "Backups|Caches|TimeMachine|Temporary|/Volumes/${app_name}" | uniq | sort | head -n1) 11 | if open -Ra "${app_path}"; then 12 | echo "$app_path added to the Dock." 13 | defaults write com.apple.dock persistent-apps -array-add "tile-datafile-data_CFURLString${app_path}_CFURLStringType0" 14 | else 15 | echo "ERROR: $1 not found." 1>&2 16 | fi 17 | ;; 18 | # `dock add:spacer` | Adds an empty space to macOS Dock 19 | "add:spacer") defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="small-spacer-tile";}' ;; 20 | # `dock clear` | Removes all persistent icons from macOS Dock 21 | "clear") defaults write com.apple.dock persistent-apps -array ;; 22 | # `dock reset` | Reset macOS Dock to default settings 23 | "reset") defaults write com.apple.dock; killall Dock ;; 24 | esac 25 | } 26 | 27 | complete -W "add add:spacer clear reset" dock 28 | -------------------------------------------------------------------------------- /dotfiles/.commands/download: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # `download` or `dl` 4 | function download() { 5 | if [ -z $3 ]; then params="$1"; else params="$1 $2"; fi 6 | case "$params" in 7 | # `download links ./x.txt` | Download a list of links from a file 8 | "links") wget -r --no-remove-listing -i ;; 9 | 10 | # `download music https://www.youtube.com/watch?v=id` | Download music 11 | "music") shift 1; yt-dlp --extract-audio --audio-format mp3 -l "$1" ;; 12 | 13 | # `download video https://www.youtube.com/watch?v=id` | Get mp4 with the best video and audio 14 | "video") shift 1; yt-dlp -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4' $1 ;; 15 | 16 | # `download video range https://www.youtube.com/watch?v=id 00:15:00 00:45:00` 17 | "video range") shift 2 18 | # variables 19 | vurl=$1 20 | startTime=$2 21 | endTime=$3 22 | title="${4:-video}" 23 | duration=$(($(local t1sec=$(local hh=${startTime%%:*}; local rest=${startTime#*:}; local mm=${rest%%:*}; local ss=${rest#*:}; printf "%s" $(bc <<< "$hh * 60 * 60 + $mm * 60 + $ss")); local t2sec=$(local hh=${endTime%%:*}; local rest=${endTime#*:}; local mm=${rest%%:*}; local ss=${rest#*:}; printf "%s" $(bc <<< "$hh * 60 * 60 + $mm * 60 + $ss")); printf "%s" $(bc <<< "$t2sec - $t1sec"))/60)) # duration in seconds 24 | # start 25 | range=( 26 | ffmpeg 27 | # URL 28 | # input file url 29 | -i $(yt-dlp -f 22 --get-url $vurl) 30 | # Start Time 31 | # Seeks in this input file to position. 32 | # Note that in most formats it is not possible to seek exactly, so ffmpeg will seek to the closest seek point before position. When transcoding and -accurate_seek is enabled (the default), this extra segment between the seek point and position will be decoded and discarded. When doing stream copy or when -noaccurate_seek is used, it will be preserved. 33 | -ss $startTime 34 | # Duration 35 | # Limit the duration of data read from the input file. 36 | -t $duration 37 | # Frames Per Second 38 | # Set frame rate (Hz value, fraction or abbreviation). 39 | -r 30 40 | # Constant Rate Factor 41 | # The range of the CRF scale is 0–51, where 0 is lossless, 23 is the default, and 51 is worst quality possible. 42 | # A lower value generally leads to higher quality, and a subjectively sane range is 17–28. Consider 17 or 18 to be visually lossless or nearly so; it should look the same or nearly the same as the input but it isn't technically lossless. 43 | -crf 15.0 44 | # Video Codec 45 | -vcodec libx264 46 | # Audio Codec 47 | -acodec aac 48 | # Overwrite output files. (-y for yes, -n for no) 49 | -n 50 | # Output Dir 51 | $title.mp4 52 | ) 53 | "${range[@]}" 54 | ;; 55 | 56 | # `download video thumbnail https://www.youtube.com/watch?v=id 00:15:00 00:45:00` 57 | "video thumbnail") shift 2; yt-dlp --skip-download --write-thumbnail $1 ;; 58 | 59 | # `download https://google.com` 60 | "") wget ;; 61 | esac 62 | } 63 | 64 | alias dl="download" 65 | 66 | complete -W "links music video 'video range' 'video thumbnail'" download dl 67 | 68 | alias mget="download music" 69 | alias vget="download video" 70 | complete mget vget 71 | -------------------------------------------------------------------------------- /dotfiles/.commands/finder: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # todo: add `diskonaut` somewhere here 4 | 5 | # `quicklook x` or `ql x` | Open with macOS Quicklook Preview 6 | function quicklook() { qlmanage -p "$*" >& /dev/null; } 7 | alias ql="quicklook" 8 | complete quicklook ql 9 | 10 | # `finder` or `f` 11 | function finder() { 12 | case "$1" in 13 | 14 | # `finder` | Open the current folder in Finder 15 | "") open -a Finder ./ ;; 16 | 17 | # View 18 | #------# 19 | # `finder list` | List files in the current folder 20 | "list") ls ;; 21 | # `finder tree` | Display a subdirectory tree 22 | "tree") tree ;; 23 | # `finder count` | Count the files in the current folder 24 | "count") ls | wc -l | sed 's/ //g' ;; 25 | 26 | # Get Info 27 | #----------# 28 | # `finder size x` | Get the size of a file 29 | "size") shift 1; if [ dust ]; then dust --depth 0 $1; else du -sh $1; fi ;; 30 | # `file dimensions x` | Get dimensions of an image or video 31 | "dimensions") shift 1 32 | # if video 33 | if [[ -z $(ffprobe -v quiet -select_streams v:0 -show_entries stream=codec_name -print_format csv=p=0 "$file") ]]; then 34 | ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 $1 35 | # not video 36 | else 37 | identify -ping -format '%w\x%h\n' $@ 38 | fi 39 | ;; 40 | # `file metadata x` or `meta x` | Get metadata 41 | "metadata") shift 1; exiftool $1 ;; 42 | 43 | # Actions 44 | #---------# 45 | # `finder new x` | Make a folder 46 | "new") shift 1; mkdir "$1" ;; 47 | # `finder remove x` | Remove a file 48 | "remove") shift 1; rm -rf "$1" ;; 49 | # `remove:empty` | Remove empty directories in current directory 50 | "remove:empty") shift 1; find . -type f -name ".DS_Store" -print -delete; find . -type d -empty -print -delete ;; 51 | # `rename:lower` | Make all files in folder lowercase 52 | "rename:lower") shift 1; for f in *; do mv "$f" "$f.tmp"; mv "$f.tmp" "`echo $f | tr "[:upper:]" "[:lower:]"`"; done ;; 53 | # `file show x` | Show a symlink without hiding the destination or show a file 54 | "show") shift 1; if [ -h "$1" ]; then chflags -h nohidden "$1"; else chflags nohidden "$1"; fi ;; 55 | # `file hide x` | Hide a symlink without hiding the destination or hide a file 56 | "hide") shift 1; if [ -h "$1" ]; then chflags -h hidden "$1"; else chflags hidden "$1"; fi ;; 57 | # `file lock x` | Lock a file 58 | "lock") shift 1; chflags uchg "$1" ;; 59 | # `file unlock x` | Unlock a file 60 | "unlock") shift 1; chflags nouchg "$1" ;; 61 | # `finder show:all x` | Show file and subfiles 62 | "show:all") shift 1; chflags -R nohidden "$1" ;; 63 | # `finder hide:all x` | Hide file and subfiles 64 | "hide:all") shift 1; chflags -R hidden "$1" ;; 65 | # `finder lock:all x` | Lock file and subfiles 66 | "lock:all") shift 1; chflags -R uchg "$1" ;; 67 | # `finder unlock:all x` | Unlock file and subfiles 68 | "unlock:all") shift 1; chflags -R nouchg "$1" ;; 69 | # `finder zero x` | Replace file with a 0 byte file 70 | "zero") shift 1; rm -rf "$1" && touch "$1" && chflags hidden "$1" ;; 71 | esac 72 | } 73 | 74 | alias f="finder" 75 | alias fz="f zero" 76 | alias meta="f metadata" 77 | alias show="f show" 78 | alias hide="f hide" 79 | alias lock="f lock" 80 | alias unlock="f unlock" 81 | 82 | complete -W "list tree count size dimensions metadata new remove remove:empty rename:lower show hide lock unlock show:all hide:all lock:all unlock:all zero" finder f 83 | 84 | # `extract file.zip` | Extract most known archives with one command 85 | function extract() { 86 | if [ -f $1 ]; then 87 | case $1 in 88 | *.tar.bz2) tar xvjf $1 ;; 89 | *.tar.gz) tar xvzf $1 ;; 90 | *.tar.xz) tar xvJf $1 ;; 91 | *.lzma) unlzma $1 ;; 92 | *.bz2) bunzip2 $1 ;; 93 | *.rar) unrar x -ad $1 ;; 94 | *.gz) gunzip $1 ;; 95 | *.tar) tar xvf $1 ;; 96 | *.tbz2) tar xvjf $1 ;; 97 | *.tgz) tar xvzf $1 ;; 98 | *.zip) unzip $1 ;; 99 | *.Z) uncompress $1 ;; 100 | *.7z) 7z x $1 ;; 101 | *.xz) unxz $1 ;; 102 | *.exe) cabextract $1 ;; 103 | *) echo "extract: '$1' - unknown archive method" ;; 104 | esac 105 | else 106 | echo "$1 - file does not exist" 107 | fi 108 | } 109 | 110 | complete extract 111 | 112 | # `compress folder` | Compress a folder using zip or 7zip 113 | function compress() { 114 | if [ ! -z $2 ] && [ -d $2 ]; then 115 | case "$1" in 116 | # `compress dmg ~/src Name` 117 | "dmg") hdiutil create -fs APFS -srcfolder "$1" -volname "$2" "$2.dmg" ;; 118 | # `compress zip folder` 119 | "zip") shift 1; zip -r "$1".zip "$1" ;; 120 | # `compress 7zip folder` or `compress 7z folder` 121 | "7zip" | "7z") shift 1; 7z a "$1" "$1"/* ;; 122 | esac 123 | else 124 | # `compress folder` 125 | zip -r "$1".zip "$1" 126 | fi 127 | } 128 | 129 | complete compress 130 | 131 | # `codecs` | Return video and audio codecs 132 | function codecs() { ffprobe "$1" 2>&1 >/dev/null |grep Stream.*Video | sed -e 's/.*Video: //' -e 's/[, ].*//'; ffprobe "$1" 2>&1 >/dev/null |grep Stream.*Audio | sed -e 's/.*Audio: //' -e 's/[, ].*//'; } 133 | complete codecs 134 | 135 | # `mergepdf -o output.pdf input{1,2,3}.pdf` | Merge PDF files, preserving hyperlinks 136 | alias mergepdf='gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=_merged.pdf' 137 | complete mergepdf 138 | -------------------------------------------------------------------------------- /dotfiles/.commands/firefox: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function firefox() { 4 | case "$1" in 5 | # `firefox screenshot ~/x url 1280,720` | Take a screenshot 6 | "screenshot") /Applications/Firefox.app/Contents/MacOS/firefox -screenshot $2 $3 --window-size=$4 ;; 7 | esac 8 | } 9 | 10 | complete -W "screenshot" firefox 11 | -------------------------------------------------------------------------------- /dotfiles/.commands/images: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function image() { 4 | case "$1" in 5 | # Image Resize Parameters: size (width in pixels, height is automatic), file, outputdir 6 | # `image resize 300 "x.jpg" out` | Optimal settings for resizing an image 7 | "resize") shift 1; mogrify -path $3 -resize $1 -quality 85 -density 72 $2 ;; 8 | esac 9 | } 10 | 11 | function images() { 12 | case "$1" in 13 | # Images Resize Parameters: size (width in pixels, height is automatic), outputdir 14 | # `images resize 300 out` | Resize in batch form 15 | # crush 300 out 16 | "resize") shift 1; for f in "$(pwd)/*" ; do image resize $1 "${f}" $2/; done ;; 17 | esac 18 | } 19 | 20 | complete -W "resize" image images 21 | -------------------------------------------------------------------------------- /dotfiles/.commands/mac: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function mac() { 4 | case "$1" in 5 | 6 | #==============================================================================# 7 | # system preferences and apple menu 8 | #==============================================================================# 9 | 10 | # `mac info` | Get info about this Mac 11 | "info") fastfetch ;; 12 | 13 | # `mac uptime` 14 | "uptime") uptime ;; 15 | 16 | # `mac screensaver` | Start screen saver 17 | "screensaver") open -a ScreenSaverEngine ;; 18 | 19 | # `mac display:off` 20 | "display:off") pmset displaysleepnow ;; 21 | 22 | # `mac sleep` 23 | "sleep") pmset sleepnow ;; 24 | 25 | # `mac restart` 26 | "restart") osascript -e 'tell app "loginwindow" to «event aevtrrst»' ;; 27 | 28 | # `mac shutdown` 29 | "shutdown") osascript -e 'tell app "loginwindow" to «event aevtrsdn»' ;; 30 | 31 | # `mac eject:all` 32 | "eject:all") osascript -e 'tell application "Finder" to eject (every disk whose ejectable is true)' ;; 33 | 34 | # `mac battery` 35 | "battery") pmset -g batt ;; 36 | 37 | #==============================================================================# 38 | # spotlight 39 | #==============================================================================# 40 | 41 | # `mac spotlight` | Check spotlight status 42 | "spotlight") mdutil -s / ;; 43 | 44 | # `mac spotlight:on` | Turn on Spotlight indexing 45 | "spotlight:on") 46 | echo "$(text green)Spotlight Enabled$(text)" 47 | sudo mdutil -a -i on 48 | ;; 49 | 50 | # `mac spotlight:off` | Turn off Spotlight indexing 51 | "spotlight:off") 52 | echo "$(text green)Spotlight Disabled$(text)" 53 | sudo mdutil -a -i off 54 | ;; 55 | 56 | # `mac spotlight:reindex` | Reindex Spotlight from scratch 57 | "spotlight:reindex") 58 | # Load new settings before rebuilding the index 59 | killall mds > /dev/null 2>&1 60 | # Make sure indexing is enabled for the main volume 61 | sudo mdutil -i on / > /dev/null 62 | # Rebuild the index from scratch 63 | sudo mdutil -E / > /dev/null 64 | ;; 65 | 66 | #==============================================================================# 67 | # wifi 68 | #==============================================================================# 69 | 70 | # `mac wifi` 71 | "wifi") 72 | echo "$(text green)Wi-Fi:$(text)" 73 | /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I 74 | ;; 75 | 76 | # `mac wifi:scan` | List WiFi networks in range. 77 | "wifi:scan") /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s ;; 78 | 79 | # `mac wifi:on` 80 | "wifi:on") 81 | echo "$(text green)WiFi Enabled$(text)" 82 | networksetup -setairportpower ${_W_DEVICE} on 83 | ;; 84 | 85 | # `mac wifi:off` 86 | "wifi:off") 87 | echo "$(text green)WiFi Disabled$(text)" 88 | networksetup -setairportpower ${_W_DEVICE} off 89 | ;; 90 | 91 | #==============================================================================# 92 | # gatekeeper 93 | #==============================================================================# 94 | 95 | # `mac gatekeeper` | Get status of Gatekeeper 96 | "gatekeeper") 97 | echo "$(text green)Gatekeeper Status:$(text)" 98 | sudo spctl --status 99 | ;; 100 | 101 | # `mac gatekeeper:on` | Enable Gatekeeper 102 | "gatekeeper:on") 103 | echo "$(text green)Gatekeeper Enabled$(text)" 104 | sudo spctl --master-enable 105 | ;; 106 | 107 | # `mac gatekeeper:off` | Disable Gatekeeper 108 | "gatekeeper:off") 109 | echo "$(text green)Gatekeeper Disabled$(text)" 110 | sudo spctl --master-disable 111 | ;; 112 | 113 | # `mac gatekeeper:reset` | Reset Gatekeeper Rules 114 | "gatekeeper:reset") sudo spctl --reset-default ;; 115 | 116 | esac 117 | } 118 | 119 | alias ="mac" 120 | 121 | complete -W "info uptime screensaver display:off sleep restart shutdown eject:all battery bluetooth bluetooth:on bluetooth:off spotlight spotlight:on spotlight:off spotlight:reindex wifi wifi:scan wifi:on wifi:off gatekeeper gatekeeper:on gatekeeper:off gatekeeper:reset" mac  122 | -------------------------------------------------------------------------------- /dotfiles/.commands/network: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function network() { 4 | case "$1" in 5 | # `network ip` | Get your public IP address or input a domain to get its IP 6 | "ip") if [ -z $2 ]; then dig +short myip.opendns.com @resolver1.opendns.com; else shift 1; dig $1 +short; fi ;; 7 | # `network ip:local` | Get your local IP address 8 | "ip:local") ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}' ;; 9 | # `ipv6:off` | Turn off IPv6 10 | "ipv6:off") networksetup -setv6off "$2" ;; 11 | # `ipv6:on` | Turn on IPv6 12 | "ipv6:on") networksetup -setv6automatic "$2" ;; 13 | esac 14 | } 15 | 16 | alias flush="network dns:flush" 17 | 18 | complete -W "ip ip:local ipv6:off ipv6:on dns:flush speed" network 19 | -------------------------------------------------------------------------------- /dotfiles/.commands/ringtone: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # `ringtone song.mp3` | Convert mp3 to m4r and change the length to 30 seconds 4 | function ringtone() { ffmpeg -i "$1" -t 30 -c:a aac -f ipod -b:a 96k "$(basename "$1" .mp3).m4r"; } 5 | complete -f -X '!*.mp3' ringtone 6 | -------------------------------------------------------------------------------- /dotfiles/.commands/template: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # function new_command() { 4 | # case "$1" in 5 | # "sub1") echo 'Hello world!' ;; 6 | # "sub2") echo 'Hello sky!' ;; 7 | # esac 8 | # } 9 | # 10 | # complete -W "sub1 sub2" new_command 11 | -------------------------------------------------------------------------------- /dotfiles/.commands/text: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function text() { 4 | case $1 in 5 | # `text x` | Formatting 6 | "black") echo -e "\033[0;30m" ;; 7 | "red") echo -e "\033[0;31m" ;; 8 | "green") echo -e "\033[0;32m" ;; 9 | "yellow") echo -e "\033[0;33m" ;; 10 | "blue") echo -e "\033[0;34m" ;; 11 | "magenta") echo -e "\033[0;35m" ;; 12 | "cyan") echo -e "\033[0;36m" ;; 13 | "white") echo -e "\033[0;37m" ;; 14 | "bold") tput bold ;; 15 | "underline") tput smul ;; 16 | "invert") tput rev ;; 17 | # `text encode:base64 "x"` | Encoding 18 | "encode:base64") shift 1; echo -n "$@" | openssl base64 ;; 19 | "encode:binary") shift 1; echo -n "$@" | perl -lpe '$_=unpack"B*"' ;; 20 | "encode:hex") shift 1; echo -n "$@" | xxd -p ;; 21 | "encode:md5") shift 1; echo -n "$@" | openssl md5 ;; 22 | "encode:sha1") shift 1; echo -n "$@" | openssl sha1 ;; 23 | # `text decode:base64 "x"` | Decoding 24 | "decode:base64") shift 1; echo -n "$@" | base64 --decode ;; 25 | "decode:binary") shift 1; echo -n "$@" | perl -lpe '$_=pack"B*",$_' ;; 26 | "decode:hex") shift 1; echo -n "0x$@" | xxd -r ;; 27 | # Reset 28 | "") echo -e "\033[0m" ;; 29 | esac 30 | } 31 | 32 | complete -W "black red green yellow blue magenta cyan white bold underline invert encode:base64 encode:binary encode:hex encode:md5 encode:sha1 decode:base64 decode:binary decode:hex" text 33 | -------------------------------------------------------------------------------- /dotfiles/.commands/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function update() { 4 | case "$1" in 5 | 6 | # `update apps` 7 | "apps") 8 | echo 'Updating App Store apps…' 9 | mas upgrade 10 | echo 'Updating Homebrew packages…' 11 | brew upgrade; brew missing; brew cleanup 12 | shell cd ~//apps/ 13 | brew bundle dump --force --describe 14 | npm update -g 15 | shell cd - 16 | ;; 17 | 18 | # `update dock` 19 | "dock") echo 'Updating Dock…'; ~//dock ;; 20 | 21 | # `update dotfiles` 22 | "dotfiles") echo 'Updating dotfiles…'; ~//dotfiles/install.sh ;; 23 | 24 | # `update hosts` 25 | "hosts") echo 'Updating hosts…'; sudo chmod -R o+rwx /etc/hosts; cp ~//hosts /etc/hosts ;; 26 | 27 | # `update links` 28 | "links") 29 | echo 'Updating links…' 30 | ln -sfn /Applications ~/Applications/Mac 31 | ;; 32 | # `update preferences` 33 | "preferences") echo 'Updating Preferences…'; ~//preferences ;; 34 | 35 | # `update` | Run all of the updates 36 | "") 37 | echo $(text invert) 38 | echo ' ' 39 | echo ' : ' 40 | echo ' ' 41 | echo $(text) 42 | echo 'Requesting root access…' 43 | root 44 | shell cd ~ 45 | echo $(text invert) 46 | echo ' ' 47 | echo ' : ' 48 | echo ' ' 49 | echo $(text) 50 | update dotfiles 51 | update links 52 | update hosts 53 | echo $(text invert) 54 | echo ' ' 55 | echo ' : ' 56 | echo ' ' 57 | echo $(text) 58 | update apps 59 | shell cd ~ 60 | echo $(text invert) 61 | echo ' ' 62 | echo ' : ' 63 | echo ' ' 64 | echo $(text) 65 | clean 66 | # Back up Sublime Text settings' 67 | cp ~/Library/Application\ Support/Sublime\ Text*/Packages/User/Package\ Control.sublime-settings ~//resources/ 68 | cp ~/Library/Application\ Support/Sublime\ Text*/Packages/User/Preferences.sublime-settings ~//resources/ 69 | echo $(text invert) 70 | echo ' ' 71 | echo ' : ' 72 | echo ' ' 73 | echo $(text) 74 | softwareupdate -i -a 75 | update preferences 76 | ;; 77 | 78 | esac 79 | } 80 | 81 | complete -W "apps dock dotfiles hosts links preferences" update 82 | -------------------------------------------------------------------------------- /dotfiles/.commands/video: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function video() { 4 | case "$1" in 5 | 6 | # Video Encode Parameters: filetype, video codec, audio codec 7 | # `video encode` | remux all videos in the current directory to mp4 8 | # `video encode mkv libx265 aac` | encode all videos to mkv with x265 and aac codecs 9 | "encode") shift 1 10 | filetype=${1:-mp4} 11 | video_codec=${2:-copy} 12 | audio_codec=${3:-copy} 13 | output=${4:-output} 14 | mkdir -p $output 15 | for i in *.mkv *.webm *.flv *.vob *.ogg *.ogv *.drc *gifv *.mng *.avi *.mov *.qt *.wmv *.yuv *.rm *.rmvb *.asf *.amv *.mp4 *.m4v *.mp *.m?v *.svi *.3gp *.flv *.f4v; do 16 | if [ -f "$i" ]; then 17 | if [ $1 = true ] 18 | then 19 | ffmpeg -i "$i" -map 0 -c:v $video_codec -c:a $audio_codec -y -nostats -loglevel 0 "./$output/${i/${i##*.}/$filetype}" 20 | else 21 | ffmpeg -i "$i" -c copy "./$output/${i/${i##*.}/$filetype}" 22 | fi 23 | fi 24 | done 25 | ;; 26 | 27 | # `video merge ts mkv` | Combine all ts files in the current dir into one mkv file 28 | "merge") shift 1; ffmpeg -f concat -safe 0 -i <(find "$PWD" -maxdepth 1 -type f \( -iname "*.mkv" -o -iname "*.webm" -o -iname "*.flv" -o -iname "*.vob" -o -iname "*.ogg" -o -iname "*.ogv" -o -iname "*.drc" -o -iname "*.gifv" -o -iname "*.mng" -o -iname "*.avi" -o -iname "*.mov" -o -iname "*.qt" -o -iname "*.wmv" -o -iname "*.yuv" -o -iname "*.rm" -o -iname "*.rmvb" -o -iname "*.asf" -o -iname "*.amv" -o -iname "*.mp4" -o -iname "*.m4v" -o -iname "*.mp" -o -iname "*.m?v" -o -iname "*.svi" -o -iname "*.3gp" -o -iname "*.flv" -o -iname "*.f4v" -o -iname "*.ts" \) -print0 | sort -zV | while IFS= read -r -d '' f; do echo "file '$f'"; done) -c copy "output.${2}" ;; 29 | 30 | # `video scale 1920 1080 input.mp4 output.mp4` | Scale video 31 | "scale") shift 1; ffmpeg -i $3 -vf scale=$1:$2 $4 ;; 32 | 33 | # `video split 00:10:00 input.mp4` | Split video into multiple parts (00:10:00 means 10 minutes each) 34 | "split") shift 1; ffmpeg -i $2 -c copy -map 0 -segment_time $1 -f segment -reset_timestamps 1 $2%03d.mp4 ;; 35 | 36 | esac 37 | } 38 | 39 | complete -W "encode merge scale split" video 40 | -------------------------------------------------------------------------------- /dotfiles/.curlrc: -------------------------------------------------------------------------------- 1 | # Wait 60 seconds before timing out. 2 | connect-timeout = 60 3 | -------------------------------------------------------------------------------- /dotfiles/.exports: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Make Sublime Text the default editor 4 | export EDITOR="subl -w"; 5 | export VISUAL="vi"; 6 | 7 | # Increase Bash history size. Allow 32⁴ entries; the default is 500 8 | # export HISTSIZE='1048576'; 9 | # Disable Bash history 10 | export HISTSIZE='0'; 11 | export HISTFILESIZE="${HISTSIZE}"; 12 | # Omit duplicates and commands that begin with a space from history. 13 | export HISTCONTROL='ignoreboth'; 14 | 15 | # Specify your defaults in this environment variable 16 | export HOMEBREW_CASK_OPTS="--appdir=/Applications" # --caskroom=/usr/local/Caskroom" 17 | 18 | # Prefer US English and use UTF-8 19 | export LANG='en_US.UTF-8'; 20 | export LC_ALL='en_US.UTF-8'; 21 | 22 | # Avoid issues with `gpg` as installed via Homebrew 23 | # https://stackoverflow.com/a/42265848/96656 24 | export GPG_TTY=$(tty); 25 | 26 | # Hide the "default interactive shell is now zsh" warning on macOS 27 | export BASH_SILENCE_DEPRECATION_WARNING=1; 28 | -------------------------------------------------------------------------------- /dotfiles/.gitconfig: -------------------------------------------------------------------------------- 1 | [alias] 2 | # Switch to a branch, creating it if necessary 3 | go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" 4 | 5 | # Show verbose output about tags, branches or remotes 6 | tags = tag -l 7 | branches = branch --all 8 | remotes = remote --verbose 9 | 10 | # List contributors with number of commits 11 | contributors = shortlog --summary --numbered 12 | 13 | # Go back x numbers of commits 14 | undo = "!f() { git reset --soft HEAD~$1; }; f" 15 | 16 | # Remove all commits 17 | squash = update-ref -d HEAD 18 | 19 | # Fix HEAD branch issue 20 | fix = "!f() { git commit -s -m "Publish." && git push --force; }; f" 21 | 22 | # Force push 23 | publish = push --force 24 | 25 | # Show the user email for the current repository 26 | whoami = config user.email 27 | 28 | [apply] 29 | # Detect whitespace errors when applying a patch 30 | whitespace = fix 31 | 32 | [branch] 33 | # Show most recently changed branches first 34 | sort = -committerdate 35 | 36 | [color] 37 | diff = auto 38 | status = auto 39 | [color "branch"] 40 | current = cyan 41 | local = green 42 | remote = red 43 | [color "diff"] 44 | meta = yellow 45 | frag = magenta 46 | old = red 47 | new = green 48 | [color "status"] 49 | added = cyan 50 | branch = cyan 51 | changed = magenta 52 | deleted = red 53 | untracked = yellow 54 | 55 | [commit] 56 | gpgsign = true 57 | 58 | [core] 59 | editor = subl 60 | # Use custom `.gitignore` and `.gitattributes` 61 | excludesfile = ~/.gitignore 62 | attributesfile = ~/.gitattributes 63 | 64 | # Make `git rebase` safer on macOS 65 | # More info: 66 | trustctime = false 67 | 68 | # Prevent showing files whose names contain non-ASCII symbols as unversioned. 69 | # http://michael-kuehnel.de/git/2014/11/21/git-mac-osx-and-german-umlaute.html 70 | precomposeunicode = false 71 | 72 | # Speed up commands involving untracked files such as `git status` 73 | # https://git-scm.com/docs/git-update-index#_untracked_cache 74 | untrackedCache = true 75 | 76 | [credential] 77 | helper = store 78 | 79 | [diff] 80 | # Detect copies as well as renames 81 | renames = copies 82 | 83 | # Enable an experimental heuristic that shifts the hunk boundary in an 84 | # attempt to make the resulting patch easier to read 85 | compactionHeuristic = true 86 | indentHeuristic = true 87 | 88 | [gpg] 89 | # Path to GPG 90 | program = /opt/homebrew/bin/gpg 91 | 92 | [help] 93 | # Automatically correct and execute mistyped commands 94 | autocorrect = 1 95 | 96 | [merge] 97 | # Include summaries of merged commits in newly created merge commit messages 98 | log = true 99 | autostash = true 100 | 101 | [push] 102 | # https://git-scm.com/docs/git-config#git-config-pushdefault 103 | default = simple 104 | 105 | [user] 106 | name = $GIT_AUTHOR_NAME 107 | email = $GIT_AUTHOR_EMAIL 108 | signingkey = $GIT_SIGNING_KEY 109 | -------------------------------------------------------------------------------- /dotfiles/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Python files 2 | *.pyc 3 | 4 | # Folder view configuration files 5 | .DS_Store 6 | Desktop.ini 7 | 8 | # Thumbnail cache files 9 | ._* 10 | Thumbs.db 11 | 12 | # Files that might appear on external disks 13 | .Spotlight-V100 14 | .Trashes 15 | 16 | # Other Dotfiles 17 | .noindex 18 | 19 | # Dev folders 20 | node_modules/ 21 | -------------------------------------------------------------------------------- /dotfiles/.gnupg/gpg-agent.conf: -------------------------------------------------------------------------------- 1 | # Enables GPG to find gpg-agent 2 | use-standard-socket 3 | 4 | # Connects gpg-agent to the macOS keychain via the brew-installed 5 | # pinentry program from GPGtools. This is the macOS 'magic sauce', 6 | # allowing the gpg key's passphrase to be stored in the login 7 | # keychain, enabling automatic key signing. 8 | pinentry-program /opt/homebrew/bin/pinentry-mac 9 | 10 | # Enables SSH to use GPG 11 | enable-ssh-support 12 | -------------------------------------------------------------------------------- /dotfiles/.gnupg/gpg.conf: -------------------------------------------------------------------------------- 1 | # Uncomment within config (or add this line) 2 | use-agent 3 | 4 | # This silences the "you need a passphrase" message once the passphrase handling is all set. 5 | # Use at your own discretion - may prevent the successful interactive use of some operations. 6 | # It is working fine for my use cases though. 7 | batch 8 | 9 | no-tty 10 | -------------------------------------------------------------------------------- /dotfiles/.hushlogin: -------------------------------------------------------------------------------- 1 | # The mere presence of this file in the home directory disables the system 2 | # copyright notice, the date and time of the last login, the message of the 3 | # day as well as other information that may otherwise appear on login. 4 | # See `man login`. 5 | -------------------------------------------------------------------------------- /dotfiles/.inputrc: -------------------------------------------------------------------------------- 1 | # Make Tab autocomplete regardless of filename case 2 | set completion-ignore-case on 3 | 4 | # List all matches in case multiple possible completions are possible 5 | set show-all-if-ambiguous on 6 | 7 | # Immediately add a trailing slash when autocompleting symlinks to directories 8 | set mark-symlinked-directories on 9 | 10 | # Do not autocomplete hidden files unless the pattern explicitly begins with a dot 11 | set match-hidden-files off 12 | 13 | # Show all autocomplete results at once 14 | set page-completions off 15 | 16 | # Show extra file information when completing, like `ls -F` does 17 | set visible-stats on 18 | 19 | # Be more intelligent when autocompleting by also looking at the text after 20 | # the cursor. For example, when the current line is "cd ~/src/mozil", and 21 | # the cursor is on the "z", pressing Tab will not autocomplete it to "cd 22 | # ~/src/mozillail", but to "cd ~/src/mozilla". (This is supported by the 23 | # Readline used by Bash 4.) 24 | set skip-completed-text on 25 | 26 | # Allow UTF-8 input and output, instead of showing stuff like $'\0123\0456' 27 | set input-meta on 28 | set output-meta on 29 | set convert-meta off 30 | -------------------------------------------------------------------------------- /dotfiles/.path: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # brew 4 | export PATH="/opt/homebrew/bin:$PATH" 5 | export PATH="/opt/homebrew/sbin:$PATH" 6 | export PATH="~/.cargo/bin:$PATH" 7 | export PATH="~/.local/bin:$PATH" 8 | -------------------------------------------------------------------------------- /dotfiles/.profile: -------------------------------------------------------------------------------- 1 | # Load the shell dotfiles, and then some: 2 | # ~/.path can be used to extend `$PATH`. 3 | # ~/.commands is where you can put custom aliases and functions. 4 | # ~/.private can be used for other settings you don't want to commit. 5 | for file in ~/.{path,exports,commands/*,private}; do 6 | [ -r "$file" ] && [ -f "$file" ] && source "$file" 7 | done; 8 | unset file; 9 | 10 | # Set prompt to `starship` 11 | eval "$(starship init bash)" 12 | 13 | # Add `zoxide` to shell 14 | eval "$(zoxide init bash)" 15 | 16 | # Enable some Bash 4 features when possible: 17 | # * `autocd`, e.g. `**/qux` will enter `./foo/bar/baz/qux` 18 | # * Recursive globbing, e.g. `echo **/*.txt` 19 | for option in autocd globstar; do 20 | shopt -s "$option" 2> /dev/null; 21 | done; 22 | 23 | # Case-insensitive globbing (used in pathname expansion) 24 | shopt -s nocaseglob; 25 | 26 | # Autocorrect typos in path names when using `cd` 27 | shopt -s cdspell; 28 | 29 | # Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards 30 | [ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2- | tr ' ' '\n')" scp sftp ssh; 31 | 32 | # Add tab completion for `defaults read|write NSGlobalDomain` 33 | # You could just use `-g` instead, but I like being explicit 34 | complete -W "NSGlobalDomain" defaults; 35 | 36 | # Append to the Bash history file, rather than overwriting it 37 | shopt -s histappend; 38 | 39 | # Add timestamps to history 40 | # Date/time formatting: http://www.acehints.com/2012/07/histtimeformat-how-to-see-linux.html 41 | HISTTIMEFORMAT="| %F | %r | " -------------------------------------------------------------------------------- /dotfiles/.ssh/config_example: -------------------------------------------------------------------------------- 1 | # Rename this file to `config`. 2 | # Replace the following example with your own. 3 | # With this example, `ssh server` would connect you to 4 | # `me@mysite.web` using the public key, `example_rsa.pub` 5 | 6 | Host server 7 | User me 8 | HostName mysite.web 9 | PreferredAuthentications publickey 10 | IdentityFile ~/.ssh/example_rsa 11 | -------------------------------------------------------------------------------- /dotfiles/.ssh/example_rsa: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | KEY 3 | -----END RSA PRIVATE KEY----- 4 | -------------------------------------------------------------------------------- /dotfiles/.ssh/example_rsa.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa KEY user@host 2 | -------------------------------------------------------------------------------- /dotfiles/.stow-local-ignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barryanders/mac-primer/244f61bc023162bc29ca44ae47993105451327e0/dotfiles/.stow-local-ignore -------------------------------------------------------------------------------- /dotfiles/.wgetrc: -------------------------------------------------------------------------------- 1 | # Use the server-provided last modification date, if available 2 | timestamping = on 3 | 4 | # Do not go up in the directory structure when downloading recursively 5 | no_parent = on 6 | 7 | # Wait 60 seconds before timing out. This applies to all timeouts: DNS, connect and read. (The default read timeout is 15 minutes!) 8 | timeout = 60 9 | 10 | # Retry a few times when a download fails, but don't overdo it. (The default is 20!) 11 | tries = 3 12 | 13 | # Retry even when the connection was refused 14 | retry_connrefused = on 15 | 16 | # Use the last component of a redirection URL for the local file name 17 | trust_server_names = on 18 | 19 | # Follow FTP links from HTML documents by default 20 | follow_ftp = on 21 | 22 | # Add a `.html` extension to `text/html` or `application/xhtml+xml` files that lack one, or a `.css` extension to `text/css` files that lack one 23 | adjust_extension = on 24 | 25 | # Use UTF-8 as the default system encoding 26 | # Disabled as it makes `wget` builds that don't support this feature unusable. 27 | # Does anyone know how to conditionally configure a wget setting? 28 | # http://unix.stackexchange.com/q/34730/6040 29 | # local_encoding = UTF-8 30 | 31 | # Ignore `robots.txt` and `` 32 | robots = off 33 | 34 | # Print the HTTP and FTP server responses 35 | server_response = on -------------------------------------------------------------------------------- /dotfiles/install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo 'Installing dotfiles…' 4 | 5 | cd "$(dirname "${BASH_SOURCE}")" 6 | 7 | function install:dotfiles() { 8 | for file in .; do 9 | run=( 10 | stow --target ~ # Target directory 11 | --ignore .DS_Store # Ignore files ending in this Perl regex 12 | --ignore install.sh # Ignore files ending in this Perl regex 13 | --restow # prunes dead links 14 | --verbose 1 $file # Options 0-5 15 | # --simulate # use for testing 16 | ) 17 | "${run[@]}" 18 | done 19 | } 20 | 21 | install:dotfiles 22 | -------------------------------------------------------------------------------- /hosts: -------------------------------------------------------------------------------- 1 | # Keep track of your hosts here. 2 | # Default Start 3 | 127.0.0.1 localhost 4 | 255.255.255.255 broadcasthost 5 | # Default End 6 | -------------------------------------------------------------------------------- /preferences: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Go further with customizing your preferences | https://macos-defaults.com/ 3 | mac=$(test "`uname`" == "Darwin") 4 | 5 | if [[ mac ]]; then 6 | # Close System Preferences to prevent it from overriding the changes below 7 | osascript -e 'tell application "System Preferences" to quit' 8 | 9 | # Persistant sudo 10 | sudo -v; while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 11 | 12 | #==============================================================================# 13 | # System 14 | #==============================================================================# 15 | 16 | # Set computer name (as done via System Preferences → Sharing) 17 | COMPUTER_NAME="Holmes" 18 | LOWER_NAME=$(echo "$COMPUTER_NAME" | tr '[:upper:]' '[:lower:]') 19 | sudo scutil --set ComputerName $COMPUTER_NAME 20 | sudo scutil --set HostName "$LOWER_NAME" 21 | sudo scutil --set LocalHostName "$LOWER_NAME" 22 | sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$LOWER_NAME" 23 | 24 | # Require password immediately after sleep or screen saver begins 25 | defaults write com.apple.screensaver askForPassword -int 1 26 | defaults write com.apple.screensaver askForPasswordDelay -int 0 27 | 28 | # Save screenshots to the Downloads folder 29 | defaults write com.apple.screencapture location -string "${HOME}/Downloads" 30 | 31 | # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) 32 | defaults write com.apple.screencapture type -string "png" 33 | 34 | # Disable shadow in screenshots 35 | defaults write com.apple.screencapture disable-shadow -bool true 36 | 37 | #==============================================================================# 38 | # Windows 39 | #==============================================================================# 40 | 41 | # Always show scrollbars `WhenScrolling`, `Automatic` and `Always` 42 | defaults write NSGlobalDomain AppleShowScrollBars -string "Always" 43 | 44 | # Minimize windows into their application's icon? 45 | defaults write com.apple.dock minimize-to-application -bool true 46 | 47 | # Expand the following file Info panes 48 | defaults write com.apple.finder FXInfoPanesExpanded -dict \ 49 | General -bool true \ 50 | MetaData -bool true \ 51 | OpenWith -bool true \ 52 | Privileges -bool true 53 | 54 | # Expand save panel by default? 55 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true 56 | 57 | # Expand print panel by default? 58 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true 59 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true 60 | 61 | # Enable the "Are you sure you want to open this application?" dialog? 62 | defaults write com.apple.LaunchServices LSQuarantine -bool false 63 | 64 | # Disable the crash reporter 65 | defaults write com.apple.CrashReporter DialogType -string "none" 66 | 67 | # Prevent the prompt to use new hard drives as a backup volume? 68 | defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true 69 | 70 | #==============================================================================# 71 | # Logs 72 | #==============================================================================# 73 | 74 | # Logs: Disable download history 75 | ln -sf /dev/null ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2 76 | 77 | # Logs: Disable recent places list, the integer is the number of items stored in the list 78 | defaults write -g NSNavRecentPlacesLimit -int 0 79 | 80 | #==============================================================================# 81 | # Finder 82 | #==============================================================================# 83 | 84 | # Finder: Set Home as the default location for new windows 85 | defaults write com.apple.finder NewWindowTarget -string "PfLo" 86 | defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Stuff" 87 | 88 | # Finder: Show all filename extensions? 89 | defaults write NSGlobalDomain AppleShowAllExtensions -bool true 90 | 91 | # Finder: Show hidden files by default? 92 | defaults write com.apple.finder AppleShowAllFiles -bool false 93 | 94 | # Finder: Show recent tags? 95 | defaults write com.apple.finder ShowRecentTags -bool false 96 | 97 | # Finder: Show toolbar, sidebar, status bar, and path bar? 98 | defaults write com.apple.finder ShowToolbar -bool true 99 | defaults write com.apple.finder ShowSidebar -bool true 100 | defaults write com.apple.finder ShowStatusBar -bool true 101 | defaults write com.apple.finder ShowPathbar -bool true 102 | 103 | # Finder: Show icons for hard drives, servers, and removable media on the desktop? 104 | defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool false 105 | defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false 106 | defaults write com.apple.finder ShowMountedServersOnDesktop -bool false 107 | defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool false 108 | 109 | # Finder: Show the /Volumes folder 110 | sudo chflags nohidden /Volumes 111 | 112 | # Finder: Keep folders on top when sorting by name? 113 | defaults write com.apple.finder _FXSortFoldersFirst -bool true 114 | 115 | # Finder: When performing a search, search the current folder by default 116 | defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" 117 | 118 | # Finder: Enable the warning when changing a file extension? 119 | defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false 120 | 121 | # Finder: Enable the warning before emptying the Trash? 122 | defaults write com.apple.finder WarnOnEmptyTrash -bool true 123 | 124 | # Finder: Disable the eject notification? 125 | defaults write /Library/Preferences/SystemConfiguration/com.apple.DiskArbitration.diskarbitrationd.plist DADisableEjectNotification -bool true && sudo pkill diskarbitrationd 126 | 127 | # Finder: Avoid creating .DS_Store files on network and USB volumes? 128 | defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true 129 | defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true 130 | 131 | # Finder: Automatically open a new window when a volume is mounted? 132 | defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool false 133 | defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool false 134 | defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool false 135 | 136 | #==============================================================================# 137 | # Dock, Mission Control, Spaces, & Hot Corners 138 | #==============================================================================# 139 | 140 | # Dock: Disable dock icon bouncing? 141 | defaults write com.apple.dock no-bouncing -bool true 142 | 143 | # Dock: Automatically hide and show? 144 | defaults write com.apple.dock autohide -bool true 145 | 146 | # Dock: Remove the auto-hiding Dock delay 147 | defaults write com.apple.dock autohide-delay -float 0 148 | 149 | # Dock: Speed up the animation when hiding/showing the Dock, 0 to disable 150 | defaults write com.apple.dock autohide-time-modifier -float 0.5 151 | 152 | # Dock: Make Dock icons of hidden applications translucent? 153 | defaults write com.apple.dock showhidden -bool false 154 | 155 | # Hot corners 156 | # Top left screen corner → Disabled 157 | defaults write com.apple.dock wvous-tl-corner -int 0 158 | defaults write com.apple.dock wvous-tl-modifier -int 0 159 | # Top right screen corner → Disabled 160 | defaults write com.apple.dock wvous-tr-corner -int 0 161 | defaults write com.apple.dock wvous-tr-modifier -int 0 162 | # Bottom left screen corner → Disabled 163 | defaults write com.apple.dock wvous-bl-corner -int 0 164 | defaults write com.apple.dock wvous-bl-modifier -int 0 165 | # Bottom right screen corner → Disabled 166 | defaults write com.apple.dock wvous-br-corner -int 0 167 | defaults write com.apple.dock wvous-br-modifier -int 0 168 | 169 | #==============================================================================# 170 | # Safari 171 | #==============================================================================# 172 | 173 | # Safari: Show the full URL in the address bar? 174 | defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true 175 | 176 | # Safari: Set the home page to `about:blank` for faster loading 177 | defaults write com.apple.Safari HomePage -string "about:blank" 178 | 179 | # Safari: Automatically open safe files after downloading? 180 | defaults write com.apple.Safari AutoOpenSafeDownloads -bool false 181 | 182 | # Safari: Hit the backspace key to go to the previous page in history? 183 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool false 184 | 185 | #==============================================================================# 186 | # Terminal 187 | #==============================================================================# 188 | 189 | # Terminal: only use UTF-8 in Terminal.app 190 | defaults write com.apple.terminal StringEncodings -array 4 191 | 192 | # Customize the theme in Terminal.app 193 | osascript < /dev/null; done 292 | 293 | else 294 | echo "Error! Preferences were not applied. You don't appear to be using macOS." 295 | fi 296 | -------------------------------------------------------------------------------- /primer.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ~//dotfiles/.commands/text 4 | 5 | echo $(text invert) 6 | echo ' ' 7 | echo ' : ' 8 | echo ' ' 9 | echo $(text) 10 | echo 'Requesting root access…' 11 | sudo -v; while true; do sudo -n true; sleep 60; kill -0 \"$$\" || exit; done 2>/dev/null & 12 | echo $(text invert) 13 | echo ' ' 14 | echo ' : ' 15 | echo ' ' 16 | echo $(text) 17 | chmod +x ~//apps/install.sh 18 | ~//apps/install.sh 19 | echo $(text invert) 20 | echo ' ' 21 | echo ' : ' 22 | echo ' ' 23 | echo $(text) 24 | chmod +x ~//dotfiles/install.sh 25 | ~//dotfiles/install.sh 26 | echo $(text invert) 27 | echo ' ' 28 | echo ' : ' 29 | echo ' ' 30 | echo $(text) 31 | ~//dock 32 | ~//preferences 33 | -------------------------------------------------------------------------------- /resources/Dracula.terminal: -------------------------------------------------------------------------------- 1 | 2 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w0ODxARElVO 99 | U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzTxAcMSAwLjMzMzMzMzM0MzMgMC4zMzMzMzMz 100 | NDMzABABgALSFBUWF1okY2xhc3NuYW1lWCRjbGFzc2VzV05TQ29sb3KiFhhYTlNPYmpl 101 | Y3QIERokKTI3SUxRU1ddZGp3fp2foaaxusLFAAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAA 102 | AAAAAAAAAM4= 103 | 104 | ANSIYellowColor 105 | 106 | YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS 107 | AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO 108 | U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzTxAmMC45NDUwOTgwNDI1IDAuOTgwMzkyMTU4 109 | IDAuNTQ5MDE5NjM0NwAQAYAC0hQVFhdaJGNsYXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9y 110 | ohYYWE5TT2JqZWN0CBEaJCkyN0lMUVNXXWRqd36nqauwu8TMzwAAAAAAAAEBAAAAAAAA 111 | ABkAAAAAAAAAAAAAAAAAAADY 112 | 113 | BackgroundColor 114 | 115 | YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS 116 | AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO 117 | U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzTxAnMC4xMTc2NTgxMTU5IDAuMTIyMTUyNzIz 118 | NCAwLjE1OTc3ODM3MTUAEAGAAtIUFRYXWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xv 119 | cqIWGFhOU09iamVjdAgRGiQpMjdJTFFTV11kand+qKqssbzFzdAAAAAAAAABAQAAAAAA 120 | AAAZAAAAAAAAAAAAAAAAAAAA2Q== 121 | 122 | Font 123 | 124 | YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS 125 | AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGkCwwVFlUkbnVsbNQNDg8QERIT 126 | FFZOU1NpemVYTlNmRmxhZ3NWTlNOYW1lViRjbGFzcyNAKAAAAAAAABAQgAKAA1ZNb25h 127 | Y2/SFxgZGlokY2xhc3NuYW1lWCRjbGFzc2VzVk5TRm9udKIZG1hOU09iamVjdAgRGiQp 128 | MjdJTFFTWF5nbnd+hY6QkpSboKu0u74AAAAAAAABAQAAAAAAAAAcAAAAAAAAAAAAAAAA 129 | AAAAxw== 130 | 131 | ProfileCurrentVersion 132 | 2.0699999999999998 133 | SelectionColor 134 | 135 | YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS 136 | AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO 137 | U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzTxAnMC4yNjY2NjY2ODA2IDAuMjc4NDMxMzg1 138 | OCAwLjM1Mjk0MTE4NTIAEAGAAtIUFRYXWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xv 139 | cqIWGFhOU09iamVjdAgRGiQpMjdJTFFTV11kand+qKqssbzFzdAAAAAAAAABAQAAAAAA 140 | AAAZAAAAAAAAAAAAAAAAAAAA2Q== 141 | 142 | ShouldLimitScrollback 143 | 0 144 | ShowActiveProcessArgumentsInTabTitle 145 | 146 | ShowActiveProcessArgumentsInTitle 147 | 148 | ShowActiveProcessInTabTitle 149 | 150 | ShowActiveProcessInTitle 151 | 152 | ShowActivityIndicatorInTab 153 | 154 | ShowCommandKeyInTitle 155 | 156 | ShowComponentsWhenTabHasCustomTitle 157 | 158 | ShowDimensionsInTitle 159 | 160 | ShowRepresentedURLInTabTitle 161 | 162 | ShowRepresentedURLInTitle 163 | 164 | ShowRepresentedURLPathInTabTitle 165 | 166 | ShowRepresentedURLPathInTitle 167 | 168 | ShowShellCommandInTitle 169 | 170 | ShowTTYNameInTabTitle 171 | 172 | ShowTTYNameInTitle 173 | 174 | ShowWindowSettingsNameInTitle 175 | 176 | TextBoldColor 177 | 178 | YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS 179 | AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO 180 | U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzTxAcMC40MTk2MDc4NDMxIDAuNDU4ODIzNTI5 181 | NCAxABABgALSFBUWF1okY2xhc3NuYW1lWCRjbGFzc2VzV05TQ29sb3KiFhhYTlNPYmpl 182 | Y3QIERokKTI3SUxRU1ddZGp3fp2foaaxusLFAAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAA 183 | AAAAAAAAAM4= 184 | 185 | TextColor 186 | 187 | YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS 188 | AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO 189 | U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzRjEgMSAxABABgALSFBUWF1okY2xhc3NuYW1l 190 | WCRjbGFzc2VzV05TQ29sb3KiFhhYTlNPYmplY3QIERokKTI3SUxRU1ddZGp3foWHiY6Z 191 | oqqtAAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAALY= 192 | 193 | WindowTitle 194 | barry@holmes 195 | columnCount 196 | 101 197 | name 198 | Dracula 199 | rowCount 200 | 35 201 | type 202 | Window Settings 203 | 204 | 205 | -------------------------------------------------------------------------------- /resources/Package Control.sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | "bootstrapped": true, 3 | "in_process_packages": 4 | [ 5 | "Package Control", 6 | ], 7 | "installed_packages": 8 | [ 9 | "Increment Decrement", 10 | "Increment Selection", 11 | "Package Control", 12 | "PowerShell", 13 | "Theme - Monokai Pro", 14 | ], 15 | } 16 | -------------------------------------------------------------------------------- /resources/Preferences.sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | "bold_folder_labels": false, 3 | "color_scheme": "Monokai.sublime-color-scheme", 4 | "default_encoding": "UTF-8", 5 | "default_line_ending": "unix", 6 | "detect_indentation": true, 7 | "ensure_newline_at_eof_on_save": true, 8 | "fade_fold_buttons": false, 9 | "folder_exclude_patterns": 10 | [ 11 | ".git", 12 | "node_modules" 13 | ], 14 | "font_size": 16, 15 | "highlight_line": true, 16 | "hot_exit": true, 17 | "line_padding_bottom": 2, 18 | "line_padding_top": 2, 19 | "monokai_pro_label_font_size": 14, 20 | "monokai_pro_sidebar_font_size": 14, 21 | "monokai_pro_small_scrollbar": true, 22 | "remember_open_files": true, 23 | "show_encoding": true, 24 | "show_line_endings": true, 25 | "tab_size": 2, 26 | "theme": "Monokai Classic.sublime-theme", 27 | "translate_tabs_to_spaces": true, 28 | "trim_automatic_white_space": true, 29 | "trim_trailing_white_space_on_save": true, 30 | "word_wrap": false, 31 | "ignored_packages": 32 | [ 33 | "Package Control", 34 | "Vintage", 35 | ], 36 | "index_files": false, 37 | } 38 | -------------------------------------------------------------------------------- /resources/Sublime Text Steps.txt: -------------------------------------------------------------------------------- 1 | Use CMD + Shift + P for the following actions: 2 | 3 | 1. Install package control 4 | 2. Monokai Pro: select theme -> Monokai Classic 5 | 3. Select Color Scheme -> Monokai 6 | --------------------------------------------------------------------------------