Skip to content

Commit

Permalink
platform specific things, mac stuff, python stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Rooth committed Mar 5, 2017
1 parent 4fd2018 commit ad566bb
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 25 deletions.
37 changes: 28 additions & 9 deletions bash/.bashrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
#!/bin/bash -e

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
source /etc/bashrc
fi

export HISTFILESIZE=3000

if [ -f ~/.bash_private_stuff ]; then
. ~/.bash_private_stuff
source ~/.bash_private_stuff
fi

# Python
export PYTHONUSERBASE=~/.local
PATH=$PATH:$PYTHONUSERBASE/bin

# Go
export GOPATH=$HOME/dev/go
PATH=$PATH:/usr/local/go/bin
PATH=$PATH:~/usr/local/bin
Expand All @@ -17,10 +24,10 @@ PATH=$PATH:$GOPATH/bin

# GIT
if [ -e "/usr/share/git-core/contrib/completion/git-prompt.sh" ]; then
source "/usr/share/git-core/contrib/completion/git-prompt.sh"
export PS1='[\h \[\e[1;36m\]\W\[\e[m\]$(declare -F __git_ps1 &>/dev/null && __git_ps1 " \[\e[1;32m\](%s)\[\e[m\]")]\$ '
source "/usr/share/git-core/contrib/completion/git-prompt.sh"
export PS1='[\h \[\e[1;36m\]\W\[\e[m\]$(declare -F __git_ps1 &>/dev/null && __git_ps1 " \[\e[1;32m\](%s)\[\e[m\]")]\$ '
else
export PS1='[\h \[\e[1;36m\]\W\[\e[m\]]\$ '
export PS1='[\h \[\e[1;36m\]\W\[\e[m\]]\$ '
fi

alias c='clear'
Expand Down Expand Up @@ -54,14 +61,26 @@ export GPG_TTY
# Use GPG agent instead of default ssh agent.
# From gpg-agent man page:
unset SSH_AGENT_PID
export SSH_AUTH_SOCK=$(gpgconf --list-dirs | awk 'BEGIN {FS=":"} /^agent-socket:/ {print $2 ".ssh"}')

export SSH_AUTH_SOCK
SSH_AUTH_SOCK=$(gpgconf --list-dirs | awk 'BEGIN {FS=":"} /^agent-socket:/ {print $2 ".ssh"}')

# FZF
[ -f ~/.fzf.bash ] && source ~/.fzf.bash

# NVM
export NVM_DIR="/home/ed/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" # This loads nvm

# kubectl bash completion
# kubectl
source ~/bash_completions/kubectl

# beets
if [ -d /Volumes/2TB/audio/beets/master ]; then
export BEETSDIR=/Volumes/2TB/audio/beets/master
fi

# Platform specific stuff
unamestr=$(uname)
if [[ "$unamestr" == 'Darwin' ]]; then
source ~/.bashrc_mac
fi
1 change: 0 additions & 1 deletion bash/.bash_mac_stuff → bash/.bashrc_mac
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
export CLICOLOR=1
export LSCOLORS=dxfxcxdxbxegedabagacad
export TERM=xterm-256color

14 changes: 14 additions & 0 deletions bash/bash_util
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# utility functions used in various scripts

# detect platform and configure platform specific settings
platform='unknown'
unamestr=$(uname)
if [[ "$unamestr" == 'Linux' ]]; then
platform='linux'
elif [[ "$unamestr" == 'Darwin' ]]; then
platform='darwin'
source ~/.bash_mac_stuff
fi

4 changes: 4 additions & 0 deletions nvim/.config/nvim/.netrwhist
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
let g:netrw_dirhistmax =10
let g:netrw_dirhist_cnt =2
let g:netrw_dirhist_1='/Users/ed/dotfiles'
let g:netrw_dirhist_2='/Users/ed/dotfiles/bash'
4 changes: 3 additions & 1 deletion setup-fedora.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# sudo pkill scadeamon
# sudo pkill gpg-agent

echo "running fedora setup..."

# yum repo for google chrome
echo "setup yum repos"
cat << EOF > ./google-chrome.repo
Expand Down Expand Up @@ -49,7 +51,7 @@ stow terraform

source ~/.bashrc

# aws cli
# python tools
pip install --upgrade --user awscli

# GO
Expand Down
58 changes: 44 additions & 14 deletions setup-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,42 @@
# Prior to running this ensure the following are installed:
# Xcode, iTerm 2, Golang

echo "OSX: disable dashboard"
defaults write com.apple.dashboard mcx-disabled -boolean YES; killall Dock
echo "OSX: always show hidden files"
defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder
echo "running OSX setup..."

# see http://www.defaults-write.com
echo "OSX: Disable dashboard"
defaults write com.apple.dashboard mcx-disabled -boolean YES
echo "OSX: Always show hidden files in Finder"
defaults write com.apple.finder AppleShowAllFiles TRUE
echo "OSX: Display file extensions in Finder"
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
echo "OSX: Display full posix path in OS X Finder title Bar"
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
echo "OSX: Change default view style in Finder to List View"
defaults write com.apple.Finder FXPreferredViewStyle Nlsv
echo "OSX: Disable animations when opening and closing windows"
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
echo "OSX: Make all Mission Control animations faster"
defaults write com.apple.dock expose-animation-duration -float 0.1
echo "OSX: disable shadows on screenshots"
defaults write com.apple.screencapture disable-shadow -bool true
echo "OSX: Enable debug menu in Disk Utility"
defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true
echo "OSX: Disable new disks requests for Time Machine"
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
echo "OSX: Disable Dock animations"
defaults write com.apple.dock launchanim -bool false

killall Dock
killall Finder


echo "install homebrew"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
if ! [ -x "$(command -v brew)" ]; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew update
fi
brew update

echo "install brew apps"
Expand All @@ -22,7 +50,11 @@ brew install gpg2
brew install mercurial
brew install openssl
brew install python
brew install python3
brew install stow
brew install ShellCheck
brew install awscli
brew upgrade `brew outdated`

echo "bew install standard gnu utils"
# The --default-names option will prevent Homebrew from prepending a g to each of the newly installed commands
Expand All @@ -45,20 +77,18 @@ brew install watch
brew install wdiff --with-gettext
brew install wget


echo "setup dotfiles"
stow bash
stow git
stow nvim
stow psql
stow terraform

# GOLANG
#mkdir $HOME/.vim/ftdetect
#ln -s $GOROOT/misc/vim/ftdetect/gofiletype.vim $HOME/.vim/ftdetect/
#mkdir $HOME/.vim/syntax
#ln -s $GOROOT/misc/vim/syntax/go.vim $HOME/.vim/syntax
#mkdir $HOME/.vim/autoload
#ln -s $GOROOT/misc/vim/autoload/go/complete.vim $HOME/.vim/autoload/go
source ~/.bashrc

# python tools
pip install --upgrade --user beets

./go-get.sh

echo "done"
8 changes: 8 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash -e

unamestr=$(uname)
if [[ "$unamestr" == 'Linux' ]]; then
./setup-fedora.sh
elif [[ "$unamestr" == 'Darwin' ]]; then
./setup-mac.sh
fi

0 comments on commit ad566bb

Please sign in to comment.