diff --git a/aliases b/aliases index ab49070..5bff2b0 100644 --- a/aliases +++ b/aliases @@ -7,11 +7,8 @@ alias ll='ls -la' # Get into some servers FAST. Server, user & port are in .ssh/config alias krlc='ssh kremalicious' -# Terminal needs more Espresso -alias esp="open -a Espresso" - # Update All The Things -alias update='update.sh' +alias update='update-everything.sh' # Recursively delete `.DS_Store` files alias cleanup="find . -type f -name '*.DS_Store' -ls -delete" diff --git a/bash_profile b/bash_profile index d6d76a1..bffa32c 100644 --- a/bash_profile +++ b/bash_profile @@ -12,7 +12,7 @@ # Load ~/.private, ~/.bash_prompt # ---------------------------------------------------------------------- -for file in ~/.{bash_prompt,aliases,private,inputrc}; do +for file in ~/.{bash_prompt,aliases,exports,paths,private,inputrc}; do [ -r "$file" ] && [ -f "$file" ] && source "$file" done; unset file; @@ -24,10 +24,6 @@ unset file; # Append to the Bash history file, rather than overwriting it shopt -s histappend -# Prefer US English and use UTF-8 -export LC_ALL="en_US.UTF-8" -export LANG="en_US" - # fuck that you have new mail shit unset MAILCHECK @@ -51,33 +47,11 @@ elif [ -f /etc/bash_completion ]; then source /etc/bash_completion; fi; -# Set architecture flags -export ARCHFLAGS="-arch x86_64" +# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards +[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2- | tr ' ' '\n')" scp sftp ssh; -# ---------------------------------------------------------------------- -# PATH -# ---------------------------------------------------------------------- +# Add `killall` tab completion for common apps +complete -o "nospace" -W "Contacts Calendar Dock Finder Mail Safari iTunes SystemUIServer Terminal" killall; -# we want the various sbins on the path along with /usr/local/bin -PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin" -PATH="/usr/local/bin:$PATH" -[ -d "$HOME/.bin" ] && PATH="$HOME/.bin:$PATH" - -# if these bins exist, then add them to the PATH -ANDROID_HOME="/usr/local/opt/android-sdk" -[ -d "$ANDROID_HOME" ] && PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools" - -[ -d "/usr/local/mysql/bin" ] && PATH="/usr/local/mysql/bin:$PATH" -[ -d "/usr/local/share/npm/bin" ] && PATH="/usr/local/share/npm/bin:$PATH" - -[ -d "$HOME/.rvm/bin" ] && PATH="$HOME/.rvm/bin:$PATH" # Add RVM to PATH for scripting -[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* - -export PATH; - -# ---------------------------------------------------------------------- -# LSCOLORS -# ---------------------------------------------------------------------- - -export CLICOLOR=1 -export LSCOLORS=gxfxcxdxbxegedabagacad +# aws-cli tab completion +complete -C aws_completer aws diff --git a/bash_prompt b/bash_prompt index 9d518ce..7513b95 100644 --- a/bash_prompt +++ b/bash_prompt @@ -115,7 +115,7 @@ PS1+="\[${white}\] in "; PS1+="\[${green}\]\w"; # working directory PS1+="\$(prompt_git \"${white} on ${violet}\")"; # Git repository details PS1+="\n"; -PS1+="\[${white}\]→ \[${reset}\]"; # `$` (and reset color) +PS1+="\[${white}\]→ \[${reset}\]"; # `→` (and reset color) export PS1; PS2="\[${yellow}\]→ \[${reset}\]"; diff --git a/bashrc b/bashrc index c77cd04..964fa99 100644 --- a/bashrc +++ b/bashrc @@ -1 +1,2 @@ -[ -n "$PS1" ] && source ~/.bash_profile \ No newline at end of file +[ -n "$PS1" ] && source ~/.bash_profile +export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting diff --git a/bootstrap-update.sh b/bin/update-dotfiles.sh similarity index 52% rename from bootstrap-update.sh rename to bin/update-dotfiles.sh index f2bf444..00d384a 100755 --- a/bootstrap-update.sh +++ b/bin/update-dotfiles.sh @@ -13,33 +13,61 @@ # dotfiles directory dir=~/Projects/dotfiles + # list of files/folders to symlink in homedir -files="aliases bashrc bash_profile bash_prompt gemrc gitconfig gitignore_global hushlogin inputrc private tm_properties generator.json npmrc bin" +files="aliases bashrc bash_profile bash_prompt exports gemrc gitconfig gitignore hushlogin inputrc paths private tm_properties generator.json npmrc bin" + # ---------------------------------------------------------------------- # change to the dotfiles directory # ---------------------------------------------------------------------- -echo "Changing to the $dir directory" + cd $dir -echo "...done" + # ---------------------------------------------------------------------- # pull in changes # ---------------------------------------------------------------------- -echo "Getting changes" -git pull -echo "...done" + +echo "$(tput setaf 136)" +echo " Getting changes " +echo "=============================================" +echo "$(tput sgr0)" # reset + +#git pull + +echo "$(tput setaf 64)" # green +echo "---------------------------------------------" +echo " ✓ done" +echo "$(tput sgr0)" # reset + + +# ---------------------------------------------------------------------- +# delete existing dotfiles in ~ +# ---------------------------------------------------------------------- + +for file in $files; do + rm ~/.$file +done # ---------------------------------------------------------------------- # create symlinks from the homedir to any files in the ~/dotfiles directory # specified in $files # ---------------------------------------------------------------------- + for file in $files; do - echo "Removing any existing dotfiles from ~" - rm ~/.$file - echo "...done" - echo "Creating symlink to $file in home directory." ln -s $dir/$file ~/.$file + echo "$(tput setaf 64)✓$(tput sgr0) Created symlink to $(tput setaf 37)$file$(tput sgr0)" done -echo "...all done" \ No newline at end of file +# ---------------------------------------------------------------------- +# source what we just created +# ---------------------------------------------------------------------- + +source ~/.bash_profile + + +echo "$(tput setaf 64)" # green +echo "---------------------------------------------" +echo " ✓ all done" +echo "$(tput sgr0)" # reset \ No newline at end of file diff --git a/bin/update-everything.sh b/bin/update-everything.sh new file mode 100755 index 0000000..1d48dbb --- /dev/null +++ b/bin/update-everything.sh @@ -0,0 +1,82 @@ +#!/bin/bash + + +# +# OS X +# ------------- + +#sudo softwareupdate -i -a + +# +# Homebrew +# ------------- + +echo "$(tput setaf 136)" +echo " Update Homebrew " +echo "=============================================" +echo "$(tput sgr0)" # reset + +brew update +brew upgrade +brew cleanup + +echo "$(tput setaf 64)" # green +echo "---------------------------------------------" +echo " ✓ done" +echo "$(tput sgr0)" # reset + +# +# npm +# ------------- + +echo "$(tput setaf 136)" +echo " Update npm " +echo "=============================================" +echo "$(tput sgr0)" # reset + +# update npm itself +npm install npm -g + +# update all global packages +#npm update -g +sh npm-upgrade.sh + +echo "$(tput setaf 64)" # green +echo "---------------------------------------------" +echo " ✓ done" +echo "$(tput sgr0)" # reset + +# +# Ruby +# ------------- + +echo "$(tput setaf 136)" +echo " Update rvm " +echo "=============================================" +echo "$(tput sgr0)" # reset + +# update rvm itself +rvm get latest +rvm cleanup all + +echo "$(tput setaf 64)" # green +echo "---------------------------------------------" +echo " ✓ done" +echo "$(tput sgr0)" # reset + +# +# Gems +# ------------- + +echo "$(tput setaf 136)" +echo " Update gems " +echo "=============================================" +echo "$(tput sgr0)" # reset + +gem update --system +gem update + +echo "$(tput setaf 64)" # green +echo "---------------------------------------------" +echo " ✓ done" +echo "$(tput sgr0)" # reset \ No newline at end of file diff --git a/bin/update.sh b/bin/update.sh deleted file mode 100755 index f47809e..0000000 --- a/bin/update.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -# -# OS X -# ------------- - -#sudo softwareupdate -i -a - -# -# Homebrew -# ------------- - -brew update -brew upgrade -brew cleanup - - -# -# npm -# ------------- - -# update npm itself -npm install npm -g - -# update all global packages -#npm update -g -sh npm-upgrade.sh - - -# -# Ruby -# ------------- -rvm get branch master -rvm cleanup all - - -# -# Gems -# ------------- -gem update --system -gem update \ No newline at end of file diff --git a/bootstrap.sh b/bootstrap.sh index 337aa9b..d39605b 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -12,24 +12,89 @@ # ---------------------------------------------------------------------- # dotfiles directory -dir=~/Projects/dotfiles +dir=$DOTFILES_DIR + # list of files/folders to symlink in homedir -files="aliases bashrc bash_profile bash_prompt gemrc gitconfig gitignore_global hushlogin inputrc private tm_properties generator.json npmrc bin" +files="aliases bashrc bash_profile bash_prompt exports gemrc gitconfig gitignore hushlogin inputrc paths private tm_properties generator.json npmrc bin" + # ---------------------------------------------------------------------- # change to the dotfiles directory # ---------------------------------------------------------------------- -echo "Changing to the $dir directory" + cd $dir -echo "...done" # ---------------------------------------------------------------------- -# create symlinks from the homedir to any files in the ~/dotfiles directory +# create symlinks from the homedir to any files in the dotfiles directory # specified in $files # ---------------------------------------------------------------------- + for file in $files; do - echo "Creating symlink to $file in home directory." ln -s $dir/$file ~/.$file + echo "$(tput setaf 64)✓$(tput sgr0) Created symlink to $(tput setaf 37)$file$(tput sgr0)" done -echo "...all done" \ No newline at end of file + +# ---------------------------------------------------------------------- +# source what we just created +# ---------------------------------------------------------------------- + +source ~/.bash_profile + + +# ---------------------------------------------------------------------- +# Homebrew +# ---------------------------------------------------------------------- + +echo "$(tput setaf 136)" +echo " Brewing all the things. " +echo "=============================================" +echo "$(tput sgr0)" # reset + +./brew.sh + +echo "$(tput setaf 64)" # green +echo "---------------------------------------------" +echo " ✓ done" +echo "$(tput sgr0)" # reset + + +# ---------------------------------------------------------------------- +# npm +# ---------------------------------------------------------------------- + +echo "$(tput setaf 136)" +echo " npm all the things. " +echo "=============================================" +echo "$(tput sgr0)" # reset + +./npm.sh + +echo "$(tput setaf 64)" # green +echo "---------------------------------------------" +echo " ✓ done" +echo "$(tput sgr0)" # reset + + +# ---------------------------------------------------------------------- +# Ruby +# ---------------------------------------------------------------------- + +echo "$(tput setaf 136)" +echo " Ruby all the things. " +echo "=============================================" +echo "$(tput sgr0)" # reset + +./ruby.sh + +echo "$(tput setaf 64)" # green +echo "---------------------------------------------" +echo " ✓ done" +echo "$(tput sgr0)" # reset + + +echo "$(tput setaf 64)" # green +echo "=============================================" +echo " ✓ all done" +echo "=============================================" +echo "$(tput sgr0)" # reset \ No newline at end of file diff --git a/brew b/brew.sh similarity index 100% rename from brew rename to brew.sh diff --git a/exports b/exports new file mode 100644 index 0000000..552d5b4 --- /dev/null +++ b/exports @@ -0,0 +1,10 @@ +# Set architecture flags +export ARCHFLAGS="-arch x86_64" + +# Prefer US English and use UTF-8 +export LC_ALL="en_US.UTF-8" +export LANG="en_US" + +# LSCOLORS +export CLICOLOR=1 +export LSCOLORS=gxfxcxdxbxegedabagacad \ No newline at end of file diff --git a/gitconfig b/gitconfig index 7aab699..9fd3fa8 100644 --- a/gitconfig +++ b/gitconfig @@ -2,17 +2,19 @@ # Le Git Config ######################################################################## -[user] - email = m@kretschmann.io - name = Matthias Kretschmann +# Values coming from environment variables set in private file +# [user] +# email = +# name = + [github] user = kremalicious - token = !"cat ~/.auth/github | tr -d \"\n\"" + [credential] helper = osxkeychain [core] - excludesfile = ~/.gitignore_global + excludesfile = ~/.gitignore quotepath = false # Handle umlauts and such better on OS X @@ -82,4 +84,7 @@ prompt = false [mergetool "Kaleidoscope"] cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot - trustExitCode = true \ No newline at end of file + trustExitCode = true +[user] + name = + email = m@kretschmann.io diff --git a/gitignore_global b/gitignore similarity index 100% rename from gitignore_global rename to gitignore diff --git a/inputrc b/inputrc index 5760a7b..47cdff8 100644 --- a/inputrc +++ b/inputrc @@ -2,4 +2,21 @@ set completion-ignore-case on # Auto list tab completions (use instead of TAB-cycling) -set show-all-if-ambiguous on \ No newline at end of file +set show-all-if-ambiguous on + +# Immediately add a trailing slash when autocompleting symlinks to directories +set mark-symlinked-directories on + +# Do not autocomplete hidden files unless the pattern explicitly begins with a dot +set match-hidden-files off + +# Show all autocomplete results at once +set page-completions off + +# Show extra file information when completing, like `ls -F` does +set visible-stats on + +# Allow UTF-8 input and output, instead of showing stuff like $'\0123\0456' +set input-meta on +set output-meta on +set convert-meta off \ No newline at end of file diff --git a/npm b/npm.sh similarity index 78% rename from npm rename to npm.sh index f9a8e95..a64df26 100755 --- a/npm +++ b/npm.sh @@ -3,7 +3,7 @@ # Installed from brewfile with node # install global stuff -npm install -g bower grunt grunt-cli gulp +npm install -g bower grunt grunt-cli gulp nib stylus # Install Keybase # https://keybase.io/docs/command_line/installation diff --git a/osx b/osx index daa1a20..a6eadd7 100755 --- a/osx +++ b/osx @@ -10,16 +10,6 @@ sudo -v # Keep-alive: update existing `sudo` time stamp until `osx` has finished while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & -############################################################################### -# General UI/UX # -############################################################################### - -# Disable the “Are you sure you want to open this application?” dialog -defaults write com.apple.LaunchServices LSQuarantine -bool false - -# Disable automatic termination of inactive apps -defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true - ############################################################################### # Trackpad, mouse, keyboard, and input # @@ -33,15 +23,9 @@ defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false # Finder # ############################################################################### -# Finder: show status bar -defaults write com.apple.finder ShowStatusBar -bool true - # Allow text selection in Quick Look defaults write com.apple.finder QLEnableTextSelection -bool true -# Disable the warning when changing a file extension -defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false - # Disable disk image verification defaults write com.apple.frameworks.diskimages skip-verify -bool true defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true @@ -58,9 +42,6 @@ defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true # Disable the warning before emptying the Trash defaults write com.apple.finder WarnOnEmptyTrash -bool false -# Empty Trash securely by default -defaults write com.apple.finder EmptyTrashSecurely -bool true - # Show the ~/Library folder chflags nohidden ~/Library @@ -69,15 +50,6 @@ chflags nohidden ~/Library # Dock, Dashboard, and hot corners # ############################################################################### -# Show indicator lights for open applications in the Dock -defaults write com.apple.dock show-process-indicators -bool true - -# Speed up Mission Control animations -defaults write com.apple.dock expose-animation-duration -float 0.1 - -# Don’t automatically rearrange Spaces based on most recent use -defaults write com.apple.dock mru-spaces -bool false - # Add a spacer to the left side of the Dock (where the applications are) #defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' # Add a spacer to the right side of the Dock (where the Trash is) @@ -91,17 +63,6 @@ defaults write com.apple.dock mru-spaces -bool false # Set Safari’s home page to `about:blank` for faster loading defaults write com.apple.Safari HomePage -string "about:blank" -# Allow hitting the Backspace key to go to the previous page in history -defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true - -# Enable Safari’s debug menu -defaults write com.apple.Safari IncludeInternalDebugMenu -bool true - -# Enable the Develop menu and the Web Inspector in Safari -defaults write com.apple.Safari IncludeDevelopMenu -bool true -defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true -defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true - # Make Safari’s search banners default to Contains instead of Starts With defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false @@ -119,6 +80,16 @@ defaults write com.apple.Safari WebKitUserStyleSheetLocationPreferenceKey -strin defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false +############################################################################### +# SSD-specific tweaks # +############################################################################### + +# Disable local Time Machine snapshots +sudo tmutil disablelocal + +# Disable the sudden motion sensor as it’s not useful for SSDs +sudo pmset -a sms 0 + ############################################################################### # Terminal # @@ -140,8 +111,12 @@ hash tmutil &> /dev/null && sudo tmutil disablelocal ############################################################################### -# GPGMail 2 # +# Kill affected applications # ############################################################################### -# Disable signing emails by default -defaults write ~/Library/Preferences/org.gpgtools.gpgmail SignNewEmailsByDefault -bool false +for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \ + "Dock" "Finder" "Mail" "Messages" "Safari" "SystemUIServer" \ + "Terminal"; do + killall "${app}" > /dev/null 2>&1 +done +echo "Done. Note that some of these changes require a logout/restart to take effect." \ No newline at end of file diff --git a/paths b/paths new file mode 100644 index 0000000..deaaab3 --- /dev/null +++ b/paths @@ -0,0 +1,12 @@ +[ -d "$HOME/.bin" ] && PATH="$HOME/.bin:$PATH" + +ANDROID_HOME="/usr/local/opt/android-sdk" +[ -d "$ANDROID_HOME" ] && PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools" + +[ -d "/usr/local/mysql/bin" ] && PATH="/usr/local/mysql/bin:$PATH" +[ -d "/usr/local/share/npm/bin" ] && PATH="/usr/local/share/npm/bin:$PATH" + +[ -d "$HOME/.rvm/bin" ] && PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting +[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* + +export PATH \ No newline at end of file diff --git a/ruby b/ruby.sh similarity index 65% rename from ruby rename to ruby.sh index fc33571..619c5ba 100755 --- a/ruby +++ b/ruby.sh @@ -3,9 +3,12 @@ # Install RVM curl -sSL https://get.rvm.io | bash +# handle requirements +rvm requirements + # Install a Ruby -rvm install 2.1.1 -rvm use 2.1.1 +rvm install 2.1.4 +rvm use --default 2.1.4 rvm rubygems latest # Install gems