First Commit

This commit is contained in:
Robert R Evans
2010-10-02 11:55:34 -07:00
commit 9c7cd9aa00
25 changed files with 2344 additions and 0 deletions

34
functions/base.bash Normal file
View File

@@ -0,0 +1,34 @@
function rh {
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
}
function ips {
ifconfig | grep "inet " | awk '{ print $2 }'
}
# View man documentation in Preview
pman () {
man -t "${1}" | open -f -a /Applications/Preview.app/
}
pcurl() {
curl "${1}" | open -f -a /Applications/Preview.app/
}
pri() {
ri -T "${1}" | open -f -a /Applications/Preview.app/
}
# disk usage per directory
usage ()
{
if [ $1 ]
then
du -hd $1
else
du -hd 1
fi
}

13
functions/git.bash Normal file
View File

@@ -0,0 +1,13 @@
function git_remote {
echo "Running: git remote add origin ${GIT_HOSTING}:$1.git"
git remote add origin $GIT_HOSTING:$1.git
}
function git_first_push {
echo "Running: git push origin master:refs/heads/master"
git push origin master:refs/heads/master
}
function git_remove_missing_files() {
git ls-files -d -z | xargs -0 git update-index --remove
}

11
functions/javascript.bash Normal file
View File

@@ -0,0 +1,11 @@
function rails_jquery {
curl -o public/javascripts/rails.js http://github.com/rails/jquery-ujs/raw/master/src/rails.js
}
function jquery_install {
curl -o public/javascripts/jquery.js http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
}
function jquery_ui_install {
curl -o public/javascripts/jquery_ui.js http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js
}

48
functions/nginx.bash Normal file
View File

@@ -0,0 +1,48 @@
function nginx_reload() {
FILE="${NGINX_PATH}/logs/nginx.pid"
if [ -e $FILE ]; then
echo "Reloading NGINX..."
PID=`cat $NGINX_PATH/logs/nginx.pid`
sudo kill -HUP $PID
else
echo "Nginx pid file not found"
return 0
fi
}
function nginx_stop() {
FILE="${NGINX_PATH}/logs/nginx.pid"
if [ -e $FILE ]; then
echo "Stopping NGINX..."
PID=`cat $NGINX_PATH/logs/nginx.pid`
sudo kill -INT $PID
else
echo "Nginx pid file not found"
return 0
fi
}
function nginx_start() {
FILE="${NGINX_PATH}/sbin/nginx"
if [ -e $FILE ]; then
echo "Starting NGINX..."
sudo $NGINX_PATH/sbin/nginx
else
echo "Couldn't start nginx"
fi
}
function nginx_restart() {
FILE="${NGINX_PATH}/logs/nginx.pid"
if [ -e $FILE ]; then
echo "Stopping NGINX..."
PID=`cat $NGINX_PATH/logs/nginx.pid`
sudo kill -INT $PID
sleep 1
echo "Starting NGINX..."
sudo $NGINX_PATH/sbin/nginx
else
echo "Nginx pid file not found"
return 0
fi
}