├── .aliases ├── .curl-format.txt ├── .curlrc ├── .editorconfig ├── .exports ├── .functions ├── .gitconfig ├── .gitignore ├── .inputrc ├── .jshintrc ├── .osx ├── .paths ├── .screenrc ├── .spacevim ├── .wgetrc ├── .zshenv ├── .zshrc ├── LICENSE ├── README.md ├── apps.sh ├── bin ├── bash ├── batcharge.py ├── check ├── dev.sh ├── git-delete-merge-branches ├── httpcompression ├── node ├── online-check.sh ├── ssl-cert.sh ├── subl ├── toggle ├── view-md └── wifi-password ├── bootstrap.sh ├── init ├── Preferences.sublime-settings ├── Solarized Dark xterm-256color.terminal ├── Solarized Dark.itermcolors ├── com.googlecode.iterm2.plist └── remy.zsh-theme ├── npm.sh └── pony.ansi /.aliases: -------------------------------------------------------------------------------- 1 | hash gc &>/dev/null; 2 | if [ $? -eq 0 ]; then 3 | #unalias gc # lets me us graphcool's shortcut instead of git 4 | fi 5 | 6 | # Easier navigation: .., ... 7 | alias ..="cd .." 8 | alias ...="cd ../.." 9 | alias ....="cd ../../.." 10 | alias .....="cd ../../../.." 11 | alias -- -="cd -" 12 | 13 | alias clone='nocorrect clone ' 14 | alias cordova='nocorrect cordova ' 15 | 16 | # git 17 | alias gs="git status -s" 18 | alias gp="git push origin HEAD" 19 | alias gpt="git push origin HEAD && git push --tags" 20 | alias wip="git commit -m'WIP' . && git push origin HEAD" 21 | 22 | alias m="memcached -d -m 24 -p 11211" 23 | 24 | # pebble 25 | alias pebble-both="pebble build ; pebble install --emulator basalt; pebble install --emulator aplite" 26 | 27 | alias dockit=". '/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh'" 28 | 29 | alias hosts='sudo vi /etc/hosts' 30 | 31 | # flush Directory Service cache 32 | alias flush="dscacheutil -flushcache" 33 | 34 | # Detect which `ls` flavor is in use 35 | if ls --color > /dev/null 2>&1; then # GNU `ls` 36 | colorflag="--color" 37 | else # OS X `ls` 38 | colorflag="-G" 39 | fi 40 | 41 | # List all files colorized in long format 42 | alias l="ls -l ${colorflag}" 43 | 44 | # List all files colorized in long format, including dot files 45 | alias la="ls -la ${colorflag}" 46 | 47 | # List only directories 48 | alias lsd='ls -l | grep "^d"' 49 | 50 | # Always use color output for `ls` 51 | if [[ "$OSTYPE" =~ ^darwin ]]; then 52 | # alias ls="command ls -G" 53 | else 54 | alias ls="command ls --color" 55 | export LS_COLORS='no=00:fi=00:di=01;34: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:' 56 | fi 57 | 58 | function ls(){ 59 | command ls -G "$@" | node /Users/remy/dev/nice-ls index.js 60 | } 61 | 62 | 63 | # `cat` with beautiful colors. requires Pygments installed. 64 | # sudo easy_install Pygments 65 | alias c='pygmentize -O style=monokai -f console256 -g' 66 | 67 | # GIT STUFF 68 | 69 | # Undo a `git push` 70 | alias undopush="git push -f origin HEAD^:master" 71 | # IP addresses 72 | alias ip="dig +short myip.opendns.com @resolver1.opendns.com" 73 | alias localip="ipconfig getifaddr en0" 74 | 75 | alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'" 76 | 77 | # Enhanced WHOIS lookups 78 | alias whois="whois -h whois-servers.net" 79 | 80 | # View HTTP traffic 81 | alias sniff="sudo ngrep -W byline -d 'en0' -t '^(GET|POST) ' 'tcp and port 80'" 82 | alias httpdump="sudo tcpdump -i en0 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\"" 83 | 84 | # Trim new lines and copy to clipboard 85 | alias trimcopy="tr -d '\n' | pbcopy" 86 | 87 | # Recursively delete `.DS_Store` files 88 | alias cleanup="find . -name '*.DS_Store' -type f -ls -delete" 89 | 90 | # Empty the Trash on all mounted volumes and the main HDD 91 | alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; rm -rfv ~/.Trash" 92 | 93 | # Hide/show all desktop icons (useful when presenting) 94 | alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder" 95 | alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder" 96 | 97 | # One of @janmoesen’s ProTip™s 98 | for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do 99 | alias "$method"="lwp-request -m '$method'" 100 | done 101 | 102 | ### So begins Remy's cusomisations 103 | 104 | alias paste=pbpaste 105 | # it's useful to see what I've just copied, ie. `cat foo | copy` 106 | # alias copy='pbcopy; pbpaste' 107 | 108 | alias path='echo -e ${PATH//:/\\n}' 109 | 110 | # resume wget by default 111 | alias wget='wget -c' 112 | 113 | # hide progress (silent) on curl by default 114 | alias curl='curl -S -s' 115 | 116 | # get raw url from a gist (expected use: curl | gitraw) 117 | alias gitraw="grep Location | tr -d '\r\n' | awk '{print \$2\"/raw\"}'" 118 | 119 | # show hidden files 120 | alias hidden='ls -trFa | grep "^\."' 121 | 122 | # reload the shell 123 | alias reload='exec $SHELL -l' 124 | 125 | # snyk helpers (pipe-to command) 126 | alias snyk-post='gzip | curl -s -X POST https://snyk.io/api/vuln/npm -H "content-type: application/json" -H "content-encoding: gzip" --data-binary @-' 127 | 128 | alias pip=pip3 129 | 130 | # shows the top 5 processes by cpu usage 131 | alias top5="ps auxww | sort -rnk 3,3 | head -n 5 | awk '{ print \$3\" (\" \$2 \") \" \$11 }'" 132 | alias killtop="ps auxww | sort -rnk 3,3 | head -n 1 | awk '{ print \$2 }' | xargs kill -9" 133 | 134 | # data science helpers 135 | alias csv-header="csvcut -n" 136 | 137 | alias dokku='$HOME/.dokku/contrib/dokku_client.sh' 138 | 139 | alias help="tldr" 140 | alias ping='prettyping --nolegend' 141 | 142 | alias vi='vim' # so that I never get into the whole vim != vi!!! 143 | alias cat='bat' 144 | alias nnn='nnn -S' 145 | 146 | alias perf='curl --compress -w "@$HOME/.curl-format.txt" -o /dev/null -s ' 147 | 148 | alias chrome="/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary" 149 | 150 | alias preview="fzf --preview 'bat --color \"always\" {}'" 151 | 152 | alias htop="sudo htop" # attempt to fix a high sierra bug 153 | alias du="ncdu --color dark -rr -x --exclude .git --exclude node_modules" 154 | alias grep="rg" 155 | 156 | alias light="base16_atelier-forest-light" 157 | alias dark="base16_onedark" 158 | 159 | alias clear='[ $[$RANDOM % 10] = 0 ] && timeout 3 cmatrix; clear || clear' 160 | 161 | alias backup="NODE_ENV=production envy -- mongodump --uri \\\$MONGO_URL" 162 | alias r="command r" 163 | alias tx=tmuxinator 164 | alias now=vercel 165 | -------------------------------------------------------------------------------- /.curl-format.txt: -------------------------------------------------------------------------------- 1 | namelookup: %{time_namelookup}\n 2 | connect: %{time_connect}\n 3 | appconnect: %{time_appconnect}\n 4 | pretransfer: %{time_pretransfer}\n 5 | redirect: %{time_redirect}\n 6 | starttransfer: %{time_starttransfer}\n 7 | ----------\n 8 | total: %{time_total}\n 9 | -------------------------------------------------------------------------------- /.curlrc: -------------------------------------------------------------------------------- 1 | # Disguise as IE 9 on Windows 7. 2 | user-agent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" 3 | 4 | # When following a redirect, automatically set the previous URL as referer. 5 | referer = ";auto" 6 | 7 | # Wait 60 seconds before timing out. 8 | connect-timeout = 60 9 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | end_of_line = lf 7 | insert_final_newline = true 8 | trim_trailing_whitespace = true 9 | -------------------------------------------------------------------------------- /.exports: -------------------------------------------------------------------------------- 1 | # lolcommits stuff :-\ 2 | export LOLCOMMITS_DELAY=1 3 | 4 | ## 5 | ## gotta tune that bash_history… 6 | ## 7 | 8 | # timestamps for later analysis. www.debian-administration.org/users/rossen/weblog/1 9 | export HISTTIMEFORMAT='%F %T ' 10 | 11 | # keep history up to date, across sessions, in realtime 12 | # http://unix.stackexchange.com/a/48113 13 | # - ignorespace = don't save lines that begin with a space 14 | # - ignoredups = don't save duplicate lines 15 | # - erasedups = erase across sessions 16 | export HISTCONTROL=ignorespace:ignoredups:erasedups 17 | export HISTSIZE=100000 # big big history (default is 500) 18 | export HISTFILESIZE=$HISTSIZE # big big history 19 | which shopt > /dev/null && shopt -s histappend # append to history, don't overwrite it 20 | 21 | # Save and reload the history after each command finishes 22 | export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" 23 | 24 | # ^ the only downside with this is [up] on the readline will go over all history not just this bash session. 25 | 26 | export EDITOR="vim" 27 | 28 | # autoload nvm 29 | export NVM_AUTO_USE=true 30 | export NVM_LAZY_LOAD=true 31 | 32 | export GOPATH=$HOME/go 33 | 34 | export FIGNORE="*-lock.json" 35 | 36 | export IDF_PATH=~/esp/esp-idf 37 | 38 | # android dev (for the single android app I wrote!) 39 | export ANDROID_HOME=$HOME/Library/Android/sdk 40 | export PATH=$PATH:$ANDROID_HOME/tools 41 | export PATH=$PATH:$ANDROID_HOME/tools/bin 42 | export PATH=$PATH:$ANDROID_HOME/platform-tools 43 | export PATH=$PATH:$ANDROID_HOME/emulator 44 | 45 | export TTC_SAY_BOX=parrot #$HOME/dotfiles/pony.ansi 46 | export TTC_REPOS=$HOME/Sites,$HOME/Sites/deck,$HOME/Sites/worldwideweb 47 | export TTC_WEATHER='BN1 7HT' 48 | export TTC_APIKEYS=false 49 | 50 | export VAGRANT_DISABLE_VBOXSYMLINKCREAT=1 51 | export PUBSUB_EMULATOR_HOST=localhost:8085 52 | 53 | 54 | ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#666666" 55 | -------------------------------------------------------------------------------- /.functions: -------------------------------------------------------------------------------- 1 | # hex/binary diff 2 | function xdiff() { 3 | /usr/bin/diff -u <(xxd -c 32 $1) <(xxd -c 32 $2) | diff-so-fancy 4 | } 5 | 6 | # trims the output a single line 7 | function single() { 8 | while read line; do echo -e "\033[1000D\033[K\033[32m$$\033[0m $line" | tr -d '\r\n'; done 9 | } 10 | 11 | function zeit() { 12 | now alias ls | grep $1 | awk '{ gsub(/.now.sh$/,"",$1); gsub(/-/, "/", $1); print "https://zeit.co/rem/"$1"/logs?all=1" }' | xargs open 13 | } 14 | 15 | function sha256sum() { openssl sha256 "$@" | awk '{print $2}'; } 16 | 17 | 18 | # Create a new directory and enter it 19 | function mkd() { 20 | mkdir -p "$@" && cd "$_"; 21 | } 22 | 23 | # List all files, long format, colorized, permissions in octal 24 | function la(){ 25 | ls -l "$@" | awk ' 26 | { 27 | k=0; 28 | for (i=0;i<=8;i++) 29 | k+=((substr($1,i+2,1)~/[rwx]/) *2^(8-i)); 30 | if (k) 31 | printf("%0o ",k); 32 | printf(" %9s %3s %2s %5s %6s %s %s %s\n", $3, $6, $7, $8, $5, $9,$10, $11); 33 | }' 34 | } 35 | 36 | # generate a gist either from the clipboard, or by piping, or using a filename 37 | # and then immediately get a git.io url for it and stick it on the clipboard 38 | hash gist &>/dev/null; 39 | if [ $? -eq 0 ]; then 40 | function gist() { 41 | if [ -t 0 ]; then 42 | if ((! $# )); then 43 | command gist -Pcop -f paste.md | gitio 44 | else 45 | command gist -cop $@ | gitio 46 | fi 47 | else 48 | command gist -cop $@ < /dev/stdin | gitio 49 | fi 50 | } 51 | fi 52 | 53 | # Create a git.io short URL 54 | function gitio() { 55 | local url="$1"; 56 | if [ -t 0 ]; then # read from arg 57 | if [ -z "${url}" ]; then 58 | echo "Usage: \`gitio url\`"; 59 | return 1; 60 | fi; 61 | else 62 | read url 63 | fi 64 | 65 | curl -s -L -q -i https://git.io/ -F "url=${url}" | grep Location | cut -d' ' -f2 | pbcopy; # generate url and copy to clipboard 66 | pbpaste # echo 67 | } 68 | 69 | function put() { 70 | if [ -t 0 ]; then 71 | curl -i -X POST -H "authorization: token $JSONBIN_API_KEY" https://jsonbin.org/clip -F "f=@$@" > /dev/null 72 | else 73 | curl -X POST -H "authorization: token $JSONBIN_API_KEY" https://jsonbin.org/clip -F "f=@-" < /dev/stdin > /dev/null 74 | fi 75 | } 76 | 77 | function get() { 78 | curl -X GET -H "authorization: token $JSONBIN_API_KEY" https://jsonbin.org/clip 79 | } 80 | 81 | # lets my run `less http...` using lynx to scrape the text content 82 | hash lynx &>/dev/null; 83 | if [ $? -eq 0 ]; then 84 | function less() { 85 | local url="$_" 86 | if [[ $url == http* ]]; then 87 | local args=( "$@" ) 88 | unset "args[${#args[@]}]" # Removes last element -- also see: help unset 89 | lynx --dump $url | command less $args 90 | else 91 | command less $@ 92 | fi 93 | } 94 | fi 95 | 96 | # Change working directory to the top-most Finder window location 97 | function cdf() { # short for `cdfinder` 98 | cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')"; 99 | } 100 | 101 | # Create a .tar.gz archive, using `zopfli`, `pigz` or `gzip` for compression 102 | function targz() { 103 | local tmpFile="${@%/}.tar"; 104 | tar -cvf "${tmpFile}" --exclude=".DS_Store" "${@}" || return 1; 105 | 106 | size=$( 107 | stat -f"%z" "${tmpFile}" 2> /dev/null; # OS X `stat` 108 | stat -c"%s" "${tmpFile}" 2> /dev/null # GNU `stat` 109 | ); 110 | 111 | local cmd=""; 112 | if (( size < 52428800 )) && hash zopfli 2> /dev/null; then 113 | # the .tar file is smaller than 50 MB and Zopfli is available; use it 114 | cmd="zopfli"; 115 | else 116 | if hash pigz 2> /dev/null; then 117 | cmd="pigz"; 118 | else 119 | cmd="gzip"; 120 | fi; 121 | fi; 122 | 123 | echo "Compressing .tar using \`${cmd}\`…"; 124 | "${cmd}" -v "${tmpFile}" || return 1; 125 | [ -f "${tmpFile}" ] && rm "${tmpFile}"; 126 | echo "${tmpFile}.gz created successfully."; 127 | } 128 | 129 | # Determine size of a file or total size of a directory 130 | function fs() { 131 | if du -b /dev/null > /dev/null 2>&1; then 132 | local arg=-sbh; 133 | else 134 | local arg=-sh; 135 | fi 136 | if [[ -n "$@" ]]; then 137 | du $arg -- "$@"; 138 | else 139 | du $arg .[^.]* *; 140 | fi; 141 | } 142 | 143 | # Use Git’s colored diff when available 144 | hash git &>/dev/null; 145 | if [ $? -eq 0 ]; then 146 | function diff() { 147 | git diff --no-index --color-words "$@" | diff-so-fancy; 148 | } 149 | fi; 150 | 151 | # Create a data URL from a file 152 | function dataurl() { 153 | local mimeType=$(file -b --mime-type "$1"); 154 | if [[ $mimeType == text/* ]]; then 155 | mimeType="${mimeType};charset=utf-8"; 156 | fi 157 | echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')"; 158 | } 159 | 160 | # Start an HTTP server from a directory, optionally specifying the port 161 | function server() { 162 | local port="${1:-8000}"; 163 | sleep 1 && open "http://localhost:${port}/" & 164 | # Set the default Content-Type to `text/plain` instead of `application/octet-stream` 165 | # And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files) 166 | python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"; 167 | } 168 | 169 | # Start a PHP server from a directory, optionally specifying the port 170 | # (Requires PHP 5.4.0+.) 171 | function phpserver() { 172 | local port="${1:-4000}"; 173 | local ip=$(ipconfig getifaddr en0); 174 | sleep 1 && open "http://${ip}:${port}/" & 175 | php -S "${ip}:${port}"; 176 | } 177 | 178 | # Compare original and gzipped file size 179 | function gz() { 180 | local origsize=$(wc -c < "$1"); 181 | local gzipsize=$(gzip -c "$1" | wc -c); 182 | local ratio=$(echo "$gzipsize * 100 / $origsize" | bc -l); 183 | printf "orig: %d bytes\n" "$origsize"; 184 | printf "gzip: %d bytes (%2.2f%%)\n" "$gzipsize" "$ratio"; 185 | } 186 | 187 | # Run `dig` and display the most useful info 188 | function digga() { 189 | dig +nocmd "$1" any +multiline +noall +answer; 190 | } 191 | 192 | # UTF-8-encode a string of Unicode symbols 193 | function escape() { 194 | printf "\\\x%s" $(printf "$@" | xxd -p -c1 -u); 195 | # print a newline unless we’re piping the output to another program 196 | if [ -t 1 ]; then 197 | echo ""; # newline 198 | fi; 199 | } 200 | 201 | # Decode \x{ABCD}-style Unicode escape sequences 202 | function unidecode() { 203 | perl -e "binmode(STDOUT, ':utf8'); print \"$@\""; 204 | # print a newline unless we’re piping the output to another program 205 | if [ -t 1 ]; then 206 | echo ""; # newline 207 | fi; 208 | } 209 | 210 | # Get a character’s Unicode code point 211 | function codepoint() { 212 | perl -e "use utf8; print sprintf('U+%04X', ord(\"$@\"))"; 213 | # print a newline unless we’re piping the output to another program 214 | if [ -t 1 ]; then 215 | echo ""; # newline 216 | fi; 217 | } 218 | 219 | # Show all the names (CNs and SANs) listed in the SSL certificate 220 | # for a given domain 221 | function getcertnames() { 222 | if [ -z "${1}" ]; then 223 | echo "ERROR: No domain specified."; 224 | return 1; 225 | fi; 226 | 227 | local domain="${1}"; 228 | echo "Testing ${domain}…"; 229 | echo ""; # newline 230 | 231 | local tmp=$(echo -e "GET / HTTP/1.0\nEOT" \ 232 | | openssl s_client -connect "${domain}:443" -servername "${domain}" 2>&1); 233 | 234 | if [[ "${tmp}" = *"-----BEGIN CERTIFICATE-----"* ]]; then 235 | local certText=$(echo "${tmp}" \ 236 | | openssl x509 -text -certopt "no_aux, no_header, no_issuer, no_pubkey, \ 237 | no_serial, no_sigdump, no_signame, no_validity, no_version"); 238 | echo "Common Name:"; 239 | echo ""; # newline 240 | echo "${certText}" | grep "Subject:" | sed -e "s/^.*CN=//" | sed -e "s/\/emailAddress=.*//"; 241 | echo ""; # newline 242 | echo "Subject Alternative Name(s):"; 243 | echo ""; # newline 244 | echo "${certText}" | grep -A 1 "Subject Alternative Name:" \ 245 | | sed -e "2s/DNS://g" -e "s/ //g" | tr "," "\n" | tail -n +2; 246 | return 0; 247 | else 248 | echo "ERROR: Certificate not found."; 249 | return 1; 250 | fi; 251 | } 252 | 253 | # `tre` is a shorthand for `tree` with hidden files and color enabled, ignoring 254 | # the `.git` directory, listing directories first. The output gets piped into 255 | # `less` with options to preserve color and line numbers, unless the output is 256 | # small enough for one screen. 257 | function tre() { 258 | tree -aC -I '.git|.cache|.bit|.next|.vscode|node_modules|bower_components' --dirsfirst "$@" | less -FRNX; 259 | } 260 | 261 | function tap() { 262 | filename=$(basename $@) 263 | zxtap2wav -a -f 44100 -i $@ -o "$filename.wav" 264 | } 265 | 266 | function dnode() { 267 | DEBUG=* node $@ > /dev/null 268 | } 269 | 270 | base64() { 271 | if [[ -e "$1" ]]; then 272 | openssl base64 < "$1" | tr -d '\n' | copy 273 | else 274 | echo "$1" | command base64 275 | fi 276 | } 277 | 278 | gififyalt() { 279 | if [[ -n "$1" ]]; then 280 | if [[ $2 == '--good' ]]; then 281 | ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png 282 | time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif 283 | rm out-static*.png 284 | else 285 | ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif 286 | fi 287 | else 288 | echo "proper usage: gifify . You DO need to include extension." 289 | fi 290 | } 291 | 292 | # detect a local tap and use that if available, otherwise use the global 293 | # installed one (via npm i -g tap) and run it through babel 294 | hash tap &>/dev/null; 295 | if [ $? -eq 0 ]; then 296 | tap() { 297 | # get the real location of tap 298 | local TAP=$(type -p tap | awk '{ print $3 }') 299 | 300 | # if there's a local one in reach then use that instead 301 | if [ -e $PWD/node_modules/.bin/tap ]; then 302 | local TAP="$PWD/node_modules/.bin/tap" 303 | fi 304 | 305 | # check if we're node 4 or above, if we are, then assume 306 | # that it can run _some_ ES6 307 | node -v | awk -F[.v] '{print $2 }' | { read test; test $test -gt 3; } 308 | 309 | # if node.version > 3 310 | if [ $? -eq 0 ]; then 311 | $TAP $@ 312 | else 313 | # else reach for babel 314 | babel-node $TAP $@ 315 | fi 316 | } 317 | fi; 318 | 319 | function npm-downloads() { 320 | curl -s https://api.npmjs.org/downloads/point/last-week/$@ | jq .downloads 321 | } 322 | 323 | copy() { 324 | if [ -t 0 ]; then 325 | cat $@ | pbcopy 326 | else 327 | pbcopy < /dev/stdin 328 | fi 329 | } 330 | 331 | # I'm going to lose the original `split` command, but frankly, I never 332 | # use it (last I recall was 2007...) 333 | function trsplit() { 334 | tr '$@' '\n' < /dev/stdin 335 | } 336 | 337 | # grep for a specific term in the running processes 338 | function greps() { 339 | # ps auxww | grep [t]erm 340 | ps auxww | grep $(echo $1 | perl -n -e's/^(.)(.*)$/[$1]$2/; print $_') 341 | } 342 | 343 | function shrink() { 344 | # first upload and compress the filename argument 345 | local OUTPUT=$(curl https://api.tinify.com/shrink \ 346 | --user api:$TINIFY_KEY \ 347 | --data-binary @$1 348 | ) 349 | 350 | local URL=$(echo $OUTPUT | jq .output.url -r) 351 | 352 | local RESULT=$(echo $OUTPUT | jq -r '. + { compression: ((1 - .output.ratio) * 100 | floor) } | "Before: \(.input.size / 1000 | floor)Kb, after \(.output.size / 1000 | floor)Kb, saving \(.compression)%"') 353 | 354 | # then download and overwrite the file with the newly shrunk file 355 | curl -X POST $URL --user api:$TINIFY_KEY --output $1 -H 'content-type: application/json' -d'{"resize":{"method":"scale","width":1320}}' 356 | echo "\033[1m$RESULT\033[0m"; 357 | } 358 | 359 | function _shrink() { 360 | local URL=$(curl https://api.tinify.com/shrink --progress-bar --user api:$TINIFY_KEY --dump-header /dev/stdout --data-binary @$1 | awk '/Location/ { gsub(/[[:space:]]+$/, ""); printf $2 }') 361 | 362 | curl -X POST $URL --user api:$TINIFY_KEY --dump-header /dev/stdout --output $1 -H 'content-type: application/json' -d'{"resize":{"method":"scale","width":1320}}' 363 | } 364 | 365 | 366 | local ZXNEXT_IMAGE_FILE=/Applications/cspect/app/cspect-next-2gb.img 367 | 368 | function zxput() { 369 | hdfmonkey put $ZXNEXT_IMAGE_FILE "$1" "${2:-/devel}/$1" 370 | } 371 | 372 | function zxget() { 373 | hdfmonkey get $ZXNEXT_IMAGE_FILE "$1" "${2:-./$(basename $1)}" 374 | } 375 | 376 | function zxls() { 377 | hdfmonkey ls $ZXNEXT_IMAGE_FILE "${1:-/devel}" 378 | } 379 | 380 | # usage: zxrm file -- will remove file from /devel directory 381 | # usage: zxrm /foo/bar -- will remove bar from /foo directory 382 | function zxrm() { 383 | local FILENAME="$1" 384 | if [ "$FILENAME" = "$(basename "$1")" ]; then 385 | FILENAME="/devel/$1" 386 | fi 387 | echo hdfmonkey rm $ZXNEXT_IMAGE_FILE "$FILENAME" 388 | hdfmonkey rm $ZXNEXT_IMAGE_FILE "$FILENAME" 389 | } 390 | 391 | # usage: zxrmdir /somedirectory -- will remove all the files and the directory 392 | function zxrmdir() { 393 | # set -x 394 | local DIR="$1" 395 | local FILES 396 | FILES=$(zxls $DIR) 397 | if [ $? -ne 0 ] ; then 398 | echo $FILES 399 | return 1; 400 | fi 401 | 402 | echo $FILES | awk -v q='"' -v d="$DIR/" '{ $1=""; gsub(/^ /, "", $0); print d $0 }' | while read line; do 403 | zxrm $line || break 404 | done 405 | set +x 406 | } 407 | -------------------------------------------------------------------------------- /.gitconfig: -------------------------------------------------------------------------------- 1 | [alias] 2 | 3 | # View abbreviated SHA, description, and history graph of the latest 20 commits 4 | l = log --pretty=oneline -n 20 --graph --abbrev-commit 5 | 6 | # View the current working tree status using the short format 7 | s = status -s 8 | 9 | # Show the diff between the latest commit and the current state 10 | d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" 11 | 12 | # `git di $number` shows the diff between the state `$number` revisions ago and the current state 13 | di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d" 14 | 15 | # Pull in remote changes for the current repository and all its submodules 16 | p = !"git pull; git submodule foreach git pull origin master" 17 | 18 | # Clone a repository including all submodules 19 | c = clone --recursive 20 | 21 | # Commit all changes 22 | ca = !git add -A && git commit -av 23 | 24 | # Switch to a branch, creating it if necessary 25 | go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" 26 | 27 | # Show verbose output about tags, branches or remotes 28 | tags = tag -l 29 | branches = branch -a 30 | remotes = remote -v 31 | 32 | # Amend the currently staged files to the latest commit 33 | amend = commit --amend --reuse-message=HEAD 34 | 35 | # Credit an author on the latest commit 36 | credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f" 37 | 38 | # Interactive rebase with the given number of latest commits 39 | reb = "!r() { git rebase -i HEAD~$1; }; r" 40 | 41 | # Remove the old tag with this name and tag the latest commit with it. 42 | retag = "!r() { git tag -d $1 && git push origin :refs/tags/$1 && git tag $1; }; r" 43 | 44 | # Find branches containing commit 45 | fb = "!f() { git branch -a --contains $1; }; f" 46 | 47 | # Find tags containing commit 48 | ft = "!f() { git describe --always --contains $1; }; f" 49 | 50 | # Find commits by source code 51 | fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f" 52 | 53 | # Find commits by commit message 54 | fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f" 55 | 56 | # Remove branches that have already been merged with master 57 | # a.k.a. ‘delete merged’ 58 | dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" 59 | 60 | # List contributors with number of commits 61 | contributors = shortlog --summary --numbered 62 | 63 | # show the last commit and diff 64 | lastchange = log -p --follow -n 1 65 | 66 | # Merge GitHub pull request on top of the current branch or, 67 | # if a branch name is specified, on top of the specified branch 68 | mpr = "!f() { \ 69 | declare currentBranch=\"$(git symbolic-ref --short HEAD)\"; \ 70 | declare branch=\"${2:-$currentBranch}\"; \ 71 | if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \ 72 | git fetch origin refs/pull/$1/head:pr/$1 && \ 73 | git checkout -B $branch && \ 74 | git rebase $branch pr/$1 && \ 75 | git checkout -B $branch && \ 76 | git merge pr/$1 && \ 77 | git branch -D pr/$1 && \ 78 | git commit --amend -m \"$(git log -1 --pretty=%B)\n\nCloses #$1.\"; \ 79 | fi \ 80 | }; f" 81 | 82 | [apply] 83 | 84 | # Detect whitespace errors when applying a patch 85 | whitespace = fix 86 | 87 | [core] 88 | 89 | # Use custom `.gitignore` and `.gitattributes` 90 | excludesfile = ~/.gitignore 91 | attributesfile = ~/.gitattributes 92 | # pager = diff-highlight | diff-so-fancy | less -r 93 | 94 | # Treat spaces before tabs and all kinds of trailing whitespace as an error 95 | # [default] trailing-space: looks for spaces at the end of a line 96 | # [default] space-before-tab: looks for spaces before tabs at the beginning of a line 97 | whitespace = space-before-tab,-indent-with-non-tab,trailing-space 98 | 99 | # Make `git rebase` safer on OS X 100 | # More info: 101 | trustctime = false 102 | 103 | # Prevent showing files whose names contain non-ASCII symbols as unversioned. 104 | # http://michael-kuehnel.de/git/2014/11/21/git-mac-osx-and-german-umlaute.html 105 | precomposeunicode = false 106 | 107 | # don't blow up when I make a tiny typo in vim 108 | editor = vim 109 | 110 | [pager] 111 | 112 | diff = diff-so-fancy | less --tabs=1,5 -RFX 113 | show = diff-so-fancy | less --tabs=1,5 -RFX 114 | 115 | [color] 116 | 117 | # Use colors in Git commands that are capable of colored output when 118 | # outputting to the terminal. (This is the default setting in Git ≥ 1.8.4.) 119 | ui = auto 120 | 121 | [color "branch"] 122 | 123 | current = yellow reverse 124 | local = yellow 125 | remote = green 126 | 127 | [color "diff"] 128 | 129 | meta = yellow bold 130 | frag = magenta bold # line info 131 | old = red # deletions 132 | new = green # additions 133 | 134 | [color "diff-highlight"] 135 | 136 | oldNormal = red bold 137 | oldHighlight = "red bold 52" 138 | newNormal = "green bold" 139 | newHighlight = "green bold 22" 140 | 141 | [color "status"] 142 | 143 | added = yellow 144 | changed = green 145 | untracked = cyan 146 | 147 | [diff] 148 | 149 | # Detect copies as well as renames 150 | renames = copies 151 | 152 | [diff "bin"] 153 | # Use `hexdump` to diff binary files 154 | textconv = hexdump -v -C 155 | 156 | [help] 157 | 158 | # Automatically correct and execute mistyped commands 159 | autocorrect = 1 160 | 161 | [merge] 162 | 163 | # Include summaries of merged commits in newly created merge commit messages 164 | log = true 165 | 166 | [push] 167 | 168 | # Use the Git 1.x.x default to avoid errors on machines with old Git 169 | # installations. To use `simple` instead, add this to your `~/.extra` file: 170 | # `git config --global push.default simple`. See http://git.io/mMah-w. 171 | default = matching 172 | # Make `git push` push relevant annotated tags when pushing branches out. 173 | followTags = true 174 | 175 | # URL shorthands 176 | 177 | [url "git@github.com:"] 178 | 179 | insteadOf = "gh:" 180 | pushInsteadOf = "github:" 181 | pushInsteadOf = "git://github.com/" 182 | 183 | [url "git://github.com/"] 184 | 185 | insteadOf = "github:" 186 | 187 | [url "git@gist.github.com:"] 188 | 189 | insteadOf = "gst:" 190 | pushInsteadOf = "gist:" 191 | pushInsteadOf = "git://gist.github.com/" 192 | 193 | [url "git://gist.github.com/"] 194 | 195 | insteadOf = "gist:" 196 | [user] 197 | name = Remy Sharp 198 | email = remy@remysharp.com 199 | [github] 200 | name = remy 201 | user = remy 202 | -------------------------------------------------------------------------------- /.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 | # don't send config files up 17 | s3_website.yml 18 | -------------------------------------------------------------------------------- /.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 | # Use the text that has already been typed as the prefix for searching through 11 | # commands (basically more intelligent Up/Down behavior) 12 | "\e[B": history-search-forward 13 | "\e[A": history-search-backward 14 | 15 | # ctrl left, ctrl right for moving on the readline by word 16 | "\e[1;5C": forward-word 17 | "\e[1;5D": backward-word 18 | 19 | # Do not autocomplete hidden files unless the pattern explicitly begins with a dot 20 | set match-hidden-files off 21 | 22 | # Show all autocomplete results at once 23 | set page-completions off 24 | 25 | # If there are more than 200 possible completions for a word, ask to show them all 26 | set completion-query-items 200 27 | 28 | # Show extra file information when completing, like `ls -F` does 29 | set visible-stats on 30 | 31 | # Be more intelligent when autocompleting by also looking at the text after 32 | # the cursor. For example, when the current line is "cd ~/src/mozil", and 33 | # the cursor is on the "z", pressing Tab will not autocomplete it to "cd 34 | # ~/src/mozillail", but to "cd ~/src/mozilla". (This is supported by the 35 | # Readline used by Bash 4.) 36 | set skip-completed-text on 37 | 38 | # Allow UTF-8 input and output, instead of showing stuff like $'\0123\0456' 39 | set input-meta on 40 | set output-meta on 41 | set convert-meta off 42 | 43 | # Use Alt/Meta + Delete to delete the preceding word 44 | "\e[3;3~": kill-word -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "browser": true, 3 | "camelcase": true, 4 | "curly": true, 5 | "devel": true, 6 | "eqeqeq": true, 7 | "forin": true, 8 | "indent": 2, 9 | "noarg": true, 10 | "node": true, 11 | "quotmark": "single", 12 | "esversion": 6, 13 | "undef": true, 14 | "strict": false, 15 | "unused": true 16 | } 17 | -------------------------------------------------------------------------------- /.osx: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # ~/.osx — https://mths.be/osx 4 | 5 | # Ask for the administrator password upfront 6 | sudo -v 7 | 8 | # Keep-alive: update existing `sudo` time stamp until `.osx` has finished 9 | while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 10 | 11 | ############################################################################### 12 | # General UI/UX # 13 | ############################################################################### 14 | 15 | # Set computer name (as done via System Preferences → Sharing) 16 | #sudo scutil --set ComputerName "0x6D746873" 17 | #sudo scutil --set HostName "0x6D746873" 18 | #sudo scutil --set LocalHostName "0x6D746873" 19 | #sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "0x6D746873" 20 | 21 | # Set standby delay to 24 hours (default is 1 hour) 22 | # sudo pmset -a standbydelay 86400 23 | 24 | # Disable the sound effects on boot 25 | sudo nvram SystemAudioVolume=" " 26 | 27 | # Disable transparency in the menu bar and elsewhere on Yosemite 28 | # defaults write com.apple.universalaccess reduceTransparency -bool true 29 | 30 | # # Menu bar: hide the Time Machine, Volume, and User icons 31 | # for domain in ~/Library/Preferences/ByHost/com.apple.systemuiserver.*; do 32 | # defaults write "${domain}" dontAutoLoad -array \ 33 | # "/System/Library/CoreServices/Menu Extras/TimeMachine.menu" \ 34 | # "/System/Library/CoreServices/Menu Extras/Volume.menu" \ 35 | # "/System/Library/CoreServices/Menu Extras/User.menu" 36 | # done 37 | # defaults write com.apple.systemuiserver menuExtras -array \ 38 | # "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" \ 39 | # "/System/Library/CoreServices/Menu Extras/AirPort.menu" \ 40 | # "/System/Library/CoreServices/Menu Extras/Battery.menu" \ 41 | # "/System/Library/CoreServices/Menu Extras/Clock.menu" 42 | 43 | # Set highlight color to green 44 | # defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600" 45 | 46 | # Set sidebar icon size to medium 47 | defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2 48 | 49 | # Always show scrollbars 50 | # defaults write NSGlobalDomain AppleShowScrollBars -string "Always" 51 | # Possible values: `WhenScrolling`, `Automatic` and `Always` 52 | 53 | # Disable the over-the-top focus ring animation 54 | defaults write NSGlobalDomain NSUseAnimatedFocusRing -bool false 55 | 56 | # Disable smooth scrolling 57 | # (Uncomment if you’re on an older Mac that messes up the animation) 58 | #defaults write NSGlobalDomain NSScrollAnimationEnabled -bool false 59 | 60 | # Increase window resize speed for Cocoa applications 61 | defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 62 | 63 | # Expand save panel by default 64 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true 65 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true 66 | 67 | # Expand print panel by default 68 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true 69 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true 70 | 71 | # Save to disk (not to iCloud) by default 72 | defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false 73 | 74 | # Automatically quit printer app once the print jobs complete 75 | defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true 76 | 77 | # Disable the “Are you sure you want to open this application?” dialog 78 | defaults write com.apple.LaunchServices LSQuarantine -bool false 79 | 80 | # Remove duplicates in the “Open With” menu (also see `lscleanup` alias) 81 | /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user 82 | 83 | # Display ASCII control characters using caret notation in standard text views 84 | # Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt` 85 | defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true 86 | 87 | # Disable Resume system-wide 88 | defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false 89 | 90 | # Disable automatic termination of inactive apps 91 | defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true 92 | 93 | # Disable the crash reporter 94 | #defaults write com.apple.CrashReporter DialogType -string "none" 95 | 96 | # Set Help Viewer windows to non-floating mode 97 | defaults write com.apple.helpviewer DevMode -bool true 98 | 99 | # Fix for the ancient UTF-8 bug in QuickLook (https://mths.be/bbo) 100 | # Commented out, as this is known to cause problems in various Adobe apps :( 101 | # See https://github.com/mathiasbynens/dotfiles/issues/237 102 | #echo "0x08000100:0" > ~/.CFUserTextEncoding 103 | 104 | # Reveal IP address, hostname, OS version, etc. when clicking the clock 105 | # in the login window 106 | sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName 107 | 108 | # Restart automatically if the computer freezes 109 | sudo systemsetup -setrestartfreeze on 110 | 111 | # Never go into computer sleep mode 112 | # sudo systemsetup -setcomputersleep Off > /dev/null 113 | 114 | # Check for software updates daily, not just once per week 115 | # defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 116 | 117 | # Disable Notification Center and remove the menu bar icon 118 | launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null 119 | 120 | # Disable smart quotes as they’re annoying when typing code 121 | defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false 122 | 123 | # Disable smart dashes as they’re annoying when typing code 124 | defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false 125 | 126 | # Set a custom wallpaper image. `DefaultDesktop.jpg` is already a symlink, and 127 | # all wallpapers are in `/Library/Desktop Pictures/`. The default is `Wave.jpg`. 128 | #rm -rf ~/Library/Application Support/Dock/desktoppicture.db 129 | #sudo rm -rf /System/Library/CoreServices/DefaultDesktop.jpg 130 | #sudo ln -s /path/to/your/image /System/Library/CoreServices/DefaultDesktop.jpg 131 | 132 | ############################################################################### 133 | # SSD-specific tweaks # 134 | ############################################################################### 135 | 136 | # Disable local Time Machine snapshots 137 | sudo tmutil disablelocal 138 | 139 | # Disable hibernation (speeds up entering sleep mode) 140 | sudo pmset -a hibernatemode 0 141 | 142 | # Remove the sleep image file to save disk space 143 | sudo rm /private/var/vm/sleepimage 144 | # Create a zero-byte file instead… 145 | sudo touch /private/var/vm/sleepimage 146 | # …and make sure it can’t be rewritten 147 | sudo chflags uchg /private/var/vm/sleepimage 148 | 149 | # Disable the sudden motion sensor as it’s not useful for SSDs 150 | # sudo pmset -a sms 0 151 | 152 | ############################################################################### 153 | # Trackpad, mouse, keyboard, Bluetooth accessories, and input # 154 | ############################################################################### 155 | 156 | # Trackpad: enable tap to click for this user and for the login screen 157 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true 158 | defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 159 | defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 160 | 161 | # Trackpad: map bottom right corner to right-click 162 | # defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 163 | # defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true 164 | # defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 165 | # defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true 166 | 167 | # Disable “natural” (Lion-style) scrolling 168 | # defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false 169 | 170 | # Increase sound quality for Bluetooth headphones/headsets 171 | defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 172 | 173 | # Enable full keyboard access for all controls 174 | # (e.g. enable Tab in modal dialogs) 175 | defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 176 | 177 | # Use scroll gesture with the Ctrl (^) modifier key to zoom 178 | # defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true 179 | # defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144 180 | # Follow the keyboard focus while zoomed in 181 | defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true 182 | 183 | # Disable press-and-hold for keys in favor of key repeat 184 | defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false 185 | 186 | # Set a blazingly fast keyboard repeat rate 187 | defaults write NSGlobalDomain KeyRepeat -int 0 188 | 189 | # Set language and text formats 190 | # Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with 191 | # `Inches`, `en_GB` with `en_US`, and `true` with `false`. 192 | # defaults write NSGlobalDomain AppleLanguages -array "en" 193 | defaults write NSGlobalDomain AppleLocale -string "en_GB@currency=GBP" 194 | defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" 195 | defaults write NSGlobalDomain AppleMetricUnits -bool true 196 | 197 | # Set the timezone; see `sudo systemsetup -listtimezones` for other values 198 | sudo systemsetup -settimezone "Europe/London" > /dev/null 199 | 200 | # Disable auto-correct 201 | # defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false 202 | 203 | # Stop iTunes from responding to the keyboard media keys 204 | #launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null 205 | 206 | ############################################################################### 207 | # Screen # 208 | ############################################################################### 209 | 210 | # Require password immediately after sleep or screen saver begins 211 | defaults write com.apple.screensaver askForPassword -int 1 212 | defaults write com.apple.screensaver askForPasswordDelay -int 0 213 | 214 | # Save screenshots to the desktop 215 | mkdir ${HOME}/Desktop/screenshots 216 | defaults write com.apple.screencapture location -string "${HOME}/Desktop/screenshots" 217 | 218 | # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) 219 | defaults write com.apple.screencapture type -string "png" 220 | 221 | # Disable shadow in screenshots 222 | # defaults write com.apple.screencapture disable-shadow -bool true 223 | 224 | # Enable subpixel font rendering on non-Apple LCDs 225 | defaults write NSGlobalDomain AppleFontSmoothing -int 2 226 | 227 | # Enable HiDPI display modes (requires restart) 228 | sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true 229 | 230 | ############################################################################### 231 | # Finder # 232 | ############################################################################### 233 | 234 | # Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons 235 | defaults write com.apple.finder QuitMenuItem -bool true 236 | 237 | # Finder: disable window animations and Get Info animations 238 | defaults write com.apple.finder DisableAllAnimations -bool true 239 | 240 | # Set Desktop as the default location for new Finder windows 241 | # For other paths, use `PfLo` and `file:///full/path/here/` 242 | defaults write com.apple.finder NewWindowTarget -string "PfDe" 243 | defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Dropbox/" 244 | 245 | # Show icons for hard drives, servers, and removable media on the desktop 246 | # defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true 247 | # defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true 248 | # defaults write com.apple.finder ShowMountedServersOnDesktop -bool true 249 | # defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true 250 | 251 | # Finder: show hidden files by default 252 | #defaults write com.apple.finder AppleShowAllFiles -bool true 253 | 254 | # Finder: show all filename extensions 255 | defaults write NSGlobalDomain AppleShowAllExtensions -bool true 256 | 257 | # Finder: show status bar 258 | defaults write com.apple.finder ShowStatusBar -bool true 259 | 260 | # Finder: show path bar 261 | defaults write com.apple.finder ShowPathbar -bool true 262 | 263 | # Display full POSIX path as Finder window title 264 | defaults write com.apple.finder _FXShowPosixPathInTitle -bool true 265 | 266 | # When performing a search, search the current folder by default 267 | defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" 268 | 269 | # Disable the warning when changing a file extension 270 | defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false 271 | 272 | # Enable spring loading for directories 273 | defaults write NSGlobalDomain com.apple.springing.enabled -bool true 274 | 275 | # Remove the spring loading delay for directories 276 | defaults write NSGlobalDomain com.apple.springing.delay -float 0 277 | 278 | # Avoid creating .DS_Store files on network volumes 279 | defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true 280 | 281 | # Disable disk image verification 282 | defaults write com.apple.frameworks.diskimages skip-verify -bool true 283 | defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true 284 | defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true 285 | 286 | # Automatically open a new Finder window when a volume is mounted 287 | defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true 288 | defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true 289 | defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true 290 | 291 | # Show item info near icons on the desktop and in other icon views 292 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 293 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 294 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 295 | 296 | # Show item info to the right of the icons on the desktop 297 | # /usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist 298 | 299 | # Enable snap-to-grid for icons on the desktop and in other icon views 300 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 301 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 302 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 303 | 304 | # Increase grid spacing for icons on the desktop and in other icon views 305 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 306 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 307 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 308 | 309 | # Increase the size of icons on the desktop and in other icon views 310 | # /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 311 | # /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 312 | # /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 313 | 314 | # Use list view in all Finder windows by default 315 | # Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv` 316 | defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" 317 | 318 | # Disable the warning before emptying the Trash 319 | defaults write com.apple.finder WarnOnEmptyTrash -bool false 320 | 321 | # Enable AirDrop over Ethernet and on unsupported Macs running Lion 322 | defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true 323 | 324 | # Enable the MacBook Air SuperDrive on any Mac 325 | sudo nvram boot-args="mbasd=1" 326 | 327 | # Show the ~/Library folder 328 | chflags nohidden ~/Library 329 | 330 | # Remove Dropbox’s green checkmark icons in Finder 331 | # file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns 332 | # [ -e "${file}" ] && mv -f "${file}" "${file}.bak" 333 | 334 | # Expand the following File Info panes: 335 | # “General”, “Open with”, and “Sharing & Permissions” 336 | defaults write com.apple.finder FXInfoPanesExpanded -dict \ 337 | General -bool true \ 338 | OpenWith -bool true \ 339 | Privileges -bool true 340 | 341 | ############################################################################### 342 | # Dock, Dashboard, and hot corners # 343 | ############################################################################### 344 | 345 | # Enable highlight hover effect for the grid view of a stack (Dock) 346 | # defaults write com.apple.dock mouse-over-hilite-stack -bool true 347 | 348 | # Set the icon size of Dock items to 36 pixels 349 | defaults write com.apple.dock tilesize -int 36 350 | 351 | # Change minimize/maximize window effect 352 | defaults write com.apple.dock mineffect -string "scale" 353 | 354 | # Minimize windows into their application’s icon 355 | defaults write com.apple.dock minimize-to-application -bool true 356 | 357 | # Enable spring loading for all Dock items 358 | defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true 359 | 360 | # Show indicator lights for open applications in the Dock 361 | defaults write com.apple.dock show-process-indicators -bool true 362 | 363 | # Wipe all (default) app icons from the Dock 364 | # This is only really useful when setting up a new Mac, or if you don’t use 365 | # the Dock to launch apps. 366 | #defaults write com.apple.dock persistent-apps -array 367 | 368 | # Show only open applications in the Dock 369 | #defaults write com.apple.dock static-only -bool true 370 | 371 | # Don’t animate opening applications from the Dock 372 | defaults write com.apple.dock launchanim -bool false 373 | 374 | # Speed up Mission Control animations 375 | defaults write com.apple.dock expose-animation-duration -float 0.1 376 | 377 | # Don’t group windows by application in Mission Control 378 | # (i.e. use the old Exposé behavior instead) 379 | # defaults write com.apple.dock expose-group-by-app -bool false 380 | 381 | # Disable Dashboard 382 | # defaults write com.apple.dashboard mcx-disabled -bool true 383 | 384 | # Don’t show Dashboard as a Space 385 | defaults write com.apple.dock dashboard-in-overlay -bool true 386 | 387 | # Don’t automatically rearrange Spaces based on most recent use 388 | defaults write com.apple.dock mru-spaces -bool false 389 | 390 | # Remove the auto-hiding Dock delay 391 | # defaults write com.apple.dock autohide-delay -float 0 392 | # Remove the animation when hiding/showing the Dock 393 | # defaults write com.apple.dock autohide-time-modifier -float 0 394 | 395 | # Automatically hide and show the Dock 396 | defaults write com.apple.dock autohide -bool true 397 | 398 | # Make Dock icons of hidden applications translucent 399 | # defaults write com.apple.dock showhidden -bool true 400 | 401 | # Disable the Launchpad gesture (pinch with thumb and three fingers) 402 | #defaults write com.apple.dock showLaunchpadGestureEnabled -int 0 403 | 404 | # Reset Launchpad, but keep the desktop wallpaper intact 405 | find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete 406 | 407 | # Add iOS & Watch Simulator to Launchpad 408 | # sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" "/Applications/Simulator.app" 409 | # sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator (Watch).app" "/Applications/Simulator (Watch).app" 410 | 411 | # Add a spacer to the left side of the Dock (where the applications are) 412 | #defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' 413 | # Add a spacer to the right side of the Dock (where the Trash is) 414 | #defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}' 415 | 416 | # Hot corners 417 | # Possible values: 418 | # 0: no-op 419 | # 2: Mission Control 420 | # 3: Show application windows 421 | # 4: Desktop 422 | # 5: Start screen saver 423 | # 6: Disable screen saver 424 | # 7: Dashboard 425 | # 10: Put display to sleep 426 | # 11: Launchpad 427 | # 12: Notification Center 428 | # Top left screen corner → screensaver 429 | defaults write com.apple.dock wvous-tl-corner -int 5 430 | defaults write com.apple.dock wvous-tl-modifier -int 0 431 | # Top right screen corner → Desktop 432 | defaults write com.apple.dock wvous-tr-corner -int 4 433 | defaults write com.apple.dock wvous-tr-modifier -int 0 434 | # Bottom left screen corner → Start screen saver 435 | defaults write com.apple.dock wvous-bl-corner -int 0 436 | defaults write com.apple.dock wvous-bl-modifier -int 0 437 | 438 | ############################################################################### 439 | # Safari & WebKit # 440 | ############################################################################### 441 | 442 | # Privacy: don’t send search queries to Apple 443 | defaults write com.apple.Safari UniversalSearchEnabled -bool false 444 | defaults write com.apple.Safari SuppressSearchSuggestions -bool true 445 | 446 | # Press Tab to highlight each item on a web page 447 | defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true 448 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true 449 | 450 | # Show the full URL in the address bar (note: this still hides the scheme) 451 | defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true 452 | 453 | # Set Safari’s home page to `about:blank` for faster loading 454 | defaults write com.apple.Safari HomePage -string "about:blank" 455 | 456 | # Prevent Safari from opening ‘safe’ files automatically after downloading 457 | defaults write com.apple.Safari AutoOpenSafeDownloads -bool false 458 | 459 | # Allow hitting the Backspace key to go to the previous page in history 460 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true 461 | 462 | # Hide Safari’s bookmarks bar by default 463 | defaults write com.apple.Safari ShowFavoritesBar -bool false 464 | 465 | # Hide Safari’s sidebar in Top Sites 466 | defaults write com.apple.Safari ShowSidebarInTopSites -bool false 467 | 468 | # Disable Safari’s thumbnail cache for History and Top Sites 469 | defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 470 | 471 | # Enable Safari’s debug menu 472 | defaults write com.apple.Safari IncludeInternalDebugMenu -bool true 473 | 474 | # Make Safari’s search banners default to Contains instead of Starts With 475 | defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false 476 | 477 | # Remove useless icons from Safari’s bookmarks bar 478 | defaults write com.apple.Safari ProxiesInBookmarksBar "()" 479 | 480 | # Enable the Develop menu and the Web Inspector in Safari 481 | defaults write com.apple.Safari IncludeDevelopMenu -bool true 482 | defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true 483 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true 484 | 485 | # Add a context menu item for showing the Web Inspector in web views 486 | defaults write NSGlobalDomain WebKitDeveloperExtras -bool true 487 | 488 | ############################################################################### 489 | # Mail # 490 | ############################################################################### 491 | 492 | # Disable send and reply animations in Mail.app 493 | defaults write com.apple.mail DisableReplyAnimations -bool true 494 | defaults write com.apple.mail DisableSendAnimations -bool true 495 | 496 | # Copy email addresses as `foo@example.com` instead of `Foo Bar ` in Mail.app 497 | defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false 498 | 499 | # Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app 500 | defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" -string "@\\U21a9" 501 | 502 | # Display emails in threaded mode, sorted by date (oldest at the top) 503 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes" 504 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortedDescending" -string "yes" 505 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortOrder" -string "received-date" 506 | 507 | # Disable inline attachments (just show the icons) 508 | defaults write com.apple.mail DisableInlineAttachmentViewing -bool true 509 | 510 | # Disable automatic spell checking 511 | defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled" 512 | 513 | ############################################################################### 514 | # Spotlight # 515 | ############################################################################### 516 | 517 | # Hide Spotlight tray-icon (and subsequent helper) 518 | #sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search 519 | # Disable Spotlight indexing for any volume that gets mounted and has not yet 520 | # been indexed before. 521 | # Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume. 522 | sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes" 523 | # Change indexing order and disable some search results 524 | # Yosemite-specific search results (remove them if you are using OS X 10.9 or older): 525 | # MENU_DEFINITION 526 | # MENU_CONVERSION 527 | # MENU_EXPRESSION 528 | # MENU_SPOTLIGHT_SUGGESTIONS (send search queries to Apple) 529 | # MENU_WEBSEARCH (send search queries to Apple) 530 | # MENU_OTHER 531 | defaults write com.apple.spotlight orderedItems -array \ 532 | '{"enabled" = 1;"name" = "APPLICATIONS";}' \ 533 | '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \ 534 | '{"enabled" = 1;"name" = "DIRECTORIES";}' \ 535 | '{"enabled" = 1;"name" = "PDF";}' \ 536 | '{"enabled" = 1;"name" = "FONTS";}' \ 537 | '{"enabled" = 0;"name" = "DOCUMENTS";}' \ 538 | '{"enabled" = 0;"name" = "MESSAGES";}' \ 539 | '{"enabled" = 0;"name" = "CONTACT";}' \ 540 | '{"enabled" = 0;"name" = "EVENT_TODO";}' \ 541 | '{"enabled" = 0;"name" = "IMAGES";}' \ 542 | '{"enabled" = 0;"name" = "BOOKMARKS";}' \ 543 | '{"enabled" = 0;"name" = "MUSIC";}' \ 544 | '{"enabled" = 0;"name" = "MOVIES";}' \ 545 | '{"enabled" = 0;"name" = "PRESENTATIONS";}' \ 546 | '{"enabled" = 0;"name" = "SPREADSHEETS";}' \ 547 | '{"enabled" = 0;"name" = "SOURCE";}' \ 548 | '{"enabled" = 0;"name" = "MENU_DEFINITION";}' \ 549 | '{"enabled" = 0;"name" = "MENU_OTHER";}' \ 550 | '{"enabled" = 0;"name" = "MENU_CONVERSION";}' \ 551 | '{"enabled" = 0;"name" = "MENU_EXPRESSION";}' \ 552 | '{"enabled" = 0;"name" = "MENU_WEBSEARCH";}' \ 553 | '{"enabled" = 0;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}' 554 | # Load new settings before rebuilding the index 555 | killall mds > /dev/null 2>&1 556 | # Make sure indexing is enabled for the main volume 557 | sudo mdutil -i on / > /dev/null 558 | # Rebuild the index from scratch 559 | sudo mdutil -E / > /dev/null 560 | 561 | ############################################################################### 562 | # Terminal & iTerm 2 # 563 | ############################################################################### 564 | 565 | # Only use UTF-8 in Terminal.app 566 | defaults write com.apple.terminal StringEncodings -array 4 567 | 568 | # Install the Solarized Dark theme for iTerm 569 | open "${HOME}/init/Solarized Dark.itermcolors" 570 | 571 | # Don’t display the annoying prompt when quitting iTerm 572 | defaults write com.googlecode.iterm2 PromptOnQuit -bool false 573 | 574 | ############################################################################### 575 | # Time Machine # 576 | ############################################################################### 577 | 578 | # Prevent Time Machine from prompting to use new hard drives as backup volume 579 | defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true 580 | 581 | # Disable local Time Machine backups 582 | hash tmutil &> /dev/null && sudo tmutil disablelocal 583 | 584 | ############################################################################### 585 | # Activity Monitor # 586 | ############################################################################### 587 | 588 | # Show the main window when launching Activity Monitor 589 | defaults write com.apple.ActivityMonitor OpenMainWindow -bool true 590 | 591 | # Visualize CPU usage in the Activity Monitor Dock icon 592 | defaults write com.apple.ActivityMonitor IconType -int 5 593 | 594 | # Show all processes in Activity Monitor 595 | defaults write com.apple.ActivityMonitor ShowCategory -int 0 596 | 597 | # Sort Activity Monitor results by CPU usage 598 | defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" 599 | defaults write com.apple.ActivityMonitor SortDirection -int 0 600 | 601 | ############################################################################### 602 | # Address Book, Dashboard, iCal, TextEdit, and Disk Utility # 603 | ############################################################################### 604 | 605 | # Enable the debug menu in Address Book 606 | defaults write com.apple.addressbook ABShowDebugMenu -bool true 607 | 608 | # Enable Dashboard dev mode (allows keeping widgets on the desktop) 609 | defaults write com.apple.dashboard devmode -bool true 610 | 611 | # Enable the debug menu in iCal (pre-10.8) 612 | defaults write com.apple.iCal IncludeDebugMenu -bool true 613 | 614 | # Use plain text mode for new TextEdit documents 615 | defaults write com.apple.TextEdit RichText -int 0 616 | # Open and save files as UTF-8 in TextEdit 617 | defaults write com.apple.TextEdit PlainTextEncoding -int 4 618 | defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 619 | 620 | # Enable the debug menu in Disk Utility 621 | defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true 622 | defaults write com.apple.DiskUtility advanced-image-options -bool true 623 | 624 | ############################################################################### 625 | # Mac App Store # 626 | ############################################################################### 627 | 628 | # Enable the WebKit Developer Tools in the Mac App Store 629 | defaults write com.apple.appstore WebKitDeveloperExtras -bool true 630 | 631 | # Enable Debug Menu in the Mac App Store 632 | defaults write com.apple.appstore ShowDebugMenu -bool true 633 | 634 | ############################################################################### 635 | # Photos # 636 | ############################################################################### 637 | 638 | # Prevent Photos from opening automatically when devices are plugged in 639 | defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true 640 | 641 | ############################################################################### 642 | # Messages # 643 | ############################################################################### 644 | 645 | # Disable automatic emoji substitution (i.e. use plain text smileys) 646 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false 647 | 648 | # Disable smart quotes as it’s annoying for messages that contain code 649 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false 650 | 651 | # Disable continuous spell checking 652 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false 653 | 654 | ############################################################################### 655 | # Google Chrome & Google Chrome Canary # 656 | ############################################################################### 657 | 658 | # Allow installing user scripts via GitHub Gist or Userscripts.org 659 | defaults write com.google.Chrome ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" 660 | defaults write com.google.Chrome.canary ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" 661 | 662 | # Disable the all too sensitive backswipe on trackpads 663 | defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false 664 | defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false 665 | 666 | # Disable the all too sensitive backswipe on Magic Mouse 667 | defaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -bool false 668 | defaults write com.google.Chrome.canary AppleEnableMouseSwipeNavigateWithScrolls -bool false 669 | 670 | # Use the system-native print preview dialog 671 | defaults write com.google.Chrome DisablePrintPreview -bool true 672 | defaults write com.google.Chrome.canary DisablePrintPreview -bool true 673 | 674 | # Expand the print dialog by default 675 | defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true 676 | defaults write com.google.Chrome.canary PMPrintingExpandedStateForPrint2 -bool true 677 | 678 | ############################################################################### 679 | # Opera & Opera Developer # 680 | ############################################################################### 681 | 682 | # Expand the print dialog by default 683 | defaults write com.operasoftware.Opera PMPrintingExpandedStateForPrint2 -boolean true 684 | defaults write com.operasoftware.OperaDeveloper PMPrintingExpandedStateForPrint2 -boolean true 685 | 686 | ############################################################################### 687 | # Sublime Text # 688 | ############################################################################### 689 | 690 | # Install Sublime Text settings 691 | cp -r init/Preferences.sublime-settings ~/Library/Application\ Support/Sublime\ Text*/Packages/User/Preferences.sublime-settings 2> /dev/null 692 | 693 | ############################################################################### 694 | # Transmission.app # 695 | ############################################################################### 696 | 697 | # Use `~/Documents/Torrents` to store incomplete downloads 698 | defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true 699 | defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Documents/Torrents" 700 | 701 | # Don’t prompt for confirmation before downloading 702 | defaults write org.m0k.transmission DownloadAsk -bool false 703 | 704 | # Trash original torrent files 705 | defaults write org.m0k.transmission DeleteOriginalTorrent -bool true 706 | 707 | # Hide the donate message 708 | defaults write org.m0k.transmission WarningDonate -bool false 709 | # Hide the legal disclaimer 710 | defaults write org.m0k.transmission WarningLegal -bool false 711 | 712 | ############################################################################### 713 | # Twitter.app # 714 | ############################################################################### 715 | 716 | # Disable smart quotes as it’s annoying for code tweets 717 | defaults write com.twitter.twitter-mac AutomaticQuoteSubstitutionEnabled -bool false 718 | 719 | # Show the app window when clicking the menu bar icon 720 | defaults write com.twitter.twitter-mac MenuItemBehavior -int 1 721 | 722 | # Enable the hidden ‘Develop’ menu 723 | defaults write com.twitter.twitter-mac ShowDevelopMenu -bool true 724 | 725 | # Open links in the background 726 | defaults write com.twitter.twitter-mac openLinksInBackground -bool true 727 | 728 | # Allow closing the ‘new tweet’ window by pressing `Esc` 729 | defaults write com.twitter.twitter-mac ESCClosesComposeWindow -bool true 730 | 731 | # Show full names rather than Twitter handles 732 | defaults write com.twitter.twitter-mac ShowFullNames -bool true 733 | 734 | # Hide the app in the background if it’s not the front-most window 735 | defaults write com.twitter.twitter-mac HideInBackground -bool true 736 | 737 | ############################################################################### 738 | # Tweetbot.app # 739 | ############################################################################### 740 | 741 | # Bypass the annoyingly slow t.co URL shortener 742 | defaults write com.tapbots.TweetbotMac OpenURLsDirectly -bool true 743 | 744 | ############################################################################### 745 | # Spectacle.app # 746 | ############################################################################### 747 | 748 | # Set up my preferred keyboard shortcuts 749 | defaults write com.divisiblebyzero.Spectacle MakeLarger -data 62706c6973743030d40102030405061819582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708101155246e756c6cd4090a0b0c0d0e0d0f596d6f64696669657273546e616d65576b6579436f64655624636c6173731000800280035a4d616b654c6172676572d2121314155a24636c6173736e616d655824636c6173736573585a4b486f744b6579a21617585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11a1b54726f6f74800108111a232d32373c424b555a62696b6d6f7a7f8a939c9fa8b1c3c6cb0000000000000101000000000000001c000000000000000000000000000000cd 750 | defaults write com.divisiblebyzero.Spectacle MakeSmaller -data 62706c6973743030d40102030405061819582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708101155246e756c6cd4090a0b0c0d0e0d0f596d6f64696669657273546e616d65576b6579436f64655624636c6173731000800280035b4d616b65536d616c6c6572d2121314155a24636c6173736e616d655824636c6173736573585a4b486f744b6579a21617585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11a1b54726f6f74800108111a232d32373c424b555a62696b6d6f7b808b949da0a9b2c4c7cc0000000000000101000000000000001c000000000000000000000000000000ce 751 | defaults write com.divisiblebyzero.Spectacle MoveToBottomDisplay -data 62706c6973743030d4010203040506191a582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731119008002107d80035f10134d6f7665546f426f74746f6d446973706c6179d2131415165a24636c6173736e616d655824636c61737365735d5a65726f4b6974486f744b6579a217185d5a65726f4b6974486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11b1c54726f6f74800108111a232d32373c424b555a62696c6e7072888d98a1afb2c0c9dbdee30000000000000101000000000000001d000000000000000000000000000000e5 752 | defaults write com.divisiblebyzero.Spectacle MoveToBottomHalf -data 62706c6973743030d4010203040506191a582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731119008002107d80035f10104d6f7665546f426f74746f6d48616c66d2131415165a24636c6173736e616d655824636c6173736573585a4b486f744b6579a21718585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11b1c54726f6f74800108111a232d32373c424b555a62696c6e7072858a959ea7aab3bcced1d60000000000000101000000000000001d000000000000000000000000000000d8 753 | defaults write com.divisiblebyzero.Spectacle MoveToCenter -data 62706c6973743030d4010203040506191a582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731119008002100880035c4d6f7665546f43656e746572d2131415165a24636c6173736e616d655824636c6173736573585a4b486f744b6579a21718585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11b1c54726f6f74800108111a232d32373c424b555a62696c6e70727f848f98a1a4adb6c8cbd00000000000000101000000000000001d000000000000000000000000000000d2 754 | defaults write com.divisiblebyzero.Spectacle MoveToFullscreen -data 62706c6973743030d4010203040506191a582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731119008002102e80035f10104d6f7665546f46756c6c73637265656ed2131415165a24636c6173736e616d655824636c6173736573585a4b486f744b6579a21718585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11b1c54726f6f74800108111a232d32373c424b555a62696c6e7072858a959ea7aab3bcced1d60000000000000101000000000000001d000000000000000000000000000000d8 755 | defaults write com.divisiblebyzero.Spectacle MoveToLeftDisplay -data 62706c6973743030d4010203040506191a582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731119008002107b80035f10114d6f7665546f4c656674446973706c6179d2131415165a24636c6173736e616d655824636c61737365735d5a65726f4b6974486f744b6579a217185d5a65726f4b6974486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11b1c54726f6f74800108111a232d32373c424b555a62696c6e7072868b969fadb0bec7d9dce10000000000000101000000000000001d000000000000000000000000000000e3 756 | defaults write com.divisiblebyzero.Spectacle MoveToLeftHalf -data 62706c6973743030d4010203040506191a582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731119008002107b80035e4d6f7665546f4c65667448616c66d2131415165a24636c6173736e616d655824636c6173736573585a4b486f744b6579a21718585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11b1c54726f6f74800108111a232d32373c424b555a62696c6e70728186919aa3a6afb8cacdd20000000000000101000000000000001d000000000000000000000000000000d4 757 | defaults write com.divisiblebyzero.Spectacle MoveToLowerLeft -data 62706c6973743030d40102030405061a1b582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731113008002107b80035f100f4d6f7665546f4c6f7765724c656674d2131415165a24636c6173736e616d655824636c61737365735d5a65726f4b6974486f744b6579a31718195d5a65726f4b6974486f744b6579585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11c1d54726f6f74800108111a232d32373c424b555a62696c6e70728489949dabafbdc6cfe1e4e90000000000000101000000000000001e000000000000000000000000000000eb 758 | defaults write com.divisiblebyzero.Spectacle MoveToLowerRight -data 62706c6973743030d40102030405061a1b582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731113008002107c80035f10104d6f7665546f4c6f7765725269676874d2131415165a24636c6173736e616d655824636c61737365735d5a65726f4b6974486f744b6579a31718195d5a65726f4b6974486f744b6579585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11c1d54726f6f74800108111a232d32373c424b555a62696c6e7072858a959eacb0bec7d0e2e5ea0000000000000101000000000000001e000000000000000000000000000000ec 759 | defaults write com.divisiblebyzero.Spectacle MoveToNextDisplay -data 62706c6973743030d4010203040506191a582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731118008002107c80035f10114d6f7665546f4e657874446973706c6179d2131415165a24636c6173736e616d655824636c6173736573585a4b486f744b6579a21718585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11b1c54726f6f74800108111a232d32373c424b555a62696c6e7072868b969fa8abb4bdcfd2d70000000000000101000000000000001d000000000000000000000000000000d9 760 | defaults write com.divisiblebyzero.Spectacle MoveToNextThird -data 62706c6973743030d40102030405061819582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708101155246e756c6cd4090a0b0c0d0e0d0f596d6f64696669657273546e616d65576b6579436f64655624636c6173731000800280035f100f4d6f7665546f4e6578745468697264d2121314155a24636c6173736e616d655824636c6173736573585a4b486f744b6579a21617585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11a1b54726f6f74800108111a232d32373c424b555a62696b6d6f8186919aa3a6afb8cacdd20000000000000101000000000000001c000000000000000000000000000000d4 761 | defaults write com.divisiblebyzero.Spectacle MoveToPreviousDisplay -data 62706c6973743030d4010203040506191a582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731118008002107b80035f10154d6f7665546f50726576696f7573446973706c6179d2131415165a24636c6173736e616d655824636c6173736573585a4b486f744b6579a21718585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11b1c54726f6f74800108111a232d32373c424b555a62696c6e70728a8f9aa3acafb8c1d3d6db0000000000000101000000000000001d000000000000000000000000000000dd 762 | defaults write com.divisiblebyzero.Spectacle MoveToPreviousThird -data 62706c6973743030d40102030405061819582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708101155246e756c6cd4090a0b0c0d0e0d0f596d6f64696669657273546e616d65576b6579436f64655624636c6173731000800280035f10134d6f7665546f50726576696f75735468697264d2121314155a24636c6173736e616d655824636c6173736573585a4b486f744b6579a21617585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11a1b54726f6f74800108111a232d32373c424b555a62696b6d6f858a959ea7aab3bcced1d60000000000000101000000000000001c000000000000000000000000000000d8 763 | defaults write com.divisiblebyzero.Spectacle MoveToRightDisplay -data 62706c6973743030d4010203040506191a582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731119008002107c80035f10124d6f7665546f5269676874446973706c6179d2131415165a24636c6173736e616d655824636c61737365735d5a65726f4b6974486f744b6579a217185d5a65726f4b6974486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11b1c54726f6f74800108111a232d32373c424b555a62696c6e7072878c97a0aeb1bfc8dadde20000000000000101000000000000001d000000000000000000000000000000e4 764 | defaults write com.divisiblebyzero.Spectacle MoveToRightHalf -data 62706c6973743030d4010203040506191a582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731119008002107c80035f100f4d6f7665546f526967687448616c66d2131415165a24636c6173736e616d655824636c6173736573585a4b486f744b6579a21718585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11b1c54726f6f74800108111a232d32373c424b555a62696c6e70728489949da6a9b2bbcdd0d50000000000000101000000000000001d000000000000000000000000000000d7 765 | defaults write com.divisiblebyzero.Spectacle MoveToTopDisplay -data 62706c6973743030d4010203040506191a582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731119008002107e80035f10104d6f7665546f546f70446973706c6179d2131415165a24636c6173736e616d655824636c61737365735d5a65726f4b6974486f744b6579a217185d5a65726f4b6974486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11b1c54726f6f74800108111a232d32373c424b555a62696c6e7072858a959eacafbdc6d8dbe00000000000000101000000000000001d000000000000000000000000000000e2 766 | defaults write com.divisiblebyzero.Spectacle MoveToTopHalf -data 62706c6973743030d4010203040506191a582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731119008002107e80035d4d6f7665546f546f7048616c66d2131415165a24636c6173736e616d655824636c6173736573585a4b486f744b6579a21718585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11b1c54726f6f74800108111a232d32373c424b555a62696c6e707280859099a2a5aeb7c9ccd10000000000000101000000000000001d000000000000000000000000000000d3 767 | defaults write com.divisiblebyzero.Spectacle MoveToUpperLeft -data 62706c6973743030d40102030405061a1b582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731111008002107b80035f100f4d6f7665546f55707065724c656674d2131415165a24636c6173736e616d655824636c61737365735d5a65726f4b6974486f744b6579a31718195d5a65726f4b6974486f744b6579585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11c1d54726f6f74800108111a232d32373c424b555a62696c6e70728489949dabafbdc6cfe1e4e90000000000000101000000000000001e000000000000000000000000000000eb 768 | defaults write com.divisiblebyzero.Spectacle MoveToUpperRight -data 62706c6973743030d40102030405061a1b582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731111008002107c80035f10104d6f7665546f55707065725269676874d2131415165a24636c6173736e616d655824636c61737365735d5a65726f4b6974486f744b6579a31718195d5a65726f4b6974486f744b6579585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11c1d54726f6f74800108111a232d32373c424b555a62696c6e7072858a959eacb0bec7d0e2e5ea0000000000000101000000000000001e000000000000000000000000000000ec 769 | defaults write com.divisiblebyzero.Spectacle RedoLastMove -data 62706c6973743030d40102030405061a1b582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c617373110b008002100680035c5265646f4c6173744d6f7665d2131415165a24636c6173736e616d655824636c61737365735d5a65726f4b6974486f744b6579a31718195d5a65726f4b6974486f744b6579585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11c1d54726f6f74800108111a232d32373c424b555a62696c6e70727f848f98a6aab8c1cadcdfe40000000000000101000000000000001e000000000000000000000000000000e6 770 | defaults write com.divisiblebyzero.Spectacle UndoLastMove -data 62706c6973743030d40102030405061a1b582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a40708111255246e756c6cd4090a0b0c0d0e0f10596d6f64696669657273546e616d65576b6579436f64655624636c6173731109008002100680035c556e646f4c6173744d6f7665d2131415165a24636c6173736e616d655824636c61737365735d5a65726f4b6974486f744b6579a31718195d5a65726f4b6974486f744b6579585a4b486f744b6579584e534f626a6563745f100f4e534b657965644172636869766572d11c1d54726f6f74800108111a232d32373c424b555a62696c6e70727f848f98a6aab8c1cadcdfe40000000000000101000000000000001e000000000000000000000000000000e6 771 | 772 | ############################################################################### 773 | # Kill affected applications # 774 | ############################################################################### 775 | 776 | for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \ 777 | "Dock" "Finder" "Google Chrome" "Google Chrome Canary" "Mail" "Messages" \ 778 | "Opera" "Photos" "Safari" "Spectacle" "SystemUIServer" "Terminal" \ 779 | "Transmission" "Twitter" "iCal"; do 780 | killall "${app}" &> /dev/null 781 | done 782 | echo "Done. Note that some of these changes require a logout/restart to take effect." 783 | -------------------------------------------------------------------------------- /.paths: -------------------------------------------------------------------------------- 1 | /usr/local/opt/curl/bin 2 | /opt/local/include 3 | /opt/local/bin 4 | /opt/local/sbin 5 | $HOME/google-cloud-sdk/bin 6 | $HOME/android-sdk-macosx/platform-tools 7 | $HOME/bin 8 | $HOME/bin/adb 9 | $HOME/go/bin 10 | /usr/local/mysql/bin 11 | /usr/local/share/npm/bin 12 | /usr/local/sbin 13 | /usr/local/bin 14 | /usr/bin 15 | /bin 16 | /usr/sbin 17 | /sbin 18 | /usr/X11/bin 19 | $HOME/android-sdk/platform-tools 20 | $HOME/esp/xtensa-esp32-elf/bin 21 | /Applications/VirtualBox.app/Contents/MacOS/ 22 | /Applications/Muse/ 23 | /Applications/Postgres.app/Contents/Versions/9.4/bin 24 | ### Added by the Heroku Toolbelt 25 | /usr/local/heroku/bin 26 | $HOME/.rvm/bin # Add RVM to PATH for scripting 27 | $HOME/bin/gcc-arm/bin 28 | $HOME/.local/bin 29 | $HOME/.deno/bin 30 | -------------------------------------------------------------------------------- /.screenrc: -------------------------------------------------------------------------------- 1 | # Disable the startup message 2 | startup_message off 3 | 4 | # Set a large scrollback buffer 5 | defscrollback 32000 6 | 7 | # Always start `screen` with UTF-8 enabled (`screen -U`) 8 | defutf8 on 9 | -------------------------------------------------------------------------------- /.spacevim: -------------------------------------------------------------------------------- 1 | " You can enable the existing layers in space-vim and 2 | " exclude the partial plugins in a certain layer. 3 | " The command Layer is vaild in the function Layers(). 4 | " Use exclude option if you don't want the full Layer, 5 | " e.g., Layer 'better-defaults', { 'exclude': 'itchyny/vim-cursorword' } 6 | function! Layers() 7 | 8 | " Default layers, recommended! 9 | Layer 'fzf' 10 | Layer 'unite' 11 | Layer 'better-defaults' 12 | Layer 'auto-completion' 13 | Layer 'emoji' 14 | Layer 'airline' 15 | Layer 'goyo' " g y - to toggle distraction free! 16 | 17 | endfunction 18 | 19 | " Put your private plugins here. 20 | function! UserInit() 21 | 22 | " Space has been set as the default leader key, 23 | " if you want to change it, uncomment and set it here. 24 | " let g:spacevim_leader = "<\Space>" 25 | " let g:spacevim_localleader = ',' 26 | 27 | " Install private plugins 28 | " Plug 'extr0py/oni' 29 | Plug 'airblade/vim-gitgutter' 30 | Plug 'tpope/vim-fugitive' 31 | Plug 'rakr/vim-one' 32 | Plug 'mileszs/ack.vim' 33 | Plug 'vim-syntastic/syntastic' 34 | Plug 'chriskempson/base16-vim' 35 | " Plug 'rakr/vim-togglebg' 36 | " Plug 'ervandew/supertab' 37 | 38 | endfunction 39 | 40 | " Put your costom configurations here, e.g., change the colorscheme. 41 | function! UserConfig() 42 | 43 | if (has("termguicolors")) 44 | set termguicolors 45 | endif 46 | 47 | " set background=light 48 | " set background=dark 49 | " colorscheme one 50 | " toggle and reload the color scheme on F5 51 | " let s:mybg = "dark" 52 | "| map :call BgToggleSol() 53 | 54 | " linting configuration 55 | set statusline+=%#warningmsg# 56 | set statusline+=%{SyntasticStatuslineFlag()} 57 | set statusline+=%* 58 | 59 | let g:syntastic_javascript_checkers = ['eslint'] 60 | let g:syntastic_javascript_eslint_exe = 'eslint --fix' 61 | let g:syntastic_always_populate_loc_list = 0 62 | let g:syntastic_auto_loc_list = 0 63 | let g:syntastic_check_on_open = 1 64 | let g:syntastic_check_on_wq = 0 65 | 66 | " always assume I'll be pasting 67 | " set paste 68 | 69 | " Useful settings 70 | set scrolloff=3 71 | 72 | " .md == markdown 73 | autocmd BufNewFile,BufReadPost *.md set filetype=markdown 74 | " always spellcheck markdown and gitcommit 75 | autocmd BufRead,BufNewFile *.md setlocal spell 76 | autocmd FileType gitcommit setlocal spell 77 | 78 | " map `/` to search 79 | " map / :/ 80 | 81 | " map to completion ^P 82 | imap 83 | 84 | " Treat long lines as break lines (useful when moving around in them) 85 | set wrap 86 | nnoremap gj 87 | nnoremap gk 88 | vnoremap gj 89 | vnoremap gk 90 | inoremap gj 91 | inoremap gk 92 | 93 | " Useful mappings 94 | nnoremap G Gzz 95 | 96 | " keep swap files, but leave them in /tmp 97 | set swapfile 98 | set bdir=$TMPDIR 99 | set dir=$TMPDIR 100 | set undodir=$TMPDIR 101 | set nowritebackup 102 | 103 | " 2 spaces 104 | filetype plugin indent on 105 | " show existing tab with 4 spaces width 106 | set tabstop=2 107 | " when indenting with '>', use 4 spaces width 108 | set shiftwidth=2 109 | " On pressing tab, insert 4 spaces 110 | set expandtab 111 | 112 | " If you enable airline layer and have installed the powerline fonts, 113 | " set it here. 114 | let g:airline_powerline_fonts=1 115 | let g:airline_theme='one' 116 | 117 | " Show file options above the command line 118 | set wildmenu 119 | 120 | " narrow nerdtree 121 | let g:NERDTreeWinSize = 30 122 | let g:NERDTreeWinPos = "right" " open with F4 123 | let g:NERDTreeIgnore = ['\.next$', '\.git$', '.DS_Store', 'node_modules$'] 124 | 125 | " change insert cursor in Hyper (copied from iterm style): 126 | if $TERM_PROGRAM =~# 'Hyper' 127 | let &t_SI = "\]50;CursorShape=1\x7" 128 | let &t_SR = "\]50;CursorShape=2\x7" 129 | let &t_EI = "\]50;CursorShape=0\x7" 130 | endif 131 | 132 | 133 | " Set the working directory to wherever the open file lives 134 | " set autochdir 135 | 136 | " Don't offer to open certain files/directories 137 | set wildignore+=*.bmp,*.gif,*.ico,*.jpg,*.png,*.ico 138 | set wildignore+=*.pdf,*.psd 139 | set wildignore+=node_modules/*,bower_components/*,.next/* 140 | endfunction 141 | 142 | " Initially set it to "dark" or "light" according to your default 143 | function! BgToggleSol() 144 | if (s:mybg ==? "light") 145 | set background=dark 146 | let s:mybg = "dark" 147 | else 148 | set background=light 149 | let s:mybg = "light" 150 | endif 151 | " set background=light 152 | colorscheme one 153 | endfunction 154 | 155 | -------------------------------------------------------------------------------- /.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 36 | 37 | # Disguise as IE 9 on Windows 7 38 | user_agent = Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) 39 | -------------------------------------------------------------------------------- /.zshenv: -------------------------------------------------------------------------------- 1 | source $HOME/.nvm/nvm.sh 2 | export _NODE=`which node` # load the real one 3 | PATH=$HOME/bin:$PATH 4 | -------------------------------------------------------------------------------- /.zshrc: -------------------------------------------------------------------------------- 1 | BASE16_SHELL=$HOME/.config/base16-shell/ 2 | [ -n "$PS1" ] && [ -s $BASE16_SHELL/profile_helper.sh ] && eval "$($BASE16_SHELL/profile_helper.sh)" 3 | 4 | # Path to your oh-my-zsh configuration. 5 | ZSH=$HOME/.oh-my-zsh 6 | 7 | # Set name of the theme to load. 8 | # Look in ~/.oh-my-zsh/themes/ 9 | # Optionally, if you set this to "random", it'll load a random theme each 10 | # time that oh-my-zsh is loaded. 11 | ZSH_THEME="remy" 12 | # ZSH_THEME="demo" 13 | 14 | # Set to this to use case-sensitive completion 15 | # CASE_SENSITIVE="true" 16 | 17 | # Comment this out to disable weekly auto-update checks 18 | # DISABLE_AUTO_UPDATE="true" 19 | 20 | # Uncomment following line if you want to disable colors in ls 21 | # DISABLE_LS_COLORS="true" 22 | 23 | # Uncomment following line if you want to disable autosetting terminal title. 24 | # DISABLE_AUTO_TITLE="true" 25 | 26 | # Uncomment following line if you want red dots to be displayed while waiting for completion 27 | # COMPLETION_WAITING_DOTS="true" 28 | 29 | globalias() { 30 | if [[ $LBUFFER =~ ' [A-Z0-9]+$' ]]; then 31 | zle _expand_alias 32 | fi 33 | zle self-insert 34 | } 35 | 36 | zle -N globalias 37 | 38 | bindkey " " globalias 39 | bindkey "^ " magic-space # control-space to bypass completion 40 | bindkey -M isearch " " magic-space # normal space during searches 41 | 42 | setopt share_history 43 | setopt histignorespace # history ignores anything starting with a space 44 | 45 | [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" 46 | 47 | source $HOME/.exports 48 | 49 | # import a list of paths 50 | export PATH=$(eval echo $(cat $HOME/.paths | sed 's:#.*$::g' | sed '/^\s*$/d' | sed -e :a -e '$!N; s/\n/:/; ta')):$PATH 51 | 52 | # .extra contains private keys and isn't included in this repo 53 | for source in .zshenv .extra .aliases .functions .travis/travis.sh; do 54 | [ -f $HOME/$source ] && source $HOME/$source; 55 | done 56 | 57 | # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) 58 | # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ 59 | plugins=(git node npm github brew sublime heroku z zsh-syntax-highlighting zsh-autosuggestions) 60 | 61 | source $ZSH/oh-my-zsh.sh 62 | 63 | # welcome! 64 | hash ponysay &>/dev/null && ponysay -o 65 | 66 | test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" 67 | 68 | export PATH="$HOME/.yarn/bin:$PATH" 69 | 70 | export NVM_DIR="/Users/remy/.nvm" 71 | # nvm is loaded in .zshenv 72 | # [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm 73 | 74 | [ -f ~/.quitcd.zsh ] && source ~/.quitcd.zsh 75 | [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh 76 | 77 | export FZF_DEFAULT_OPTS="--bind='ctrl-o:execute(code {})+abort'" 78 | export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git' 79 | 80 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Remy's (mac) dotfiles 2 | 3 | ![Screenshot of my shell prompt](https://cldup.com/Q4Z5Vek_XD.png) 4 | 5 | ## ⚠ WARNING ⚠ 6 | 7 | These dotfiles still need work to complete an automatic installation. Use at your own risk (I do...). 8 | 9 | I'm also using these on a Mac (and have tried with varying degrees of success on linux), so your milage may vary... 10 | 11 | ## Installation 12 | 13 | **Warning:** If you want to give these dotfiles a try, you should first fork this repository, review the code, and remove things you don’t want or need. Don’t blindly use my settings unless you know what that entails. Use at your own risk! 14 | 15 | ### Using Git and the bootstrap script 16 | 17 | You can clone the repository wherever you want. (I keep mine in `~/dotfiles`). The bootstrapper script will pull in the latest version and copy the files to your home folder. 18 | 19 | ```bash 20 | git clone https://github.com/remy/dotfiles.git && cd dotfiles && source bootstrap.sh 21 | ``` 22 | 23 | To update, `cd` into your local `dotfiles` repository and then: 24 | 25 | ```bash 26 | source bootstrap.sh 27 | ``` 28 | 29 | Alternatively, to update while avoiding the confirmation prompt: 30 | 31 | ```bash 32 | set -- -f; source bootstrap.sh 33 | ``` 34 | 35 | ### Git-free install 36 | 37 | To install these dotfiles without Git: 38 | 39 | ```bash 40 | cd; curl -#L https://github.com/remy/dotfiles/tarball/master | tar -xzv --strip-components 1 --exclude={README.md,bootstrap.sh,LICENSE} 41 | ``` 42 | 43 | To update later on, just run that command again. 44 | 45 | ### Specify the `$PATH` 46 | 47 | Because the `:` split thing in `.path` files is a PITA, I've got a script that reads each line from `.paths`. The `.paths` file supports comments, so you can read mine and see how it's just a list of directories. 48 | 49 | That list is then compiled and exported via `$PATH`. 50 | 51 | ### Add custom commands without creating a new fork 52 | 53 | If `~/.extra` exists, it will be sourced along with the other files. You can use this to add a few custom commands without the need to fork this entire repository, or to add commands you don’t want to commit to a public repository. 54 | 55 | My `~/.extra` looks something like this: 56 | 57 | ```bash 58 | # Git credentials 59 | # Not in the repository, to prevent people from accidentally committing under my name 60 | GIT_AUTHOR_NAME="Remy Sharp" 61 | GIT_AUTHOR_EMAIL="remy@remysharp.com" 62 | git config --global github.user "remy" 63 | GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" 64 | git config --global user.name "$GIT_AUTHOR_NAME" 65 | GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL" 66 | git config --global user.email "$GIT_AUTHOR_EMAIL" 67 | ``` 68 | 69 | You could also use `~/.extra` to override settings, functions and aliases from my dotfiles repository. It’s probably better to [fork this repository](https://github.com/remy/dotfiles/fork) instead, though. 70 | 71 | ### Sensible OS X defaults 72 | 73 | When setting up a new Mac, you may want to set some sensible OS X defaults: 74 | 75 | ```bash 76 | ./.osx 77 | ``` 78 | 79 | ### Installing apps 80 | 81 | When setting up a new Mac, you may want to install some common [Homebrew](http://brew.sh/) formulae (after installing Homebrew, of course): 82 | 83 | ```bash 84 | ./apps.sh 85 | ``` 86 | 87 | I've also included my default global npm packages, which is installed via 88 | 89 | ```bash 90 | ./npm.sh 91 | ``` 92 | 93 | ## Feedback 94 | 95 | Suggestions/improvements 96 | [welcome](https://github.com/remy/dotfiles/issues)! 97 | 98 | ## Author 99 | 100 | - [Remy Sharp](https://remysharp.com/) 101 | 102 | Large amounts taken directly from [Mathias Bynens](https://mathiasbynens.be/)' [dotfiles repo](https://github.com/mathiasbynens/dotfiles) ❤ 103 | 104 | ## Thanks to... 105 | 106 | * @ptb and [his _OS X Lion Setup_ repository](https://github.com/ptb/Mac-OS-X-Lion-Setup) 107 | * [Ben Alman](http://benalman.com/) and his [dotfiles repository](https://github.com/cowboy/dotfiles) 108 | * [Chris Gerke](http://www.randomsquared.com/) and his [tutorial on creating an OS X SOE master image](http://chris-gerke.blogspot.com/2012/04/mac-osx-soe-master-image-day-7.html) + [_Insta_ repository](https://github.com/cgerke/Insta) 109 | * [Cătălin Mariș](https://github.com/alrra) and his [dotfiles repository](https://github.com/alrra/dotfiles) 110 | * [Gianni Chiappetta](http://gf3.ca/) for sharing his [amazing collection of dotfiles](https://github.com/gf3/dotfiles) 111 | * [Jan Moesen](http://jan.moesen.nu/) and his [ancient `.bash_profile`](https://gist.github.com/1156154) + [shiny _tilde_ repository](https://github.com/janmoesen/tilde) 112 | * [Lauri ‘Lri’ Ranta](http://lri.me/) for sharing [loads of hidden preferences](http://osxnotes.net/defaults.html) 113 | * [Matijs Brinkhuis](http://hotfusion.nl/) and his [dotfiles repository](https://github.com/matijs/dotfiles) 114 | * [Nicolas Gallagher](http://nicolasgallagher.com/) and his [dotfiles repository](https://github.com/necolas/dotfiles) 115 | * [Sindre Sorhus](http://sindresorhus.com/) 116 | * [Tom Ryder](http://blog.sanctum.geek.nz/) and his [dotfiles repository](https://github.com/tejr/dotfiles) 117 | * [Kevin Suttle](http://kevinsuttle.com/) and his [dotfiles repository](https://github.com/kevinSuttle/dotfiles) and [OSXDefaults project](https://github.com/kevinSuttle/OSXDefaults), which aims to provide better documentation for [`~/.osx`](https://mths.be/osx) 118 | * [Haralan Dobrev](http://hkdobrev.com/) 119 | * anyone who [contributed a patch](https://github.com/mathiasbynens/dotfiles/contributors) or [made a helpful suggestion](https://github.com/mathiasbynens/dotfiles/issues) 120 | -------------------------------------------------------------------------------- /apps.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | inquire () { 4 | echo -n "$1 [y/n]? " 5 | read answer 6 | finish="-1" 7 | while [ "$finish" = '-1' ] 8 | do 9 | finish="1" 10 | if [ "$answer" = '' ]; 11 | then 12 | answer="" 13 | else 14 | case $answer in 15 | y | Y | yes | YES ) answer="y";; 16 | n | N | no | NO ) answer="n";; 17 | *) finish="-1"; 18 | echo -n 'Invalid response -- please reenter:'; 19 | read answer;; 20 | esac 21 | fi 22 | done 23 | } 24 | 25 | # Install command-line tools using Homebrew. 26 | 27 | # Ask for the administrator password upfront. 28 | sudo -v 29 | 30 | # Keep-alive: update existing `sudo` time stamp until the script has finished. 31 | while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 32 | 33 | echo "Installing homebrew first" 34 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 35 | 36 | # Make sure we’re using the latest Homebrew. 37 | brew update 38 | 39 | # Upgrade any already-installed formulae. 40 | brew upgrade --all 41 | 42 | # Install GNU core utilities (those that come with OS X are outdated). 43 | # Don’t forget to add `$(brew --prefix coreutils)/libexec/gnubin` to `$PATH`. 44 | brew install coreutils 45 | sudo ln -s /usr/local/bin/gsha256sum /usr/local/bin/sha256sum 46 | 47 | # Install some other useful utilities like `sponge`. 48 | brew install moreutils 49 | # Install GNU `find`, `locate`, `updatedb`, and `xargs`, `g`-prefixed. 50 | brew install findutils 51 | # Install GNU `sed`, overwriting the built-in `sed`. 52 | brew install gnu-sed --with-default-names 53 | # Install Bash 4. 54 | # Note: don’t forget to add `/usr/local/bin/bash` to `/etc/shells` before 55 | # running `chsh`. 56 | #brew install bash 57 | brew tap homebrew/versions 58 | #brew install bash-completion2 59 | 60 | 61 | # rem specific stuff, and yeah, ponysay is important. 62 | brew install ponysay 63 | brew install ripgrep 64 | brew install diff-so-fancy 65 | brew install httpie 66 | brew install memcached 67 | brew install mongodb 68 | brew install pstree 69 | brew install watch 70 | brew install prettyping 71 | brew install tldr 72 | brew install bat 73 | brew install fzf 74 | brew install htop 75 | brew install fd 76 | brew install jq 77 | brew install ack 78 | brew install the_silver_searcher 79 | brew install moreutils 80 | sudo pip install csvkit # not really brew, but … meh 81 | brew install noti 82 | brew install entr 83 | 84 | 85 | ## now here be the stuff I copied and, if I'm honest, not 100% sure about! 86 | 87 | 88 | # Install `wget` with IRI support. 89 | brew install wget --with-iri 90 | 91 | # Install more recent versions of some OS X tools. 92 | brew install vim --override-system-vi 93 | brew install homebrew/dupes/grep 94 | brew install homebrew/dupes/openssh 95 | brew install homebrew/dupes/screen 96 | brew install homebrew/php/php56 --with-gmp 97 | 98 | # Install font tools. 99 | brew tap bramstein/webfonttools 100 | brew install sfnt2woff 101 | brew install sfnt2woff-zopfli 102 | brew install woff2 103 | 104 | # Install some CTF tools; see https://github.com/ctfs/write-ups. 105 | brew install aircrack-ng 106 | brew install bfg 107 | brew install binutils 108 | brew install cifer 109 | brew install dex2jar 110 | brew install dns2tcp 111 | brew install fcrackzip 112 | brew install hashpump 113 | brew install hydra 114 | brew install john 115 | brew install netpbm 116 | brew install nmap 117 | brew install pngcheck 118 | brew install socat 119 | brew install sqlmap 120 | brew install tcpflow 121 | brew install tcpreplay 122 | brew install tcptrace 123 | brew install ucspi-tcp # `tcpserver` etc. 124 | brew install xpdf 125 | brew install xz 126 | 127 | # quickview stuff 128 | brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv qlimagesize webpquicklook suspicious-package 129 | 130 | # Install other useful binaries. 131 | brew install ack 132 | brew install git 133 | brew install git-lfs 134 | brew install imagemagick --with-webp 135 | brew install lua 136 | brew install lynx 137 | brew install p7zip 138 | brew install pigz 139 | brew install pv 140 | brew install rename 141 | brew install speedtest_cli 142 | brew install ssh-copy-id 143 | brew install tree 144 | brew install webkit2png 145 | brew install zopfli 146 | 147 | # eeprom programmer 148 | brew install minipro 149 | 150 | # samsung screen control 151 | brew cask install monitorcontrol 152 | 153 | 154 | # install zsh and add remy's zsh theme: https://remysharp.com/2013/07/25/my-terminal-setup 155 | brew install zsh zsh-completions 156 | curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh 157 | # put the original .zshrc back 158 | mv .zshrc.pre-oh-my-zsh .zshrc 159 | # make zsh default 160 | chsh -s /bin/zsh 161 | 162 | # Remove outdated versions from the cellar. 163 | brew cleanup 164 | -------------------------------------------------------------------------------- /bin/bash: -------------------------------------------------------------------------------- 1 | /usr/local/opt/bash/bin/bash -------------------------------------------------------------------------------- /bin/batcharge.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # coding=UTF-8 3 | 4 | import math, subprocess 5 | import sys 6 | 7 | p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE) 8 | output = p.communicate()[0] 9 | 10 | o_max = [l for l in output.splitlines() if 'MaxCapacity' in l][0] 11 | o_cur = [l for l in output.splitlines() if 'CurrentCapacity' in l][0] 12 | 13 | b_max = float(o_max.rpartition('=')[-1].strip()) 14 | b_cur = float(o_cur.rpartition('=')[-1].strip()) 15 | 16 | charge = b_cur / b_max 17 | charge_threshold = int(math.ceil(10 * charge)) 18 | 19 | icons = ["", "", "", "", "", "", "", "", "", "", ""]; 20 | 21 | 22 | 23 | # Output 24 | 25 | total_slots, slots = 10, [] 26 | filled = int(math.ceil(charge_threshold * (total_slots / 10.0))) 27 | 28 | # * u'■' #◼ 29 | # old arrow: ▹▸▶ 30 | empty = (total_slots - filled) * u'□' #◻ 31 | 32 | # out = (filled + empty).encode('utf-8') 33 | out = icons[filled] 34 | 35 | color_green = '%{%}' 36 | color_yellow = '%{%}' 37 | color_red = '%{%}' 38 | color_reset = '%{%}' 39 | color_out = ( 40 | color_green if filled > 6 41 | else color_yellow if filled > 3 42 | else color_red 43 | ) 44 | 45 | out = color_out + out + color_reset 46 | sys.stdout.write(out) 47 | -------------------------------------------------------------------------------- /bin/check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # version 1.1.1 4 | 5 | set -e 6 | 7 | function cleanup { 8 | for pid in "${PIDS[@]}" 9 | do 10 | kill -0 $pid 2&> /dev/null && kill $pid 11 | done 12 | exit 0 13 | } 14 | 15 | function position { 16 | # based on a script from http://invisible-island.net/xterm/xterm.faq.html 17 | exec < /dev/tty 18 | oldstty=$(stty -g) 19 | stty raw -echo min 0 20 | 21 | # on my system, the following line can be replaced by the line below it 22 | # echo -en "\033[6n" > /dev/tty 23 | tput u7 > /dev/tty # when TERM=xterm (and relatives) 24 | IFS=';' read -r -d R -a pos 25 | stty $oldstty 26 | 27 | # change from one-based to zero based so they work with: tput cup $row $col 28 | row=$((${pos[0]:2} - 1)) # strip off the esc-[ 29 | col=$((${pos[1]} - 1)) 30 | 31 | echo "$row" 32 | } 33 | 34 | function monitor { 35 | local url=$1 36 | local p=$((START_CURSOR+$2+1)) 37 | 38 | # -w "$GREEN%{http_code}$RESET $url \\033[${p};${TIMING_COL}f%{time_total}s TTFB: %{time_connect} + %{time_starttransfer} (%{size_download})" \ 39 | 40 | echo -e "\033[${p};0f$(curl ${CURL_ARGS} $url --compress -s -o /dev/null -w \ 41 | "%{http_code}|%{time_total}|%{time_pretransfer}|%{time_starttransfer}\n"\ 42 | | sed -n '/^/ s///p' \ 43 | | while IFS='|' read http_code time_total time_pretransfer time_starttransfer; 44 | do 45 | if [[ $http_code > 399 ]]; then 46 | http_code="$RED$http_code$RESET" 47 | else 48 | http_code="$GREEN$http_code$RESET" 49 | fi 50 | TTFB=$(echo -e "$time_starttransfer $time_pretransfer" | awk '{ printf "%.3fs", $1 - $2 }') 51 | echo -e "$http_code $url \\033[${p};${TIMING_COL}f${time_total}s (TTFB $TTFB)" 52 | done)\n\033[${LAST_CURSOR};0f" & 53 | 54 | PIDS=("${PIDS[@]}" "$!") 55 | } 56 | 57 | declare -a PIDS 58 | RED="\033[31m" 59 | RESET="\033[0m" 60 | GREEN="\033[32m" 61 | START_CURSOR=$(position) 62 | LAST_CURSOR=0 63 | TIMING_COL=0 64 | CURL_ARGS="" 65 | declare -a URLS 66 | 67 | if [ -t 0 ]; then # nothing on stdin 68 | if [ $# -eq 0 ] # if arg count is 0 - then error 69 | then 70 | echo -e "Usage:\n\n ${RED}check${RESET} \n cat urls.txt | \033[1mcheck${RESET}\n" 71 | exit 1 72 | fi 73 | else 74 | while read line # from stdin 75 | do 76 | URLS=("${URLS[@]}" $line) 77 | done 78 | fi 79 | 80 | # then double check the arguments on the command line 81 | for ((i=0 ; i < $# ; i++)) # read each url individually 82 | do 83 | if [ "$1" = "--" ] # if "end of options" 84 | then 85 | shift 86 | CURL_ARGS=$@ # the pass along the options to cURL 87 | break 88 | fi 89 | if [ -n "$1" ] 90 | then 91 | URLS=("${URLS[@]}" $1) 92 | fi 93 | shift 94 | done 95 | 96 | trap cleanup EXIT # so that we can put cURL in the background, but wait until it's finished 97 | 98 | for url in "${URLS[@]}" 99 | do 100 | length=${#url} 101 | if [[ $length > $TIMING_COL ]]; then TIMING_COL=$length; fi 102 | echo -e "... $url" 103 | done 104 | 105 | TIMING_COL=$(( $TIMING_COL + 6)) 106 | LAST_CURSOR=$(position) 107 | 108 | if [[ $LAST_CURSOR == $(( $(tput lines) - 1 )) ]] 109 | then 110 | START_CURSOR=$(( LAST_CURSOR - ${#URLS[@]})) 111 | fi 112 | 113 | for index in "${!URLS[@]}" 114 | do 115 | monitor ${URLS[index]} $index 116 | done 117 | 118 | wait ${PIDS[@]} 119 | -------------------------------------------------------------------------------- /bin/dev.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -o errexit 4 | set -e 5 | 6 | # Fail fast if we're not on OS X >= 10.6.0. 7 | 8 | if [ "$(uname -s)" != "Darwin" ]; then 9 | echo "Sorry, DEV requires Mac OS X to run." >&2 10 | exit 1 11 | fi 12 | 13 | # Fail if we don't have Homebrew or MacPorts installed 14 | 15 | if ! command -v brew >/dev/null 2>&1 && ! command -v port >/dev/null 2>&1; then 16 | echo "Sorry, DEV requires Homebrew or MacPorts to run." 17 | exit 1 18 | fi 19 | 20 | echo "***********************************" 21 | echo "Installing .dev" 22 | echo "***********************************" 23 | 24 | # Install using Homebrew 25 | 26 | if command -v brew >/dev/null 2>&1; then 27 | 28 | echo "*** Installing dnsmasq with Homebrew..." 29 | brew install dnsmasq 30 | 31 | echo "*** Configurating dnsmasq..." 32 | echo 'address=/.dev/127.0.0.1' > $(brew --prefix)/etc/dnsmasq.conf 33 | 34 | echo "*** Installing dnsmasq into LaunchDaemons..." 35 | sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons 36 | sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist 37 | 38 | else # Install using MacPorts 39 | 40 | MACPORTSDIR=/opt/local 41 | 42 | if [ ! -d $MACPORTSDIR ]; then 43 | echo "Sorry, $MACPORTSDIR doesn't seem to exist. Please set MACPORTSDIR in this script." 44 | exit 1 45 | fi 46 | 47 | echo "*** Installing dnsmasq with MacPorts..." 48 | sudo port install dnsmasq 49 | 50 | echo "*** Configurating dnsmasq..." 51 | sudo bash -c 'echo "address=/.dev/127.0.0.1" > $MACPORTSDIR/etc/dnsmasq.conf' 52 | 53 | echo "*** Installing dnsmasq into LaunchDaemons..." 54 | sudo port load dnsmasq 55 | 56 | fi 57 | 58 | echo "*** Registerering .dev into /etc/resolver..." 59 | [ -d /etc/resolver ] || sudo mkdir -v /etc/resolver 60 | sudo bash -c 'echo "nameserver 127.0.0.1\n" > /etc/resolver/dev' 61 | 62 | echo 'Running self-check to see if .dev is working' 63 | if ping -oc 100 'kenneth.dev' > /dev/null; then 64 | echo "*** Everything looks good. Enjoy the ride!" 65 | else 66 | echo "*** Sorrrry. Something went wrong. Don't blame me." 67 | fi 68 | 69 | echo 'Done. Im getting out of there.' 70 | -------------------------------------------------------------------------------- /bin/git-delete-merge-branches: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | branches_to_die=$(git branch --no-color --merged origin/master | grep -v '^[\* ] master') 4 | echo "Branches to be deleted:" 5 | echo $branches_to_die 6 | 7 | echo "" 8 | echo "Enter Y to confirm" 9 | read -p "> " confirm 10 | 11 | 12 | kill_branches(){ 13 | echo $branches_to_die | xargs -n 1 git branch -d 14 | } 15 | 16 | 17 | [[ $confirm == "Y" ]] && kill_branches -------------------------------------------------------------------------------- /bin/httpcompression: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # DESCRIPTION: 4 | # 5 | # Provides the content encoding the specified 6 | # resources are served with. 7 | # 8 | # USAGE: 9 | # 10 | # httpcompression URL ... 11 | # 12 | # USEFUL LINKS: 13 | # 14 | # * HTTP/1.1 (RFC 2616) - Content-Encoding 15 | # https://tools.ietf.org/html/rfc2616#section-14.11 16 | # 17 | # * SDCH Specification: 18 | # https://lists.w3.org/Archives/Public/ietf-http-wg/2008JulSep/att-0441/Shared_Dictionary_Compression_over_HTTP.pdf 19 | 20 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 21 | 22 | declare -r -a CURL_DEFAULT_OPTIONS=( 23 | --connect-timeout 30 24 | --header "Accept-Encoding: br, lzma, gzip, deflate, sdch" 25 | --header "Cache-Control: no-cache" # Prevent intermediate proxies 26 | # from caching the response 27 | 28 | --location # If the page was moved to a 29 | # different location, redo the 30 | # request 31 | --max-time 150 32 | --show-error 33 | --silent 34 | --user-agent "Mozilla/5.0 Gecko" # Send a fake UA string for sites 35 | # that sniff it instead of using 36 | # the Accept-Encoding header 37 | ) 38 | 39 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 40 | 41 | check_for_sdch() { 42 | 43 | declare availDicts="" 44 | declare currentHeaders="$1" 45 | declare dict="" 46 | declare dictClientID="" 47 | declare dicts="" 48 | declare i="" 49 | declare url="$2" 50 | 51 | # Check if the server advertised any dictionaries 52 | dicts="$( printf "%s" "$currentHeaders" | 53 | grep -i 'Get-Dictionary:' | 54 | cut -d':' -f2 | 55 | sed s/,/\ /g )" 56 | 57 | # If it does, check to see if it really supports SDCH 58 | if [ -n "$dicts" ]; then 59 | for i in $dicts; do 60 | 61 | dict="" 62 | 63 | # Check if the dictionary location is specified as a path, 64 | # and if it is, construct it's URL from the host name of the 65 | # referrer URL 66 | 67 | [[ "$i" != http* ]] \ 68 | && dict="$( printf "%s" "$url" | 69 | sed -En 's/([^/]*\/\/)?([^/]*)\/?.*/\1\2/p' )" 70 | 71 | dict="$dict$i" 72 | 73 | # Request the dictionaries from the server and 74 | # construct the `Avail-Dictionary` header value 75 | # 76 | # [ The user agent identifier for a dictionary is defined 77 | # as the URL-safe base64 encoding (as described in RFC 78 | # 3548, section 4 [RFC3548]) of the first 48 bits (bits 79 | # 0..47) of the dictionary's SHA-256 digest ] 80 | 81 | dictClientID="$( curl "${CURL_DEFAULT_OPTIONS[@]}" "$dict" | 82 | openssl dgst -sha256 -binary | 83 | openssl base64 | 84 | cut -c 1-8 | 85 | sed -e 's/\+/-/' -e 's/\//_/' )" 86 | 87 | [ -n "$availDicts" ] && availDicts="$availDicts,$dictClientID" \ 88 | || availDicts="$dictClientID" 89 | 90 | done 91 | 92 | # Redo the request (advertising the available dictionaries) 93 | # and replace the old resulted headers with the new ones 94 | 95 | printf "$( curl "${CURL_DEFAULT_OPTIONS[@]}" \ 96 | -H "Avail-Dictionary: $availDicts" \ 97 | --dump-header - \ 98 | --output /dev/null \ 99 | "$url" )" 100 | 101 | else 102 | printf "%s" "$currentHeaders" 103 | fi 104 | } 105 | 106 | get_content_encoding() { 107 | 108 | declare currentHeaders="" 109 | declare encoding="" 110 | declare headers="" 111 | declare indent="" 112 | declare tmp="" 113 | declare url="$1" 114 | 115 | headers="$(curl "${CURL_DEFAULT_OPTIONS[@]}" \ 116 | --dump-header - \ 117 | --output /dev/null \ 118 | "$url" )" \ 119 | && ( \ 120 | 121 | # Iterate over the headers of all redirects 122 | while [ -n "$headers" ]; do 123 | 124 | # Get headers for the "current" URL 125 | currentHeaders="$( printf "%s" "$headers" | sed -n '1,/^HTTP/p' )" 126 | 127 | # Remove the headers for the "current" URL 128 | headers="${headers/"$currentHeaders"/}" 129 | 130 | currentHeaders="$(check_for_sdch "$currentHeaders" "$url")" 131 | 132 | # Get the value of the `Content-Encoding` header 133 | encoding="$( printf "%s" "$currentHeaders" | 134 | grep -i 'Content-Encoding:' | 135 | cut -d' ' -f2 | 136 | tr "\r" "," | 137 | tr -d "\n" | 138 | sed 's/,$//' )" 139 | 140 | # Print the output for the "current" URL 141 | [ -n "$encoding" ] && encoding="[$encoding]" 142 | 143 | if [ "$url" != "$1" ]; then 144 | printf "$indent$url $encoding\n" 145 | indent=" $indent" 146 | else 147 | printf "\n * $1 $encoding\n" 148 | indent=" ↳ " 149 | fi 150 | 151 | # Get the next URL from the series of redirects 152 | tmp="$url" 153 | url="$( printf "%s" "$currentHeaders" | 154 | grep -i 'Location' | 155 | sed -e 's/Location://' | 156 | sed 's/^ *//' | 157 | tr -d '\r' )" 158 | 159 | # In case the `Location` header is specified as a path 160 | [[ "$url" != http* ]] && url="$tmp$url" 161 | 162 | done 163 | ) 164 | } 165 | 166 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 167 | 168 | main() { 169 | 170 | # Check if cURL is installed 171 | if [ -x "$(command -v "curl")" ]; then 172 | while [ $# -ne 0 ]; do 173 | get_content_encoding "$1" 174 | shift 175 | done 176 | printf "\n" 177 | else 178 | printf "cURL is required, please install it!\n" 179 | fi 180 | 181 | } 182 | 183 | main $@ 184 | -------------------------------------------------------------------------------- /bin/node: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -z "$npm_package_engines_node" ]; then 4 | $_NODE $@ 5 | else 6 | source $HOME/.nvm/nvm.sh --no-use 7 | nvm exec $npm_package_engines_node node $@ 8 | fi 9 | -------------------------------------------------------------------------------- /bin/online-check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | offline=`dig 8.8.8.8 +time=1 +short google.com A | grep -c "no servers could be reached"` 4 | if [[ "$offline" == "0" ]]; then 5 | rm ~/.offline 2&> /dev/null 6 | else 7 | touch ~/.offline 8 | fi 9 | -------------------------------------------------------------------------------- /bin/ssl-cert.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Specify where we will install 4 | # the $DOMAIN certificate 5 | SSL_DIR="$HOME/certs" 6 | 7 | # Set the wildcarded domain 8 | # we want to use 9 | DOMAIN=$1 10 | 11 | # A blank passphrase 12 | PASSPHRASE="" 13 | 14 | # Set our CSR variables 15 | SUBJ=" 16 | C=GB 17 | ST=Brighton 18 | O= 19 | localityName=Brighton 20 | commonName=*.$DOMAIN 21 | organizationalUnitName= 22 | emailAddress=" 23 | 24 | # Create our SSL directory 25 | # in case it doesn't exist 26 | sudo mkdir -p "$SSL_DIR" 27 | 28 | # Generate our Private Key, CSR and Certificate 29 | sudo openssl genrsa -out "$SSL_DIR/$DOMAIN.key" 2048 30 | sudo openssl req -new -subj "$(echo "$SUBJ" | tr "\n" "/")" -key "$SSL_DIR/$DOMAIN.key" -out "$SSL_DIR/$DOMAIN.csr" -passin pass:$PASSPHRASE 31 | sudo openssl x509 -req -days 365 -in "$SSL_DIR/$DOMAIN.csr" -signkey "$SSL_DIR/$DOMAIN.key" -out "$SSL_DIR/$DOMAIN.crt" 32 | -------------------------------------------------------------------------------- /bin/subl: -------------------------------------------------------------------------------- 1 | /Applications/Sublime Text.app/Contents/SharedSupport/bin/subl -------------------------------------------------------------------------------- /bin/toggle: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ $DARK = "true" ]]; then 4 | echo "light theme" 5 | export DARK="false" 6 | else 7 | echo "dark theme" 8 | export DARK="true" 9 | fi 10 | 11 | source ~/.oh-my-zsh/themes/remy.zsh-theme -------------------------------------------------------------------------------- /bin/view-md: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'tty-markdown' 4 | 5 | puts TTY::Markdown.parse(ARGF.read, colors: 256) 6 | -------------------------------------------------------------------------------- /bin/wifi-password: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | version="0.1.0" 4 | 5 | # locate airport(1) 6 | airport="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport" 7 | if [ ! -f $airport ]; then 8 | echo "ERROR: Can't find \`airport\` CLI program at \"$airport\"." 9 | exit 1 10 | fi 11 | 12 | # by default we are verbose (unless non-tty) 13 | if [ -t 1 ]; then 14 | verbose=1 15 | else 16 | verbose= 17 | fi 18 | 19 | # usage info 20 | usage() { 21 | cat <&2 64 | exit 1 65 | fi 66 | fi 67 | 68 | # warn user about keychain dialog 69 | if [ $verbose ]; then 70 | echo "" 71 | echo "\033[90m … getting password for \"$ssid\". \033[39m" 72 | echo "\033[90m … keychain prompt incoming. \033[39m" 73 | fi 74 | 75 | sleep 2 76 | 77 | # source: http://blog.macromates.com/2006/keychain-access-from-shell/ 78 | pwd="`security find-generic-password -ga \"$ssid\" 2>&1 >/dev/null`" 79 | 80 | if [[ $pwd =~ "could" ]]; then 81 | echo "ERROR: Could not find SSID \"$ssid\"" >&2 82 | exit 1 83 | fi 84 | 85 | # clean up password 86 | pwd=$(echo "$pwd" | sed -e "s/^.*\"\(.*\)\".*$/\1/") 87 | 88 | if [ "" == "$pwd" ]; then 89 | echo "ERROR: Could not get password. Did you enter your Keychain credentials?" >&2 90 | exit 1 91 | fi 92 | 93 | # print 94 | if [ $verbose ]; then 95 | echo "\033[96m ✓ \"$pwd\" \033[39m" 96 | echo "" 97 | else 98 | echo $pwd 99 | fi -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd "$(dirname "${BASH_SOURCE}")"; 4 | 5 | git pull origin master; 6 | 7 | function doIt() { 8 | rsync --exclude ".git/" --exclude ".DS_Store" --exclude "bootstrap.sh" \ 9 | --exclude "README.md" --exclude "LICENSE" -avh --no-perms . ~; 10 | source ~/.bash_profile; 11 | } 12 | 13 | if [ "$1" == "--force" -o "$1" == "-f" ]; then 14 | doIt; 15 | else 16 | read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1; 17 | echo ""; 18 | if [[ $REPLY =~ ^[Yy]$ ]]; then 19 | doIt; 20 | fi; 21 | fi; 22 | unset doIt; 23 | -------------------------------------------------------------------------------- /init/Preferences.sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | "added_words": 3 | [ 4 | "admin", 5 | "Google", 6 | "Google's", 7 | "phishing", 8 | "phish", 9 | "remediation", 10 | "remediated", 11 | "snyk", 12 | "npm", 13 | "nodejs", 14 | "auth", 15 | "workflow", 16 | "transpiles", 17 | "transpile", 18 | "transpiler", 19 | "devtools", 20 | "savvy", 21 | "screenshot", 22 | "fullscreen", 23 | "hotkey", 24 | "uncheck", 25 | "app", 26 | "shortcut", 27 | "online", 28 | "blogs", 29 | "Photoshop", 30 | "filename", 31 | "timestamp", 32 | "shortcuts" 33 | ], 34 | "color_scheme": "Packages/User/SublimeLinter/cobalt2 (SL).tmTheme", 35 | "dictionary": "Packages/Language - English/en_GB.dic", 36 | "file_exclude_patterns": 37 | [ 38 | "*.map", 39 | ".DS_Store" 40 | ], 41 | "folder_exclude_patterns": 42 | [ 43 | ".nyc_output", 44 | "node_modules", 45 | "bower_components", 46 | "coverage", 47 | "public/js/prod", 48 | "vendor", 49 | "www", 50 | ".sass-cache", 51 | ".git" 52 | ], 53 | "font_face": "Menlo for Powerline", 54 | "font_options": 55 | [ 56 | "gray_antialias" 57 | ], 58 | "font_size": 15, 59 | "highlight_line": true, 60 | "ignored_packages": 61 | [ 62 | ], 63 | "line_padding_bottom": 1, 64 | "line_padding_top": 1, 65 | "rulers": 66 | [ 67 | 80 68 | ], 69 | "tab_size": 2, 70 | "theme": "Cobalt2.sublime-theme", 71 | "translate_tabs_to_spaces": true, 72 | "trim_trailing_white_space_on_save": true, 73 | "use_tab_stops": false, 74 | "vintage_start_in_command_mode": false, 75 | "word_wrap": true 76 | } 77 | -------------------------------------------------------------------------------- /init/Solarized Dark xterm-256color.terminal: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BackgroundColor 6 | 7 | YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 8 | AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECgw 9 | LjAxNTkyNDQwNTMxIDAuMTI2NTIwOTE2OCAwLjE1OTY5NjAxMjcAEAGAAtIQERITWiRj 10 | bGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVjdF8QD05TS2V5ZWRBcmNo 11 | aXZlctEXGFRyb290gAEIERojLTI3O0FITltijY+RlqGqsrW+0NPYAAAAAAAAAQEAAAAA 12 | AAAAGQAAAAAAAAAAAAAAAAAAANo= 13 | 14 | BlinkText 15 | 16 | CursorColor 17 | 18 | YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 19 | AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw 20 | LjQ0MDU4MDI0ODggMC41MDk2MjkzMDkyIDAuNTE2ODU3OTgxNwAQAYAC0hAREhNaJGNs 21 | YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp 22 | dmVy0RcYVHJvb3SAAQgRGiMtMjc7QUhOW2KMjpCVoKmxtL3P0tcAAAAAAAABAQAAAAAA 23 | AAAZAAAAAAAAAAAAAAAAAAAA2Q== 24 | 25 | Font 26 | 27 | YnBsaXN0MDDUAQIDBAUGGBlYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 28 | AAGGoKQHCBESVSRudWxs1AkKCwwNDg8QVk5TU2l6ZVhOU2ZGbGFnc1ZOU05hbWVWJGNs 29 | YXNzI0AqAAAAAAAAEBCAAoADXU1lbmxvLVJlZ3VsYXLSExQVFlokY2xhc3NuYW1lWCRj 30 | bGFzc2VzVk5TRm9udKIVF1hOU09iamVjdF8QD05TS2V5ZWRBcmNoaXZlctEaG1Ryb290 31 | gAEIERojLTI3PEJLUltiaXJ0dniGi5afpqmyxMfMAAAAAAAAAQEAAAAAAAAAHAAAAAAA 32 | AAAAAAAAAAAAAM4= 33 | 34 | FontAntialias 35 | 36 | FontHeightSpacing 37 | 1.1000000000000001 38 | FontWidthSpacing 39 | 1 40 | ProfileCurrentVersion 41 | 2.02 42 | SelectionColor 43 | 44 | YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 45 | AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECgw 46 | LjAzOTM4MDczNjY1IDAuMTYwMTE2NDYzOSAwLjE5ODMzMjc1NjgAEAGAAtIQERITWiRj 47 | bGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVjdF8QD05TS2V5ZWRBcmNo 48 | aXZlctEXGFRyb290gAEIERojLTI3O0FITltijY+RlqGqsrW+0NPYAAAAAAAAAQEAAAAA 49 | AAAAGQAAAAAAAAAAAAAAAAAAANo= 50 | 51 | ShowWindowSettingsNameInTitle 52 | 53 | TerminalType 54 | xterm-256color 55 | TextBoldColor 56 | 57 | YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 58 | AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECYw 59 | LjUwNTk5MTkzNTcgMC41NjQ4NTgzNzcgMC41NjM2MzY1NDE0ABABgALSEBESE1okY2xh 60 | c3NuYW1lWCRjbGFzc2VzV05TQ29sb3KiEhRYTlNPYmplY3RfEA9OU0tleWVkQXJjaGl2 61 | ZXLRFxhUcm9vdIABCBEaIy0yNztBSE5bYouNj5SfqLCzvM7R1gAAAAAAAAEBAAAAAAAA 62 | ABkAAAAAAAAAAAAAAAAAAADY 63 | 64 | TextColor 65 | 66 | YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS 67 | AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw 68 | LjQ0MDU4MDI0ODggMC41MDk2MjkzMDkyIDAuNTE2ODU3OTgxNwAQAYAC0hAREhNaJGNs 69 | YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp 70 | dmVy0RcYVHJvb3SAAQgRGiMtMjc7QUhOW2KMjpCVoKmxtL3P0tcAAAAAAAABAQAAAAAA 71 | AAAZAAAAAAAAAAAAAAAAAAAA2Q== 72 | 73 | UseBrightBold 74 | 75 | blackColour 76 | 77 | BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm 78 | ZmZmg7JNIT2DkvUjPoO+F0s+AYY= 79 | 80 | blueColour 81 | 82 | BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm 83 | ZmZmgyqcAj6DtOHsPoO+RUg/AYY= 84 | 85 | brightBlackColour 86 | 87 | BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm 88 | ZmZmg+ZzgjyDs44BPoNahyM+AYY= 89 | 90 | brightBlueColour 91 | 92 | BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm 93 | ZmZmg7yT4T6DEXcCP4POUAQ/AYY= 94 | 95 | brightCyanColour 96 | 97 | BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm 98 | ZmZmg7CIAT+Dj5oQP4N8ShA/AYY= 99 | 100 | brightGreenColour 101 | 102 | BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm 103 | ZmZmgzyujT6DFZy2PoOYFsQ+AYY= 104 | 105 | brightMagentaColour 106 | 107 | BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm 108 | ZmZmgxMjsj6D+uazPoNkyTc/AYY= 109 | 110 | brightRedColour 111 | 112 | BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm 113 | ZmZmgyfkPT+D/15aPoMgl5Y9AYY= 114 | 115 | brightWhiteColour 116 | 117 | BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm 118 | ZmZmg49LfT+D0Dt1P4MGM10/AYY= 119 | 120 | brightYellowColour 121 | 122 | BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm 123 | ZmZmg1MTpj6DeHnQPoPQg+A+AYY= 124 | 125 | cyanColour 126 | 127 | BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm 128 | ZmZmg4VRFj6DfyESP4PkZwY/AYY= 129 | 130 | greenColour 131 | 132 | BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm 133 | ZmZmg9lI5j6DIYkKP4PVjKU8AYY= 134 | 135 | magentaColour 136 | 137 | BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm 138 | ZmZmg/4CRz+DBTzdPYMgzt4+AYY= 139 | 140 | name 141 | Solarized Dark xterm-256color 142 | redColour 143 | 144 | BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm 145 | ZmZmg6i7UT+DUATePYMl2hA+AYY= 146 | 147 | type 148 | Window Settings 149 | whiteColour 150 | 151 | BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm 152 | ZmZmgzqGaj+D2tdjP4NYPUw/AYY= 153 | 154 | yellowColour 155 | 156 | BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm 157 | ZmZmg0DAJT+DB17vPoM4Y8A8AYY= 158 | 159 | 160 | 161 | -------------------------------------------------------------------------------- /init/Solarized Dark.itermcolors: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Ansi 0 Color 7 | 8 | Blue Component 9 | 0.19370138645172119 10 | Green Component 11 | 0.15575926005840302 12 | Red Component 13 | 0.0 14 | 15 | Ansi 1 Color 16 | 17 | Blue Component 18 | 0.14145714044570923 19 | Green Component 20 | 0.10840655118227005 21 | Red Component 22 | 0.81926977634429932 23 | 24 | Ansi 10 Color 25 | 26 | Blue Component 27 | 0.38298487663269043 28 | Green Component 29 | 0.35665956139564514 30 | Red Component 31 | 0.27671992778778076 32 | 33 | Ansi 11 Color 34 | 35 | Blue Component 36 | 0.43850564956665039 37 | Green Component 38 | 0.40717673301696777 39 | Red Component 40 | 0.32436618208885193 41 | 42 | Ansi 12 Color 43 | 44 | Blue Component 45 | 0.51685798168182373 46 | Green Component 47 | 0.50962930917739868 48 | Red Component 49 | 0.44058024883270264 50 | 51 | Ansi 13 Color 52 | 53 | Blue Component 54 | 0.72908437252044678 55 | Green Component 56 | 0.33896297216415405 57 | Red Component 58 | 0.34798634052276611 59 | 60 | Ansi 14 Color 61 | 62 | Blue Component 63 | 0.56363654136657715 64 | Green Component 65 | 0.56485837697982788 66 | Red Component 67 | 0.50599193572998047 68 | 69 | Ansi 15 Color 70 | 71 | Blue Component 72 | 0.86405980587005615 73 | Green Component 74 | 0.95794391632080078 75 | Red Component 76 | 0.98943418264389038 77 | 78 | Ansi 2 Color 79 | 80 | Blue Component 81 | 0.020208755508065224 82 | Green Component 83 | 0.54115492105484009 84 | Red Component 85 | 0.44977453351020813 86 | 87 | Ansi 3 Color 88 | 89 | Blue Component 90 | 0.023484811186790466 91 | Green Component 92 | 0.46751424670219421 93 | Red Component 94 | 0.64746475219726562 95 | 96 | Ansi 4 Color 97 | 98 | Blue Component 99 | 0.78231418132781982 100 | Green Component 101 | 0.46265947818756104 102 | Red Component 103 | 0.12754884362220764 104 | 105 | Ansi 5 Color 106 | 107 | Blue Component 108 | 0.43516635894775391 109 | Green Component 110 | 0.10802463442087173 111 | Red Component 112 | 0.77738940715789795 113 | 114 | Ansi 6 Color 115 | 116 | Blue Component 117 | 0.52502274513244629 118 | Green Component 119 | 0.57082360982894897 120 | Red Component 121 | 0.14679534733295441 122 | 123 | Ansi 7 Color 124 | 125 | Blue Component 126 | 0.79781103134155273 127 | Green Component 128 | 0.89001238346099854 129 | Red Component 130 | 0.91611063480377197 131 | 132 | Ansi 8 Color 133 | 134 | Blue Component 135 | 0.15170273184776306 136 | Green Component 137 | 0.11783610284328461 138 | Red Component 139 | 0.0 140 | 141 | Ansi 9 Color 142 | 143 | Blue Component 144 | 0.073530435562133789 145 | Green Component 146 | 0.21325300633907318 147 | Red Component 148 | 0.74176257848739624 149 | 150 | Background Color 151 | 152 | Blue Component 153 | 0.15170273184776306 154 | Green Component 155 | 0.11783610284328461 156 | Red Component 157 | 0.0 158 | 159 | Bold Color 160 | 161 | Blue Component 162 | 0.56363654136657715 163 | Green Component 164 | 0.56485837697982788 165 | Red Component 166 | 0.50599193572998047 167 | 168 | Cursor Color 169 | 170 | Blue Component 171 | 0.51685798168182373 172 | Green Component 173 | 0.50962930917739868 174 | Red Component 175 | 0.44058024883270264 176 | 177 | Cursor Text Color 178 | 179 | Blue Component 180 | 0.19370138645172119 181 | Green Component 182 | 0.15575926005840302 183 | Red Component 184 | 0.0 185 | 186 | Foreground Color 187 | 188 | Blue Component 189 | 0.51685798168182373 190 | Green Component 191 | 0.50962930917739868 192 | Red Component 193 | 0.44058024883270264 194 | 195 | Selected Text Color 196 | 197 | Blue Component 198 | 0.56363654136657715 199 | Green Component 200 | 0.56485837697982788 201 | Red Component 202 | 0.50599193572998047 203 | 204 | Selection Color 205 | 206 | Blue Component 207 | 0.19370138645172119 208 | Green Component 209 | 0.15575926005840302 210 | Red Component 211 | 0.0 212 | 213 | 214 | 215 | -------------------------------------------------------------------------------- /init/remy.zsh-theme: -------------------------------------------------------------------------------- 1 | # vim:ft=zsh ts=2 sw=2 sts=2 2 | # 3 | # agnoster's Theme - https://gist.github.com/3712874 4 | # A Powerline-inspired theme for ZSH 5 | # 6 | # # README 7 | # 8 | # In order for this theme to render correctly, you will need a 9 | # [Powerline-patched font](https://gist.github.com/1595572). 10 | # 11 | # In addition, I recommend the 12 | # [Solarized theme](https://github.com/altercation/solarized/) and, if you're 13 | # using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over Terminal.app - 14 | # it has significantly better color fidelity. 15 | # 16 | # # Goals 17 | # 18 | # The aim of this theme is to only show you *relevant* information. Like most 19 | # prompts, it will only show git information when in a git working directory. 20 | # However, it goes a step further: everything from the current user and 21 | # hostname to whether the last call exited with an error to whether background 22 | # jobs are running in this shell will all be displayed automatically when 23 | # appropriate. 24 | 25 | ### Segment drawing 26 | # A few utility functions to make it easy and re-usable to draw segmented prompts 27 | 28 | CURRENT_BG='NONE' 29 | # SEGMENT_SEPARATOR='' 30 | SEGMENT_SEPARATOR='⮀' 31 | 32 | icon_online='%{%F{green}%}' # ●◉ 33 | icon_offline='%{%F{red}%}' # ●⦿ 34 | 35 | # Begin a segment 36 | # Takes two arguments, background and foreground. Both can be omitted, 37 | # rendering default background/foreground. 38 | prompt_segment() { 39 | local bg fg 40 | [[ -n $1 ]] && bg="%K{$1}" || bg="%k" 41 | [[ -n $2 ]] && fg="%F{$2}" || fg="%f" 42 | if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then 43 | echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} " 44 | else 45 | echo -n "%{$bg%}%{$fg%} " 46 | fi 47 | CURRENT_BG=$1 48 | [[ -n $3 ]] && echo -n $3 49 | } 50 | 51 | # End the prompt, closing any open segments 52 | prompt_end() { 53 | if [[ -n $CURRENT_BG ]]; then 54 | echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR" 55 | else 56 | echo -n "%{%k%}" 57 | fi 58 | echo -n "%{%f%}" 59 | CURRENT_BG='' 60 | } 61 | 62 | ### Prompt components 63 | # Each component will draw itself, and hide itself if no information needs to be shown 64 | 65 | # Context: user@hostname (who am I and where am I) 66 | prompt_context() { 67 | local user=`whoami` 68 | 69 | if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then 70 | prompt_segment black default "%(!.%{%F{yellow}%}.)$user@%{$fg_bold[default]%}%m%b" default 71 | fi 72 | } 73 | 74 | # Git: branch/detached head, dirty status 75 | prompt_git() { 76 | local ref dirty 77 | if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then 78 | ZSH_THEME_GIT_PROMPT_DIRTY='±' 79 | dirty=$(parse_git_dirty) 80 | ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)" 81 | if [[ -n $dirty ]]; then 82 | prompt_segment yellow black 83 | else 84 | prompt_segment green black 85 | fi 86 | # echo -n "${ref/refs\/heads\// }$dirty" 87 | echo -n "${ref/refs\/heads\//⭠ }$dirty" 88 | fi 89 | } 90 | 91 | function prompt_online() { 92 | if [[ -f ~/.offline ]]; then 93 | echo $icon_offline 94 | else 95 | echo $icon_online 96 | fi 97 | } 98 | 99 | # Dir: current working directory 100 | prompt_dir() { 101 | if [[ $DARK = 'false' ]]; then 102 | prompt_segment green white '%~' 103 | else 104 | prompt_segment blue black '%~' 105 | fi 106 | } 107 | 108 | # Status: 109 | # - was there an error 110 | # - am I root 111 | # - are there background jobs? 112 | prompt_status() { 113 | local symbols 114 | symbols=() 115 | [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘" 116 | [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" 117 | [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙" 118 | 119 | [[ -n "$symbols" ]] && prompt_segment black default "$symbols" 120 | } 121 | 122 | function battery_charge { 123 | [ -f ~/bin/batcharge.py ] && echo ' '`~/bin/batcharge.py` 124 | } 125 | 126 | ## Main prompt 127 | build_prompt() { 128 | RETVAL=$? 129 | prompt_status 130 | prompt_context 131 | prompt_git 132 | prompt_dir 133 | prompt_end 134 | } 135 | 136 | RPROMPT='$(prompt_online)$(battery_charge)' 137 | 138 | PROMPT='%{%f%b%k%}$(build_prompt) 139 | %{%F{green}%}❯ ' # » 140 | -------------------------------------------------------------------------------- /npm.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # install nvm 4 | curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash 5 | nvm alias default 10 6 | 7 | npm install -g xml2json-command # data mangling 8 | npm install -g serve # quick static server 9 | npm install -g tap # test shortcut 10 | npm install -g devtool # trace debugging 11 | npm install -g snyk # security 12 | npm install -g semantic-release-cli # releases 13 | npm install -g live-server # one day I'll do esnext... 14 | npm install -g peerflix # for testing torrents 15 | npm install -g depcheck # finding unused deps 16 | npm install -g babel-cli 17 | npm install -g dev-cert-authority # add self signed certs for custom domains 18 | npm install -g now # deploy 19 | npm install -g npx # run stuff 20 | 21 | # mine 22 | npm install -g nodemon # cos I use all the time 23 | npm install -g @remy/envy # cos I use all the time 24 | npm install -g @remy/webmention # webmentions 25 | npm install -g jsonbin # jsonbin storage 26 | npm install -g express-router-cli # my simplified router 27 | npm install -g @remy/remarker # my slide runner 28 | -------------------------------------------------------------------------------- /pony.ansi: -------------------------------------------------------------------------------- 1 | ▄▄▄▄▄▄▄▄▄▄▄▄▄  2 | ▄▄██▄▄▄██▄▄██▄█▄▄  3 | ██▄▄██▄▄▄██▄██████  4 | ▀▄▄▄▄▄▄▄▄▄█▄▄█▄███  5 | ▀▄▄▄▄▄▄▄████▄███  6 | ▄▄██▄▄▄▄█▄███▄▄█  7 | ▄▄████▄███▄██████▄▄ ▄  8 | ▄▄▄▄▄██▄▄▄██▄██▄▄▄▄▄▄▄█ ▄▄▄▄▄▄▄  9 | █▄▄▄▄▄▄▄▄▄▄▄▄▄███▄██▄▀ ▄▄▄▄▄▄▄▄█▄▄  10 | ▄▄▄▄▄▄▄▄▄▄███▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄██▄▄▄█▄▄▄▄  11 | █████████████▄█▄▄▄████▀▀▄██▄▄██▄▄  12 | ▀▄▄█▄████████████▄█▄███ ▀▄██████  13 | █▄▄▄▄█████▄▄▄██████▄██ ███████  14 | ▀█▄█▄█████████████████▄ ████▄▄▀ ▄  15 | █▄█████▄██▄▄█████████ ██▄▄█▄▄ █▄▄ 16 | ████████▀▀██▄█████▄▄█ ▀▄█▄▄██▄▄█▄▀ 17 | █▄▄▄▄▄▄█ ▄▄▄▄▄▄▄███ ▀▄▄█▄▄▄▄▀  18 | ▄█▄▄▄▄▄█▄ ██████████ ▀▀▀  19 | ██▄▄▄█▄▄▄ ███████████  20 | ▄█▄▄███████ ███████████  21 | █▄█████████ █▄▄█████████  22 | █▄▄▄▄▄▄▄█ █▄▄▄▄▄▄▄█  23 | --------------------------------------------------------------------------------