Permalink
Browse files

Merge branch 'develop'

* develop:
  Adding in the vim-surround plugin
  Adding in the vim-markdown plugin
  Adding in the vim-fugitive plugin
  Adding in existing scripts and configs
  • Loading branch information...
2 parents a138db9 + a68e32e commit 92daf8d013efd052f312980d798e09eeac57ea28 @zachseifts committed Jul 24, 2012
Showing with 871 additions and 0 deletions.
  1. +12 −0 .gitignore
  2. +9 −0 .gitmodules
  3. +61 −0 bin/alarm.py
  4. +33 −0 bin/backup.sh
  5. +6 −0 bin/cleanup_drupal_backups.sh
  6. +66 −0 bin/deploy_site.sh
  7. +12 −0 bin/drupal_cron.sh
  8. +22 −0 bin/gdocs_email
  9. +5 −0 bin/gdocs_weekly
  10. +46 −0 bin/redirects.py
  11. +31 −0 bin/update_site.sh
  12. +73 −0 init.sh
  13. +60 −0 inputrc
  14. +28 −0 screenrc
  15. +44 −0 tmux.conf
  16. +245 −0 vim/autoload/pathogen.vim
  17. +1 −0 vim/bundle/vim-fugitive
  18. +1 −0 vim/bundle/vim-markdown
  19. +1 −0 vim/bundle/vim-surround
  20. +41 −0 vimrc
  21. +74 −0 zshrc
