From 42dceab710c1f6529988b7596d7d173cdb153737 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 18 Jun 2012 01:10:31 +0200 Subject: [PATCH] initial commit --- .gitignore | 2 ++ bash_profile | 53 +++++++++++++++++++++++++++++ bash_prompt | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ gitconfig | 43 ++++++++++++++++++++++++ gitignore_global | 85 +++++++++++++++++++++++++++++++++++++++++++++++ hushlogin | 0 make.sh | 35 ++++++++++++++++++++ osx.sh | 82 +++++++++++++++++++++++++++++++++++++++++++++ update.sh | 45 +++++++++++++++++++++++++ 9 files changed, 431 insertions(+) create mode 100644 .gitignore create mode 100644 bash_profile create mode 100644 bash_prompt create mode 100644 gitconfig create mode 100644 gitignore_global create mode 100644 hushlogin create mode 100755 make.sh create mode 100755 osx.sh create mode 100644 update.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a44a21f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# ignore private file +private \ No newline at end of file diff --git a/bash_profile b/bash_profile new file mode 100644 index 0000000..9db351c --- /dev/null +++ b/bash_profile @@ -0,0 +1,53 @@ +######################################################################## +# bash_profile, basically from the whole internet +# and a lot from @necolas, @mathiasbynens & @rtomayko +# +# https://github.com/mathiasbynens/dotfiles +# https://github.com/necolas/dotfiles +# https://github.com/rtomayko/dotfiles +######################################################################## + + +# ---------------------------------------------------------------------- +# Load ~/.extra, ~/.bash_prompt +# ---------------------------------------------------------------------- + +for file in ~/.{extra,bash_prompt}; do + [ -r "$file" ] && source "$file" +done +unset file + +# ---------------------------------------------------------------------- +# SHELL OPTIONS +# ---------------------------------------------------------------------- + +# fuck that you have new mail shit +unset MAILCHECK + +# ---------------------------------------------------------------------- +# PATH +# ---------------------------------------------------------------------- + +PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin" +PATH="/usr/local/bin:/usr/local/mysql/bin:$PATH" +# Android SDK +PATH="~/Dropbox/Code/android-sdk/tools:~/Dropbox/Code/android-sdk/platform-tools:$PATH" + +# ---------------------------------------------------------------------- +# ALIASES +# ---------------------------------------------------------------------- + +alias ll='ls -la' +# Get into main server FAST. Server & port are in .ssh/config +alias krlc='ssh kremalicious' +# Terminal needs more Espresso +alias esp="open -a Espresso" +# Get OS X Software Updates, update Homebrew itself, and upgrade installed Homebrew packages +alias update='sudo softwareupdate -i -a; brew update; brew upgrade' + +# ---------------------------------------------------------------------- +# LSCOLORS +# ---------------------------------------------------------------------- + +export CLICOLOR=1 +export LSCOLORS=gxfxcxdxbxegedabagacad diff --git a/bash_prompt b/bash_prompt new file mode 100644 index 0000000..0be9da7 --- /dev/null +++ b/bash_prompt @@ -0,0 +1,86 @@ +######################################################################## +# bash_prompt, from @necolas +# https://github.com/necolas/dotfiles/blob/master/bash/bash_prompt +######################################################################## + +# Based on @gf3’s Sexy Bash Prompt: https://github.com/gf3/dotfiles +# iTerm2 prefs: import Solarized theme (disable bright colors for bold text) +# Color ref: http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim +# More tips: http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html +# Screenshot: http://i.imgur.com/DSJ1G.png + +# Example: +# nicolas@host: ~/.dotfiles on master[!?] +# $ + +# Check that terminfo exists before changing TERM var to xterm-256color +# Prevents prompt flashing in Mac OS X 10.6 Terminal.app +if [ -e /usr/share/terminfo/x/xterm-256color ]; then + export TERM='xterm-256color' +fi + +tput sgr 0 0 + +# Base styles and color palette +# Solarized colors +# https://github.com/altercation/solarized/tree/master/iterm2-colors-solarized +BOLD=$(tput bold) +RESET=$(tput sgr0) +SOLAR_YELLOW=$(tput setaf 136) +SOLAR_ORANGE=$(tput setaf 166) +SOLAR_RED=$(tput setaf 124) +SOLAR_MAGENTA=$(tput setaf 125) +SOLAR_VIOLET=$(tput setaf 61) +SOLAR_BLUE=$(tput setaf 33) +SOLAR_CYAN=$(tput setaf 37) +SOLAR_GREEN=$(tput setaf 64) +SOLAR_WHITE=$(tput setaf 254) + +style_user="\[${RESET}${SOLAR_ORANGE}\]" +style_host="\[${RESET}${SOLAR_YELLOW}\]" +style_path="\[${RESET}${SOLAR_GREEN}\]" +style_chars="\[${RESET}${SOLAR_WHITE}\]" +style_branch="${SOLAR_CYAN}" + +if [[ "$SSH_TTY" ]]; then + # connected via ssh + style_host="\[${BOLD}${SOLAR_RED}\]" +elif [[ "$USER" == "root" ]]; then + # logged in as root + style_user="\[${BOLD}${SOLAR_RED}\]" +fi + + +# Git status. +# Adapted from: https://github.com/cowboy/dotfiles/ +function prompt_git() { + local status output flags + status="$(git status 2>/dev/null)" + [[ $? != 0 ]] && return; + output="$(echo "$status" | awk '/# Initial commit/ {print "(init)"}')" + [[ "$output" ]] || output="$(echo "$status" | awk '/# On branch/ {print $4}')" + [[ "$output" ]] || output="$(git branch | perl -ne '/^\* (.*)/ && print $1')" + flags="$( + echo "$status" | awk 'BEGIN {r=""} \ + /^# Changes to be committed:$/ {r=r "+"}\ + /^# Changes not staged for commit:$/ {r=r "!"}\ + /^# Untracked files:$/ {r=r "?"}\ + END {print r}' + )" + if [[ "$flags" ]]; then + output="$output[$flags]" + fi + echo -ne "${SOLAR_WHITE} on ${style_branch}${output}" +} + + +# Build the prompt +PS1="\n" # Newline +PS1+="${style_user}\u" # Username +PS1+="${style_chars}@" # @ +PS1+="${style_host}\h" # Host +PS1+="${style_chars}: " # : +PS1+="${style_path}\w" # Working directory +PS1+="\$(prompt_git)" # Git details +PS1+="\n" # Newline +PS1+="${style_chars}\$ \[${RESET}\]" # $ (and reset color) \ No newline at end of file diff --git a/gitconfig b/gitconfig new file mode 100644 index 0000000..5255241 --- /dev/null +++ b/gitconfig @@ -0,0 +1,43 @@ +######################################################################## +# Le Git Config +######################################################################## + +[user] + email = desk@kremalicious.com + name = Matthias Kretschmann +[github] + user = kremalicious +[credential] + helper = osxkeychain +[core] + excludesfile = ~/.gitignore_global + quotepath = false +[color] + diff = auto + status = auto + branch = auto + interactive = auto + ui = auto +[color "branch"] + current = green bold + local = green + remote = red bold +[color "diff"] + meta = yellow bold + frag = magenta bold + old = red bold + new = green bold +[color "status"] + added = green bold + changed = yellow bold + untracked = red +[push] + #'git push' only the current branch + default = current +[alias] + s = status + a = !git add . && git status + c = commit + cm = commit -m + l = log --graph --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset' + ll = log --stat --abbrev-commit \ No newline at end of file diff --git a/gitignore_global b/gitignore_global new file mode 100644 index 0000000..eecc90c --- /dev/null +++ b/gitignore_global @@ -0,0 +1,85 @@ +######################################################################## +# global ignored files +######################################################################## + +# ---------------------------------------------------------------------- +# OS generated files +# ---------------------------------------------------------------------- + +.DS_Store +Icon? + +# Thumbnails +._* +Thumbs.db +thumbs.db + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes + +# ---------------------------------------------------------------------- +# Other Version Control +# ---------------------------------------------------------------------- + +.svn/ + +# ---------------------------------------------------------------------- +# Logs and databases +# ---------------------------------------------------------------------- + +*.log +*.sql +*.sqlite + +# ---------------------------------------------------------------------- +# Espresso project files +# ---------------------------------------------------------------------- + +*.esproj + +# ---------------------------------------------------------------------- +# WordPress +# ---------------------------------------------------------------------- + +#.htaccess +wp-activate.php +wp-app.php +wp-atom.php +wp-blog-header.php +wp-comments-post.php +wp-commentsrss2.php +wp-config-sample.php +#wp-config.php +wp-cron.php +wp-feed.php +wp-links-opml.php +wp-load.php +wp-login.php +wp-mail.php +wp-pass.php +wp-rdf.php +wp-register.php +wp-rss.php +wp-rss2.php +wp-settings.php +wp-signup.php +wp-trackback.php +xmlrpc.php +wp-admin/ +wp-includes/ +*/wp-content/uploads/ +wp-content/upgrade/* +wp-content/backup-db/* +wp-content/advanced-cache.php +wp-content/wp-cache-config.php +wp-content/cache/* +wp-content/cache/supercache/* +*/wp-content/gallery/* +*/wp-content/plugins/ +sitemap.xml +sitemap.xml.gz +*/wp-content/index.php +*/wp-content/themes/index.php +*/wp-content/themes/twentyeleven/ +*/wp-content/languages/ \ No newline at end of file diff --git a/hushlogin b/hushlogin new file mode 100644 index 0000000..e69de29 diff --git a/make.sh b/make.sh new file mode 100755 index 0000000..20a8047 --- /dev/null +++ b/make.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# creates symlinks from the home directory to +# any desired dotfiles in ~/dotfiles +# +# adapted from @michaeljsmalley +# https://github.com/michaeljsmalley/dotfiles/blob/master/makesymlinks.sh +######################################################################## + +# ---------------------------------------------------------------------- +# Variables +# ---------------------------------------------------------------------- + +# dotfiles directory +dir=~/.dotfiles +# list of files/folders to symlink in homedir +files="bash_profile bash_prompt gitconfig gitignore_global hushlogin private" + +# ---------------------------------------------------------------------- +# 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 +# specified in $files +# ---------------------------------------------------------------------- +for file in $files; do + echo "Creating symlink to $file in home directory." + ln -s $dir/$file ~/.$file +done + +echo "...all done" \ No newline at end of file diff --git a/osx.sh b/osx.sh new file mode 100755 index 0000000..2beda94 --- /dev/null +++ b/osx.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# +# OS X defaults +# +# most of it taken from @mathiasbynens +# https://github.com/mathiasbynens/dotfiles/blob/master/.osx +######################################################################## + +# Expand save panel by default +defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true + +# Expand print panel by default +defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true + +# Disable the “Are you sure you want to open this application?” dialog +defaults write com.apple.LaunchServices LSQuarantine -bool false + +# Disable auto-correct +defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false + +# Save screenshots to the desktop +defaults write com.apple.screencapture location -string "$HOME/Desktop" + +# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) +defaults write com.apple.screencapture type -string "png" + +# Allow text selection in Quick Look +defaults write com.apple.finder QLEnableTextSelection -bool true + +# Disable disk image verification +defaults write com.apple.frameworks.diskimages skip-verify -bool true +defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true +defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true + +# Automatically open a new Finder window when a volume is mounted +defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true +defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true +defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true + +# Avoid creating .DS_Store files on network volumes +defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true + +# Disable the warning when changing a file extension +defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false + +# Enable snap-to-grid for desktop icons +/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist + +# 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 + +# Show indicator lights for open applications in the Dock +defaults write com.apple.dock show-process-indicators -bool true + +# Add a spacer to the left side of the Dock (where the applications are) +#defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' +# Add a spacer to the right side of the Dock (where the Trash is) +#defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}' + +# Enable Safari’s debug menu +defaults write com.apple.Safari IncludeInternalDebugMenu -bool true + +# Make Safari’s search banners default to Contains instead of Starts With +defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false + +# Add a context menu item for showing the Web Inspector in web views +defaults write NSGlobalDomain WebKitDeveloperExtras -bool true + +# Only use UTF-8 in Terminal.app +defaults write com.apple.terminal StringEncodings -array 4 + +# Copy email addresses as `foo@example.com` instead of `Foo Bar ` in Mail.app +defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false + +# Prevent Time Machine from prompting to use new hard drives as backup volume +defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true \ No newline at end of file diff --git a/update.sh b/update.sh new file mode 100644 index 0000000..5809a8b --- /dev/null +++ b/update.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# +# Pull in changes and make new symlinks +# +# adapted from @mathiasbynens & @michaeljsmalley +# https://github.com/mathiasbynens/dotfiles/blob/master/bootstrap.sh +# https://github.com/michaeljsmalley/dotfiles/blob/master/makesymlinks.sh +######################################################################## + +# ---------------------------------------------------------------------- +# Variables +# ---------------------------------------------------------------------- + +# dotfiles directory +dir=~/.dotfiles +# list of files/folders to symlink in homedir +files="bash_profile bash_prompt gitconfig gitignore_global hushlogin private" + +# ---------------------------------------------------------------------- +# 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" + +# ---------------------------------------------------------------------- +# 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 +done + +echo "...all done" \ No newline at end of file