Set up for rbenv & chef

This commit is contained in:
Henrik Lissner 2014-03-28 02:51:56 -04:00
parent bb86938d34
commit f1fb79e9d3
20 changed files with 6 additions and 673 deletions

85
bin/osx
View file

@ -1,85 +0,0 @@
#!/usr/bin/env bash
# ~/.osx — http://mths.be/osx
# A script to set a bunch of sane options on osx
source ~/.dotfiles/zsh/functions
keep_alive
###############################################################################
# General UI/UX #
###############################################################################
# Save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
# Set Help Viewer windows to non-floating mode
defaults write com.apple.helpviewer DevMode -bool true
# Restart automatically if the computer freezes
systemsetup -setrestartfreeze on
###############################################################################
# Trackpad, mouse, keyboard, Bluetooth accessories, and input #
###############################################################################
# Trackpad: enable tap to click for this user and for the login screen
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
# Disable press-and-hold for keys in favor of key repeat
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
# Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 0
# Use scroll gesture with the Ctrl (^) modifier key to zoom
defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
# Follow the keyboard focus while zoomed in
defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true
# Disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# Disable Ctrl+click context menu for macvim
defaults write org.vim.MacVim MMTranslateCtrlClick 0
###############################################################################
# Screen #
###############################################################################
# Enable subpixel font rendering on non-Apple LCDs
defaults write NSGlobalDomain AppleFontSmoothing -int 2
# Enable HiDPI display modes (requires restart)
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true
###############################################################################
# Finder #
###############################################################################
# Finder: show status bar
defaults write com.apple.finder ShowStatusBar -bool true
# Finder: 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
# Avoid creating .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -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
# Show the ~/Library folder
chflags nohidden ~/Library

View file