View
@@ -0,0 +1,12 @@
+.DS_Store
+*~
+*.swp
+*.pyc
+tmp/**/*
+.cache/
+settings.conf
+*.log
+.hg/
+.hgignore
+.zsh/.zsh_history*
+
View
@@ -0,0 +1,9 @@
+[submodule "vim/bundle/vim-fugitive"]
+ path = vim/bundle/vim-fugitive
+ url = https://github.com/tpope/vim-fugitive.git
+[submodule "vim/bundle/vim-markdown"]
+ path = vim/bundle/vim-markdown
+ url = https://github.com/tpope/vim-markdown.git
+[submodule "vim/bundle/vim-surround"]
+ path = vim/bundle/vim-surround
+ url = https://github.com/tpope/vim-surround.git
View
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+__author__ = 'Zach Seifts <zach.seifts@gmail.com>'
+__version__ = '1.0'
+
+import os
+import time
+
+from random import choice
+from datetime import datetime
+from appscript import *
+
+cmd = 'osascript -e "set Volume %d"'
+
+class NoPlaylistExists(Exception): pass
+
+class Playlist(object):
+ ''' Represents a iTunes playlist. '''
+
+ def __init__(self, **kwargs):
+ os.system('open -a iTunes')
+ self.playlist_title = kwargs.get('playlist_title', 'Live @')
+ self.get_playlist_by_title()
+ self.play()
+
+ def get_playlist_by_title(self):
+ ''' Sets the playlist and tracks according to the title. '''
+ playlists = [a for a in app('iTunes').playlists()]
+ for l in playlists:
+ if l.name() == self.playlist_title:
+ self.playlist = l
+ self.tracks = l.tracks()
+ break
+ if not hasattr(self, 'playlist'):
+ raise NoPlaylistExists
+
+ def _get_random_song(self):
+ return choice(self.tracks)
+ random_song = property(_get_random_song)
+
+ def play(self):
+ song = self.random_song()
+ song.play()
+
+
+def main():
+ start_time = datetime.now()
+ min_volume = 0
+ max_volume = 10
+ snooze = 20
+
+ os.system(cmd % min_volume)
+ pl = Playlist()
+
+ for i in range(max_volume):
+ os.system(cmd % (i,))
+ time.sleep(snooze)
+
+if __name__ == '__main__':
+ main()
+
View
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+#replace with external drive
+backup=/Volumes/backup
+exclude=/Volumes/backup/.rsync/exclude
+full_backup=$backup/$(hostname)
+rsync=/usr/bin/rsync
+
+quit() {
+ exit 1
+}
+
+if [[ -z $1 ]]
+then
+ echo "No backup source."
+ quit
+fi
+
+if [[ -d $backup ]]
+then
+ if [[ ! -d $full_backup ]]
+ then
+ mkdir $full_backup
+ fi
+
+ rsync -avz --delete --delete-excluded --exclude-from=$exclude --links $1 $full_backup
+else
+ echo "Drive is not mounted."
+ quit
+fi
+
+quit
+
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+DRUPAL_BACKUPS=/Users/zach/projects/backup
+THINGS_BACKUP=/Volumes/things/backups
+find $DRUPAL_BACKUPS -type f -mtime +7 -exec mv {} $THINGS_BACKUP \;
+
View
@@ -0,0 +1,66 @@
+#/bin/bash
+
+## Backsup and deploys a site.
+
+quit() {
+ exit 1
+}
+
+if [[ -z $1 || -z $2 ]]
+then
+ echo "what site do you want to backup and deploy?"
+ quit
+fi
+
+if [[ -d $1 ]]
+then
+ tar_file=$1.tar.gz
+ vhosts_conf=$1/$2.conf
+ mysql_conf=$1/$2.mysql
+
+ # temp files that sed creates
+ vhosts_confe=$1/$2.confe
+ mysql_confe=$1/$2.mysqle
+
+ echo "editing vhosts files"
+
+ echo "changing ServerName"
+ sed -ie '/drupaldev/d' $vhosts_conf
+ sed -ie 's/#ServerName/ ServerName/g' $vhosts_conf
+
+ echo "changing the DocumentRoot"
+ sed -ie 's/home/var/g' $vhosts_conf
+
+ echo "changing the cosign cert path"
+ sed -ie 's/cmspilot/cmsprod/g' $vhosts_conf
+
+ #echo "removing drupaldev references from the mysql"
+ #sed -ie 's/drupaldev[0-9][0-9]/'$2'/g' $mysql_conf
+
+ if [[ -f $vhosts_confe ]]
+ then
+ echo "removing vhsots.confe file"
+ rm $vhosts_confe
+ fi
+ #if [[ -f $mysql_confe ]]
+ #then
+ # echo "removing mysql.confe file"
+ # rm $mysql_confe
+ #fi
+
+ # package up the site
+ echo "tarring up the site"
+ /usr/local/bin/gtar -pczf $tar_file $1
+
+ echo "uploading to cmsprod"
+ scp $tar_file cmsprod.appstate.edu:~/
+
+ echo "finished, now create that TE ticket and URL request"
+
+else
+ echo "is this a site?"
+ quit
+fi
+
+quit
+
View
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+DRUSH=/usr/local/bin/drush
+PROJECTS=$HOME/projects/dev
+
+for d in $(find $PROJECTS -type d -depth 1)
+do
+ if [ -f $d/sites/default/settings.php ]; then
+ $DRUSH -r $d cron
+ fi
+done
+
View
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+#
+# Emails weekly updates to an email
+#
+# usage: ./gdocs_email email@example.com
+#
+
+google=/usr/local/bin/google
+mail=/usr/bin/mail
+updates_dump=/tmp/weekly-$(date +%Y)-$(date +%V).txt
+email_subject="Weekly Update: $(date +"%A %B %d, %Y")"
+
+if [ $# -ne 1 ]
+ then
+ echo "Usage: gdocs_email <email>"
+ exit;
+fi
+
+$google docs get "Work $(date +%Y) $(date +%V)" $updates_dump
+$mail -s "$email_subject" $1 < $updates_dump
+
View
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+google=/usr/local/bin/google
+$google docs edit "Work $(date +%Y) $(date +%V)" --editor=vim --folder=weekly
+
View
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+"""
+Converts a csv document of redirects into apache redirect statements.
+"""
+
+import csv
+from urlparse import urlparse
+from optparse import OptionParser
+
+
+class Main(object):
+ ''' Converts a csv file into apache redirects.
+ '''
+
+ def __init__(self, csv_file):
+ self.csv_reader = csv.reader(open(csv_file, 'U'))
+ self.rows = [(x,y) for x,y in self.csv_reader]
+ self.redirect_list = [self.parse_row(row) for row in self.rows]
+ self.redirects = '\n'.join(self.redirect_list)
+
+ def parse_row(self, row):
+ ''' Parses each tuple and turns in into a redirect.'''
+ rule = str()
+ orig_url = urlparse(row[0])
+ orig = orig_url.path[1:].replace('.', '\.')
+ if orig_url.fragment:
+ orig += '#' + orig_url.fragment
+ # Checks if the url is a directory
+ if orig.endswith('/'):
+ orig = orig[:len(orig)-1]
+ orig += '(/)?'
+ # Checks if the url has a querystring on the end
+ if orig_url.query:
+ rule += '\n RewriteCond %%{QUERY_STRING} ^%s$\n' % (orig_url.query)
+ new = urlparse(row[1]).path
+ rule += ' RewriteRule ^%s$ %s [R=301,L]' % (orig, new)
+ return rule
+
+
+if __name__ == '__main__':
+ parser = OptionParser()
+ (options, args) = parser.parse_args()
+ main = Main(args[0])
+ print main.redirects
+
View
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# Updates a drupal site.
+#
+# usage:
+# update_site.sh <sitename>
+
+ARGS=1;
+BACKUPDIR=/tmp/drupal_updates
+GIT=/usr/local/bin/git
+
+if [ $# -ne $ARGS ]
+ then
+ echo "Usage: update_site.sh <sitename>"
+ exit;
+fi
+
+mkdir -p $BACKUPDIR
+cd $BACKUPDIR
+$GIT clone git@cmspilot.appstate.edu:$1.git
+cd $1
+$GIT config core.filemode false
+$GIT checkout develop
+$GIT remote add drupal git@cmspilot.appstate.edu:drupal.git
+$GIT pull drupal master
+$GIT checkout master
+$GIT merge --no-ff develop
+$GIT remote rm drupal
+$GIT push
+rm -rf $BACKUPDIR
+
View
73 init.sh
@@ -0,0 +1,73 @@
+#!/bin/bash
+
+OH_MY_ZSH_DIR=$HOME/.oh-my-zsh
+
+if [ ! -d $HOME/.dotfiles ]; then
+ echo "Dotfiles do not exist."
+ cd $HOME
+ git clone git@github.com:zachseifts/dotfiles.git $HOME/.dotfiles
+else
+ echo "Dotfiles exist, pulling in changes"
+ cd $HOME/.dotfiles
+ git pull
+fi
+
+cd $HOME/.dotfiles
+git pull
+git submodule update --init --recursive
+
+if [ -d $OH_MY_ZSH_DIR ]; then
+ cd $OH_MY_ZSH_DIR
+ git pull
+ cd $HOME
+else
+ echo "Checking out oh-my-zsh"
+ git clone git://github.com/robbyrussell/oh-my-zsh.git $HOME/.oh-my-zsh
+fi
+
+cd $HOME
+
+echo "Creating symlinks"
+
+# Symlink the inputrc
+if [ -L $HOME/.inputrc ]; then
+ echo 'inputrc symlink exists, removing'
+ rm $HOME/.inputrc
+fi
+ln -s .dotfiles/inputrc $HOME/.inputrc
+echo "creating symlink to $HOME/.inputrc"
+
+# Symlink the tmux.conf
+if [ -L $HOME/.tmux.conf ]; then
+ echo 'tmux.conf symlink exists, removing'
+ rm $HOME/.tmux.conf
+fi
+ln -s .dotfiles/tmux.conf $HOME/.tmux.conf
+echo "creating symlink to $HOME/.tmux.conf"
+
+# Symlink the .vim folder
+if [ -L $HOME/.vim ]; then
+ echo 'vim symlink exists, removing'
+ rm $HOME/.vim
+fi
+ln -s .dotfiles/vim $HOME/.vim
+echo "creating symlink to $HOME/.vim"
+
+# Symlink the .vimrc folder
+if [ -L $HOME/.vimrc ]; then
+ echo 'vim symlink exists, removing'
+ rm $HOME/.vimrc
+fi
+ln -s .dotfiles/vimrc $HOME/.vimrc
+echo "creating symlink to $HOME/.vimrc"
+
+# Symlink the .zshrc folder
+if [ -L $HOME/.zshrc ]; then
+ echo 'zshrc symlink exists, removing'
+ rm $HOME/.zshrc
+fi
+ln -s .dotfiles/zshrc $HOME/.zshrc
+echo "creating symlink to $HOME/.zshrc"
+
+echo "Okay, done."
+
Oops, something went wrong.

0 comments on commit 92daf8d

Please sign in to comment.