From f1fb79e9d361fa0895281cff8875a87592955e77 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 28 Mar 2014 02:51:56 -0400 Subject: [PATCH] Set up for rbenv & chef --- bin/osx | 85 ---------------------------------- bin/prowl | 34 -------------- bin/prowl-rss | 103 ----------------------------------------- install/c++ | 21 --------- install/cpp/artemis | 34 -------------- install/cpp/sfml | 42 ----------------- install/py/fabric | 3 -- install/py/opengl | 9 ---- install/py/sfml | 8 ---- install/python | 31 ------------- install/rvm | 38 --------------- install/seedbox | 53 --------------------- install/setup_deb.sh | 0 install/setup_mac.sh | 79 ------------------------------- install/tmux | 16 ------- install/vagrant/fabric | 7 --- install/vim | 63 ------------------------- install/zsh | 43 ----------------- zsh/paths | 7 ++- zshrc | 3 -- 20 files changed, 6 insertions(+), 673 deletions(-) delete mode 100755 bin/osx delete mode 100755 bin/prowl delete mode 100755 bin/prowl-rss delete mode 100755 install/c++ delete mode 100755 install/cpp/artemis delete mode 100755 install/cpp/sfml delete mode 100755 install/py/fabric delete mode 100755 install/py/opengl delete mode 100755 install/py/sfml delete mode 100755 install/python delete mode 100755 install/rvm delete mode 100755 install/seedbox delete mode 100755 install/setup_deb.sh delete mode 100755 install/setup_mac.sh delete mode 100755 install/tmux delete mode 100755 install/vagrant/fabric delete mode 100755 install/vim delete mode 100755 install/zsh diff --git a/bin/osx b/bin/osx deleted file mode 100755 index ec74765d..00000000 --- a/bin/osx +++ /dev/null @@ -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 diff --git a/bin/prowl b/bin/prowl deleted file mode 100755 index 9ef6c164..00000000 --- a/bin/prowl +++ /dev/null @@ -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" diff --git a/bin/prowl-rss b/bin/prowl-rss deleted file mode 100755 index 0c021e2d..00000000 --- a/bin/prowl-rss +++ /dev/null @@ -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)) diff --git a/install/c++ b/install/c++ deleted file mode 100755 index c415ebcb..00000000 --- a/install/c++ +++ /dev/null @@ -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!" diff --git a/install/cpp/artemis b/install/cpp/artemis deleted file mode 100755 index 4ebc4cc4..00000000 --- a/install/cpp/artemis +++ /dev/null @@ -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 diff --git a/install/cpp/sfml b/install/cpp/sfml deleted file mode 100755 index 435636fd..00000000 --- a/install/cpp/sfml +++ /dev/null @@ -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 diff --git a/install/py/fabric b/install/py/fabric deleted file mode 100755 index 0d4c2e63..00000000 --- a/install/py/fabric +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env zsh - -pip install fabric diff --git a/install/py/opengl b/install/py/opengl deleted file mode 100755 index 8c05e7b5..00000000 --- a/install/py/opengl +++ /dev/null @@ -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!" diff --git a/install/py/sfml b/install/py/sfml deleted file mode 100755 index 82e0ef19..00000000 --- a/install/py/sfml +++ /dev/null @@ -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!" diff --git a/install/python b/install/python deleted file mode 100755 index fd8f193f..00000000 --- a/install/python +++ /dev/null @@ -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!" diff --git a/install/rvm b/install/rvm deleted file mode 100755 index 96a6cf13..00000000 --- a/install/rvm +++ /dev/null @@ -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!" diff --git a/install/seedbox b/install/seedbox deleted file mode 100755 index 82b4762e..00000000 --- a/install/seedbox +++ /dev/null @@ -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" - - - - - Label - com.flexget - ProgramArguments - - /usr/local/bin/flexget - --cron - - Nice - 1 - StartInterval - 900 - RunAtLoad - - - -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 diff --git a/install/setup_deb.sh b/install/setup_deb.sh deleted file mode 100755 index e69de29b..00000000 diff --git a/install/setup_mac.sh b/install/setup_mac.sh deleted file mode 100755 index d8b6440a..00000000 --- a/install/setup_mac.sh +++ /dev/null @@ -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 diff --git a/install/tmux b/install/tmux deleted file mode 100755 index d8700fc1..00000000 --- a/install/tmux +++ /dev/null @@ -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!" diff --git a/install/vagrant/fabric b/install/vagrant/fabric deleted file mode 100755 index 0822952b..00000000 --- a/install/vagrant/fabric +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env zsh - -BASEDIR=$(dirname "$0") - -$BASEDIR/../python --fabric - -vagrant plugin install vagrant-fabric diff --git a/install/vim b/install/vim deleted file mode 100755 index 11696b41..00000000 --- a/install/vim +++ /dev/null @@ -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!" diff --git a/install/zsh b/install/zsh deleted file mode 100755 index 066715de..00000000 --- a/install/zsh +++ /dev/null @@ -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!" diff --git a/zsh/paths b/zsh/paths index c257aead..b0f7ecdf 100644 --- a/zsh/paths +++ b/zsh/paths @@ -10,8 +10,13 @@ if [ -e /usr/local/bin/brew ]; then 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 + +# global bins PATH=$HOME/.dotfiles/bin:$PATH # vim:set ft=zsh: diff --git a/zshrc b/zshrc index b3d46ad3..092e9091 100644 --- a/zshrc +++ b/zshrc @@ -24,6 +24,3 @@ source ~/.zsh/prompt # Have a system specific rcfile? Source it! [ -f ~/.localrc ] && source ~/.localrc - -# Load RVM into a shell session *as a function* -[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"