@ -1,34 +0,0 @@
#!/bin/sh
# Sends a growl notification to prowl using curl.
#
# Usage:
# prowl [app] [title] [message]
APIKEYFILE="$HOME/.prowl-apikey"
if [ ! -f "$APIKEYFILE" ]; then
echo "$APIKEYFILE could not be found!"
exit 1
fi
APIKEY=`cat $APIKEYFILE`
# Based on if we have two or three arguments, change the default priority
if [ $# -eq "3" ]; then
APP="$1"
TITLE="$2"
MSG="$3"
elif [ $# -eq "2" ]; then
APP="`hostname`"
TITLE="$2"
MSG="$3"
else
echo "Usage: $0 [app] [title] [message]" >/dev/fd/2
exit 2
fi
curl -s https://api.prowlapp.com/publicapi/add \
-F apikey="$APIKEY" \
-F application="$APP" \
-F event="$TITLE" \
-F description="$MSG"

View file

@ -1,103 +0,0 @@
#!/usr/bin/env python
# Checks to see if certain RSS feeds (listed in ~/.prowl-rss/feeds) have been
# updated recently, and if so, send a prowl notification.
# It stores read guids in ~/.prowl-rss/guids.
#
# Intended to be run via cron or on-demand.
from __future__ import print_function
import httplib2
import urllib
import feedparser
import time
import sys
import os
import re
###
API_FILE = os.path.expanduser("~") + "/.prowl-apikey"
GUID_FILE = os.path.expanduser("~") + "/.prowl-rss/guids"
FEEDS_FILE = os.path.expanduser("~") + "/.prowl-rss/feeds"
API_DOMAIN = 'https://prowl.weks.net/publicapi'
# Pulled out of prowlpy @ https://github.com/omgmovieslol/prowlpy/tree/master
def prowl_post(api, app=None, event=None, desc=None, priority=0):
# Create the http object
h = httplib2.Http()
# Set User-Agent
headers = {'User-Agent': "Prowlpy/%s" % "0.41"}
# Perform the request and get the response headers and content
data = {
'apikey': api,
'application': app,
'event': event,
'description': desc,
'priority': priority
}
headers["Content-type"] = "application/x-www-form-urlencoded"
resp,content = h.request("%s/add/" % API_DOMAIN, "POST", headers=headers, body=urllib.urlencode(data))
if resp['status'] == '200':
return True
elif resp['status'] == '401':
raise Exception("Auth Failed: {0}".format(content))
else:
raise Exception("Failed")
###
try:
guids = [line.strip() for line in open(GUID_FILE)]
conf = [line.strip() for line in open(FEEDS_FILE)]
with open(API_FILE) as f:
apikey = f.read().strip()
feeds = conf
##
fo = open(GUID_FILE, "a")
for feed in feeds:
f = feed.split(' ', 1)
print("-- Parsing {0}".format(f[0]))
xml = feedparser.parse(f[0])
for e in xml.entries:
title = e.title.encode('utf-8')
try:
guid = e.guid
except Exception:
guid = e.link
if guid not in guids:
print("-- Looking")
if len(f) > 1 and not re.match(f[1], e.title):
print("-- Does not match! Ignoring")
continue
print("-- Found, reporting: {0}".format(title))
msg = "{0} - {1}".format(xml.feed.title.encode('utf-8'), title)
prowl_post(apikey, "RSS", title, msg)
print("-- Writing to guids")
fo.write("{0}\n".format(guid))
guids.append(guid)
print("Found: {0} => {1}".format(title, e.link))
else:
print("Ignored: {0} => {1}".format(title, e.link))
pass
fo.close()
except IOError, e:
print("{0} file couldn't be found/opened".format(e.filename))
sys.exit(1)
except Exception, msg:
print("Error: {0}".format(msg))

View file

@ -1,21 +0,0 @@
#!/usr/bin/env zsh
source ~/.dotfiles/zsh/functions
BASEDIR=$(dirname "$0")
echo_g "==> C++: Making sure prereqs are installed (cmake + git)"
pkg_install cmake
is_mac && pkg_install git
is_deb && pkg_install git-core
while [ $# -gt 0 ]; do
case "$1" in
"--sfml") $BASEDIR/cpp/sfml ;;
"--artemis") $BASEDIR/cpp/artemis ;;
esac
shift
done
echo_g "==> C++: All done!"

View file

@ -1,34 +0,0 @@
#!/usr/bin/env zsh
if is_mac; then
keep_alive
if [ ! -d "/usr/local/include/Artemis" ]; then
echo_g "==> C++/Artemis: Attempting to compile ArtemisCpp"
if git clone https://github.com/vinova/Artemis-Cpp.git ~/.artcpp; then
cd ~/.artcpp
mkdir build
cd build
cmake ..
make
sudo make install
rm -rf ~/.artcpp
echo_g "==> C++/Artemis: Done!"
else
echo_r "==> C++/Artemis: Something went wrong installing ArtemisCpp"
RETVAL=3
fi
else
echo_r "==> C++/Artemis: Artemis is already installed"
RETVAL=2
fi
elif is_deb; then
echo_r "==> C++/Artemis: Install script for linux not finished!"
RETVAL=1
fi
exit $RETVAL

View file

@ -1,42 +0,0 @@
#!/usr/bin/env zsh
RETVAL=0
if is_mac; then
keep_alive
# Get SFML 2.1
if [ ! -d /Library/Frameworks/SFML.framework ]; then
echo_g "==> C++/SFML: Installing SFML 2.1"
mkdir ~/.temp-sfml
cd ~/.temp-sfml
SFML="SFML-2.1-osx-gcc-universal.tar.gz"
# wget http://www.sfml-dev.org/download/sfml/2.1/SFML-2.1-osx-clang-universal.tar.gz
if wget http://www.sfml-dev.org/download/sfml/2.1/$SFML; then
tar -xvf $SFML
cd $SFML
sudo ./install.sh
rm -rf ~/.temp-sfml
echo_g "==> C++/SFML: Done!"
else
echo_r "==> C++/SFML: Something went wrong downloading SFML 2.1"
RETVAL=3
fi
else
echo_r "==> C++/SFML: SFML 2.1 is already installed"
RETVAL=2
fi
elif is_deb; then
echo_r "==> C++/SFML: Install script for linux is incomplete!"
RETVAL=1
fi
exit $RETVAL

View file

@ -1,3 +0,0 @@
#!/usr/bin/env zsh
pip install fabric

View file

@ -1,9 +0,0 @@
#!/usr/bin/env zsh
keep_alive
echo_g "==> Py/OpenGL: Installing PyOpenGL"
sudo pip install PyOpenGL PyOpenGL_accelerate
echo_g "==> Py/OpenGL: Done!"

View file

@ -1,8 +0,0 @@
#!/usr/bin/env zsh
echo_g "==> Py/SFML: Installing PySFML v1.3"
# Install v1.3 tag because there are bugs in 1.4 atm
pip install git+git://github.com/Sonkun/python-sfml.git@v1.3
echo_g "==> Py/SFML: Done!"

View file

@ -1,31 +0,0 @@
#!/usr/bin/env zsh
keep_alive
BASEDIR=$(dirname "$0")
echo_g "==> Python: Trying to install Python"
pkg_install python
echo_g "==> Python: Installing plugins"
sudo easy_install pip
while [ $# -gt 0 ]; do
case "$1" in
"--opengl")
$BASEDIR/py/opengl
;;
"--sfml")
sudo easy_install cython
$BASEDIR/py/sfml
;;
"--fabric")
pip install Jinja2
pip install fabtools
$BASEDIR/py/fabric
;;
esac
shift
done
echo_g "==> Python: Done!"

View file

@ -1,38 +0,0 @@
#!/usr/bin/env zsh
export rvm_ignore_dotfiles=yes
if ! command_exists rvm; then
# If RVM's not installed, install it and the rubies
echo_g "==> Rvm: Installing"
# https://rvm.io
curl -L https://get.rvm.io | bash -s stable
else
# Update it
# Make sure rvm is sourced properly
if [ -f ~/.rvm/scripts/rvm ]; then
[ "$(type rvm | grep function)" ] || source ~/.rvm/scripts/rvm
fi
# Update RVM
echo_g "==> Rvm: Updating"
rvm get stable
fi
# Update all rubies and rubygems
echo_g "==> Rvm: Updating rubies"
rvm all do gem update --system
rvm all do gem update
# Only mac needs this
if is_mac; then
# Update system ruby
echo_g "==> Rvm: Updating system ruby"
rvm use system
sudo gem update --system
sudo gem update
fi
echo_g "==> Rvm: DONE!"

View file

@ -1,53 +0,0 @@
#!/bin/sh
source ~/.dotfiles/zsh/functions
BASEDIR=$(dirname "$0")
$BASEDIR/python
pip install flexget
pip install transmissionrpc
while [ $# -gt 0 ]; do
case "$1" in
"--daemon")
if is_mac; then
brew install transmission
plistf="$HOME/Library/LaunchAgents/com.flexget.plist"
if [ ! -f "$plistf" ]; then
touch $plistf
cat <<-EOF > "$plistf"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.flexget</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/flexget</string>
<string>--cron</string>
</array>
<key>Nice</key>
<integer>1</integer>
<key>StartInterval</key>
<integer>900</integer>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOF
fi
launchctl load -w "$plistf"
mkdir -p ~/.flexget
vim ~/.flexget/config.yml
elif is_deb; then
sudo add-apt-repository ppa:transmissionbt/ppa
pkg_install transmission-cli transmission-daemon transmission-common
fi
;;
esac
shift
done

View file

View file

@ -1,79 +0,0 @@
#!/bin/sh
source ~/.dotfiles/zsh/functions
BASEDIR=$(dirname "$0")
if ! is_mac; then
echo_r "==> Aborting. This isn't a mac!"
exit 1
fi
keep_alive
$BASEDIR/zsh
if ! command_exists brew; then
echo_g "==> Installing homebrew"
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
echo_g "==> Accept xcode agreement"
sudo xcodebuild -license
echo_g "==> Done! Please run this again (don't forget to do brew doctor first)"
else
echo_g "==> Installing basic brews"
if ! brew tap | grep dupes >/dev/null; then
brew tap homebrew/dupes
fi
brew install wget curl git
brew install the_silver_searcher
brew install lua --with-completion
if ! brew list | grep brew-cask >/dev/null; then
echo_g "==> Installing brew cask"
brew tap phinze/homebrew-cask
brew install brew-cask
else
echo_g "==> Cask already installed!"
fi
while [ $# -gt 0 ]; do
case "$1" in
"--basic")
echo_g "==> Installing basic bundle"
# Install the apps I find essential for every mac I'm on
# (that I don't get through the app store)
brew cask install appcleaner
brew cask install google-chrome
brew cask install launchbar
brew cask install dropbox
brew cask install iterm2
brew cask install sequel-pro
brew cask install transmission
brew cask install transmit
;;
"--dev")
echo_g "==> Installing dev bundle"
brew cask install codekit
brew cask install vagrant
;;
"--home")
echo_g "==> Installing home bundle"
brew cask install adium
brew cask install reggy
brew cask install net-news-wire
brew cask install soulver
brew cask install scrivener
brew cask install skype
brew cask install vlc
;;
esac
shift
done
echo_g "==> Done!"
fi

View file

@ -1,16 +0,0 @@
#!/usr/bin/env zsh
if ! command_exists tmux; then
echo_g "==> Installing tmux"
pkg_install tmux
if is_mac; then
brew install reattach-to-user-namespace libevent
fi
else
echo_r "==> Tmux is already installed!"
fi
echo_g "==> Tmux: Setting up symlinks"
rm -rf ~/.tmux.conf && ln -sf ~/.dotfiles/tmux.conf ~/.tmux.conf
echo_g "==> DONE!"

View file

@ -1,7 +0,0 @@
#!/usr/bin/env zsh
BASEDIR=$(dirname "$0")
$BASEDIR/../python --fabric
vagrant plugin install vagrant-fabric

View file

@ -1,63 +0,0 @@
#!/usr/bin/env zsh
# Installing macvim/compiling vim
if is_mac && ! command_exists "mvim"; then
echo_g "==> Installing macvim"
brew install macvim --devel --with-lua --override-system-vim
elif is_deb && ! vim --version | grep "Compiled by $(whoami)@$(hostname)" 2>&1 >/dev/null; then
# All the prereqs to compile vim. Might need to add lua...
echo_g "==> Preparing to compile vim from source"
pkg_install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev ruby-dev mercurial
pkg_remove vim vim-runtime gvim
# Compile vim from source (needs Vim 7.3.584 *at least*, but we grab the latest 7.4
# from the repo for good measure). At the time of writing, Debian still uses 7.2 and
# Ubuntu: 7.3.
cd ~
hg clone https://code.google.com/p/vim/
cd vim
hg checkout v7-4-131
echo_g "==> Compiling vim from source"
./configure --with-features=huge \
--enable-rubyinterp \
--enable-pythoninterp \
--enable-perlinterp \
--enable-luainterp \
--enable-gui=gtk2 --enable-cscope --prefix=/usr
make VIMRUNTIMEDIR=/usr/share/vim/vim74
sudo make install
rm -rf ~/vim
fi
# Installing vim rcfiles
if [ ! -e ~/.vim/.git ]; then
echo_g "==> Installing vim rcfiles"
if [ -d ~/.vim ]; then
rm -rf ~/.vim
rm ~/.vimrc
rm ~/.vimrc.bundles
rm ~/.gvimrc
fi
if is_deb; then
pkg_install cmake
fi
# Install vim from my distro: https://github.com/hlissner/mlvim
git clone https://github.com/hlissner/vim ~/.vim
vim -u ~/.vim/.vimrc
else
# Installing/updating vim bundles
echo_r "==> Updating vim"
vim +NeoBundleUpdate +qall
fi
echo_g "==> Vim: DONE!"

View file

@ -1,43 +0,0 @@
#!/usr/bin/env bash
source ~/.dotfiles/zsh/functions
if [ ! -d ~/.oh-my-zsh ]; then
# Try to install zsh
if ! pkg_install zsh; then
echo_g "==> ZSH: Homebrew is not installed!"
exit 1
fi
# https://github.com/robbyrussell/oh-my-zsh
if [ ! -d ~/.oh-my-zsh ]; then
echo_g "==> ZSH: Installing oh-my-zsh"
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
fi
# Set new shell
echo_g "==> ZSH: Changing shell"
if is_mac; then
zsh_bin="`brew --prefix`/bin/zsh"
echo $zsh_bin | sudo tee /etc/shells
else
zsh_bin="/usr/bin/zsh"
echo $zsh_bin | sudo tee -a /etc/shells
fi
# Change the shell
chsh -s "$zsh_bin"
else
echo_g "==> ZSH: Updating"
cd ~/.oh-my-zsh
git pull
fi
# Create links
echo_g "==> ZSH: Setting up symlinks"
rm -f ~/.zsh && ln -sf ~/.dotfiles/zsh ~/.zsh
rm -f ~/.zshrc && ln -sf ~/.dotfiles/zshrc ~/.zshrc
rm -f ~/.zshenv && ln -sf ~/.dotfiles/zshenv ~/.zshenv
rm -f ~/.bashrc && ln -sf ~/.dotfiles/bashrc ~/.bashrc
echo_g "==> ZSH: DONE!"

View file

@ -10,8 +10,13 @@ if [ -e /usr/local/bin/brew ]; then
fi fi
fi fi
PATH=$HOME/.rvm/bin:$PATH # rbenv paths
[ -d $HOME/.rbenv ] && PATH=$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH
# hostname-specific bins
[ -d $HOME/.dotfiles/bin/`hostname` ] && PATH=$HOME/.dotfiles/bin/`hostname`:$PATH [ -d $HOME/.dotfiles/bin/`hostname` ] && PATH=$HOME/.dotfiles/bin/`hostname`:$PATH
# global bins
PATH=$HOME/.dotfiles/bin:$PATH PATH=$HOME/.dotfiles/bin:$PATH
# vim:set ft=zsh: # vim:set ft=zsh:

3
zshrc
View file

@ -24,6 +24,3 @@ source ~/.zsh/prompt
# Have a system specific rcfile? Source it! # Have a system specific rcfile? Source it!
[ -f ~/.localrc ] && source ~/.localrc [ -f ~/.localrc ] && source ~/.localrc
# Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"