Merge branch 'master' of git://github.com/revans/bash-it
This commit is contained in:
@@ -1,16 +1,90 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Desktop Programs
|
||||
alias fireworks="open -a '/Applications/Adobe Fireworks CS3/Adobe Fireworks CS3.app'"
|
||||
alias photoshop="open -a '/Applications/Adobe Photoshop CS3/Adobe Photoshop.app'"
|
||||
alias preview="open -a '$PREVIEW'"
|
||||
alias xcode="open -a '/Developer/Applications/Xcode.app'"
|
||||
alias filemerge="open -a '/Developer/Applications/Utilities/FileMerge.app'"
|
||||
alias safari="open -a safari"
|
||||
alias firefox="open -a firefox"
|
||||
alias dashcode="open -a dashcode"
|
||||
# For generic functions.
|
||||
|
||||
function ips {
|
||||
ifconfig | grep "inet " | awk '{ print $2 }'
|
||||
}
|
||||
|
||||
function myip {
|
||||
res=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+')
|
||||
echo "Your public IP is: ${bold_green} $res ${normal}"
|
||||
}
|
||||
|
||||
function mkcd(){
|
||||
mkdir -p "$*"
|
||||
cd "$*"
|
||||
}
|
||||
|
||||
# View man documentation in Preview
|
||||
pman () {
|
||||
man -t "${1}" | open -f -a $PREVIEW
|
||||
}
|
||||
|
||||
|
||||
pcurl() {
|
||||
curl "${1}" | open -f -a $PREVIEW
|
||||
}
|
||||
|
||||
pri() {
|
||||
ri -T "${1}" | open -f -a $PREVIEW
|
||||
}
|
||||
|
||||
quiet() {
|
||||
$* &> /dev/null &
|
||||
}
|
||||
|
||||
banish-cookies() {
|
||||
rm -r ~/.macromedia ~/.adobe
|
||||
ln -s /dev/null ~/.adobe
|
||||
ln -s /dev/null ~/.macromedia
|
||||
}
|
||||
|
||||
# disk usage per directory
|
||||
# in Mac OS X and Linux
|
||||
usage ()
|
||||
{
|
||||
if [ $(uname) = "Darwin" ]; then
|
||||
if [ -n $1 ]; then
|
||||
du -hd $1
|
||||
else
|
||||
du -hd 1
|
||||
fi
|
||||
|
||||
elif [ $(uname) = "Linux" ]; then
|
||||
if [ -n $1 ]; then
|
||||
du -h --max-depth=1 $1
|
||||
else
|
||||
du -h --max-depth=1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# One thing todo
|
||||
function t() {
|
||||
if [[ "$*" == "" ]] ; then
|
||||
cat ~/.t
|
||||
else
|
||||
echo "$*" > ~/.t
|
||||
fi
|
||||
}
|
||||
|
||||
# List all plugins and functions defined by bash-it
|
||||
function plugins-help() {
|
||||
|
||||
echo "bash-it Plugins Help-Message"
|
||||
echo
|
||||
|
||||
set | grep "()" \
|
||||
| sed -e "/^_/d" | grep -v "BASH_ARGC=()" \
|
||||
| sed -e "/^\s/d" | grep -v "BASH_LINENO=()" \
|
||||
| grep -v "BASH_ARGV=()" \
|
||||
| grep -v "BASH_SOURCE=()" \
|
||||
| grep -v "DIRSTACK=()" \
|
||||
| grep -v "GROUPS=()" \
|
||||
| grep -v "BASH_CMDS=()" \
|
||||
| grep -v "BASH_ALIASES=()" \
|
||||
| grep -v "COMPREPLY=()" | sed -e "s/()//"
|
||||
}
|
||||
|
||||
|
||||
if [ -s /usr/bin/firefox ] ; then
|
||||
unalias firefox
|
||||
fi
|
||||
29
plugins/browser.plugin.bash
Normal file
29
plugins/browser.plugin.bash
Normal file
@@ -0,0 +1,29 @@
|
||||
# based on https://gist.github.com/318247
|
||||
|
||||
# Usage: browser
|
||||
# pipe html to a browser
|
||||
# e.g.
|
||||
# $ echo "<h1>hi mom!</h1>" | browser
|
||||
# $ ron -5 man/rip.5.ron | browser
|
||||
|
||||
function browser() {
|
||||
if [ -t 0 ]; then
|
||||
if [ -n "$1" ]; then
|
||||
open $1
|
||||
else
|
||||
cat <<usage
|
||||
Usage: browser
|
||||
pipe html to a browser
|
||||
|
||||
$ echo '<h1>hi mom!</h1>' | browser
|
||||
$ ron -5 man/rip.5.ron | browser
|
||||
usage
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
f="/tmp/browser.$RANDOM.html"
|
||||
cat /dev/stdin > $f
|
||||
open $f
|
||||
fi
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
alias em="emacs"
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Aliases
|
||||
alias g='git'
|
||||
alias gst='git status'
|
||||
alias gs='git status'
|
||||
alias gl='git pull'
|
||||
alias gup='git fetch && git rebase'
|
||||
alias gp='git push'
|
||||
alias gdv='git diff -w "$@" | vim -R -'
|
||||
alias gc='git commit -v'
|
||||
alias gca='git commit -v -a'
|
||||
alias gb='git branch'
|
||||
alias gba='git branch -a'
|
||||
alias gcount='git shortlog -sn'
|
||||
alias gcp='git cherry-pick'
|
||||
alias gco='git checkout'
|
||||
alias gexport='git archive --format zip --output'
|
||||
|
||||
case $OSTYPE in
|
||||
linux*)
|
||||
alias gd='git diff | vim -R -'
|
||||
;;
|
||||
darwin*)
|
||||
alias gd='git diff | mate'
|
||||
;;
|
||||
darwin*)
|
||||
alias gd='git diff'
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
function git-help() {
|
||||
echo "Git Custom Aliases Usage"
|
||||
echo
|
||||
echo " g = git"
|
||||
echo " gst/gs = git status"
|
||||
echo " gl = git pull"
|
||||
echo " gup = git fetch && git rebase"
|
||||
echo " gp = git push"
|
||||
echo " gd = git diff | mate"
|
||||
echo " gdv = git diff -w \"$@\" | vim -R -"
|
||||
echo " gc = git commit -v"
|
||||
echo " gca = git commit -v -a"
|
||||
echo " gb = git branch"
|
||||
echo " gba = git branch -a"
|
||||
echo " gcount = git shortlog -sn"
|
||||
echo " gcp = git cherry-pick"
|
||||
echo " gco = git checkout"
|
||||
echo " gexport = git git archive --format zip --output"
|
||||
echo
|
||||
}
|
||||
56
plugins/git.plugins.bash
Normal file
56
plugins/git.plugins.bash
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
# Adds files to git's exclude file (same as .gitignore)
|
||||
function local-ignore() {
|
||||
echo "$1" >> .git/info/exclude
|
||||
}
|
||||
|
||||
# get a quick overview for your git repo
|
||||
function git_info() {
|
||||
if [ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]; then
|
||||
# print informations
|
||||
echo "git repo overview"
|
||||
echo "-----------------"
|
||||
echo
|
||||
|
||||
# print all remotes and thier details
|
||||
for remote in $(git remote show); do
|
||||
echo $remote:
|
||||
git remote show $remote
|
||||
echo
|
||||
done
|
||||
|
||||
# print status of working repo
|
||||
echo "status:"
|
||||
if [ -n "$(git status -s 2> /dev/null)" ]; then
|
||||
git status -s
|
||||
else
|
||||
echo "working directory is clean"
|
||||
fi
|
||||
|
||||
# print at least 5 last log entries
|
||||
echo
|
||||
echo "log:"
|
||||
git log -5 --oneline
|
||||
echo
|
||||
|
||||
else
|
||||
echo "you're currently not in a git repository"
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
116
plugins/hcht.plugin.bash
Normal file
116
plugins/hcht.plugin.bash
Normal file
@@ -0,0 +1,116 @@
|
||||
#!/bin/bash
|
||||
# hcht.plugin.bash: the handmade commandline history tool
|
||||
# Copyright: (C) 2010 Florian Baumann <flo@noqqe.de>
|
||||
# License: GPL-3 <http://www.gnu.org/licenses/gpl-3.0.txt>
|
||||
# Date: Dienstag 2010-11-30
|
||||
|
||||
### readme
|
||||
# basiclly the handmade commandline history tool was made for storing
|
||||
# informations. yeah, you're right. sounds a bit boring. many other
|
||||
# applications can do this much better. but storing things from commandline?
|
||||
#
|
||||
# hcht was fitted to work at your terminal.
|
||||
# your daily stuff like notices, todos, commands or output from a command.
|
||||
# all these things will be stored without complex syntax.
|
||||
#
|
||||
# once you defined your storing-directory you will be able to easily
|
||||
# save all the stuff listed above.
|
||||
#
|
||||
|
||||
### create a file
|
||||
# the basic feature. open a file, do stuff and save.
|
||||
#
|
||||
# $ hcht evilcommand.hch
|
||||
#
|
||||
# this will create a new file or edit a existing one.
|
||||
# paste your command or notice in your favorite editor
|
||||
|
||||
### show all stored informations
|
||||
# to get an overview of your storedir:
|
||||
#
|
||||
# $ hcht
|
||||
|
||||
### todo with a whole sentence
|
||||
# you can give hcht a bunch of parameters
|
||||
#
|
||||
# $ hcht this is a long reminder about a anything
|
||||
|
||||
### save last executed command
|
||||
# lets say you did a great hack at your system and you
|
||||
# want to save it without complicated use of coping:
|
||||
#
|
||||
# $ hcht !!
|
||||
#
|
||||
# the "!!" will repeat the _last_ command you executed at
|
||||
# your terminal. after asking you about a name the hch file
|
||||
# will be saved.
|
||||
|
||||
### read from stdin
|
||||
# hcht is also able to read anything from stdin.
|
||||
#
|
||||
# $ cat any_important_logfile | hcht anylog
|
||||
#
|
||||
# "anylog" will be the name of the saved file.
|
||||
|
||||
hcht() {
|
||||
# configured?
|
||||
if [ -z $hchtstoredir ]; then
|
||||
echo "ERROR: handmade commandline history tool isn't configured."
|
||||
return 1
|
||||
else
|
||||
hchtstoredir=$(echo $hchtstoredir | sed -e 's/\/$//')
|
||||
fi
|
||||
|
||||
# dir available?
|
||||
if [ ! -d $hchtstoredir ]; then
|
||||
echo "ERROR: No such directory: $hchtstoredir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# get favorite editor
|
||||
if [ -z $EDITOR ]; then
|
||||
EDITOR=$(which vim || which nano)
|
||||
fi
|
||||
|
||||
# check if stdin-data is present and save content
|
||||
if [ "$(tty)" = "not a tty" ]; then
|
||||
hchname=$(echo $1 | sed -e 's/\ //g')
|
||||
if [ -z $hchname ]; then
|
||||
cat < /dev/stdin >> $hchtstoredir/$(date +%Y%m%d%H%M%S).hch
|
||||
else
|
||||
cat < /dev/stdin >> $hchtstoredir/$hchname.hch
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
# list all hch files if no parameter is given
|
||||
if [ $# -eq 0 ]; then
|
||||
for file in $(ls $hchtstoredir); do
|
||||
echo $file
|
||||
done
|
||||
return 0
|
||||
fi
|
||||
|
||||
# if a *.hch file is given start editing or creating it
|
||||
if [ "$#" -eq "1" ]; then
|
||||
if echo "$1" | grep -q -e ".*.hch$" ; then
|
||||
$EDITOR ${hchtstoredir}/${1}
|
||||
return 0
|
||||
else
|
||||
$EDITOR ${hchtstoredir}/${1}.hch
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# autocreate a new hch
|
||||
if [ "$#" -gt "1" ]; then
|
||||
echo -n "define a name: " ; read hchname
|
||||
hchname=$(echo $hchname | sed -e 's/\ /_/g')
|
||||
if [ -z "$hchname" ]; then
|
||||
echo "$*" > $hchtstoredir/${1}-$(date +%Y%m%d%H%M%S).hch
|
||||
else
|
||||
echo "$*" > ${hchtstoredir}/${hchname}.hch
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# heroku
|
||||
alias h='heroku'
|
||||
alias hl='heroku list'
|
||||
alias hi='heroku info'
|
||||
alias ho='heroku open'
|
||||
|
||||
# dynos and workers
|
||||
alias hd='heroku dynos'
|
||||
alias hw='heroku workers'
|
||||
|
||||
# rake console
|
||||
alias hr='heroku rake'
|
||||
alias hcon='heroku console'
|
||||
|
||||
# new and restart
|
||||
alias hnew='heroku create'
|
||||
alias hrestart='heroku restart'
|
||||
|
||||
# logs
|
||||
alias hlog='heroku logs'
|
||||
alias hlogs='heroku logs'
|
||||
|
||||
# maint
|
||||
alias hon='heroku maintenance:on'
|
||||
alias hoff='heroku maintenance:off'
|
||||
|
||||
# heroku configs
|
||||
alias hc='heroku config'
|
||||
alias hca='heroku config:add'
|
||||
alias hcr='heroku config:remove'
|
||||
alias hcc='heroku config:clear'
|
||||
|
||||
function heroku-help() {
|
||||
echo "Heroku Aliases Usage"
|
||||
echo
|
||||
echo " h = heroku"
|
||||
echo " hl = heroku list"
|
||||
echo " hi = heroku info"
|
||||
echo " ho = heroku open"
|
||||
echo " hd = heroku dynos"
|
||||
echo " hw = heroku workers"
|
||||
echo " hr = heroku rake"
|
||||
echo " hcon = heroku console"
|
||||
echo " hnew = heroku create"
|
||||
echo " hrestart = heroku restart"
|
||||
echo " hlog = heroku logs"
|
||||
echo " hon = heroku maintenance:on"
|
||||
echo " hoff = heroku maintenance:off"
|
||||
echo " hc = heroku config"
|
||||
echo " hca = heroku config:add"
|
||||
echo " hcr = heroku config:remove"
|
||||
echo " hcc = heroku config:clear"
|
||||
echo
|
||||
}
|
||||
14
plugins/hg.plugins.bash
Normal file
14
plugins/hg.plugins.bash
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
hg_dirty() {
|
||||
hg status --no-color 2> /dev/null \
|
||||
| awk '$1 == "?" { print "?" } $1 != "?" { print "!" }' \
|
||||
| sort | uniq | head -c1
|
||||
}
|
||||
|
||||
hg_in_repo() {
|
||||
[[ `hg branch 2> /dev/null` ]] && echo 'on '
|
||||
}
|
||||
|
||||
hg_branch() {
|
||||
hg branch 2> /dev/null
|
||||
}
|
||||
17
plugins/javascript.plugins.bash
Normal file
17
plugins/javascript.plugins.bash
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# The install directory is hard-coded. TOOD: allow the directory to be specified on the command line.
|
||||
#
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
182
plugins/jekyll.plugins.bash
Normal file
182
plugins/jekyll.plugins.bash
Normal file
@@ -0,0 +1,182 @@
|
||||
#!/bin/bash
|
||||
|
||||
newpost() {
|
||||
|
||||
# 'builtin cd' into the local jekyll root
|
||||
|
||||
builtin cd "$JEKYLL_LOCAL_ROOT/_posts"
|
||||
|
||||
# Get the date for the new post's filename
|
||||
|
||||
FNAME_DATE=$(date "+%Y-%m-%d")
|
||||
|
||||
# If the user is using markdown formatting, let them choose what type of post they want. Sort of like Tumblr.
|
||||
|
||||
OPTIONS="Text Quote Image Audio Video Link"
|
||||
|
||||
if [ $JEKYLL_FORMATTING = "markdown" -o $JEKYLL_FORMATTING = "textile" ]
|
||||
then
|
||||
select OPTION in $OPTIONS
|
||||
do
|
||||
if [[ $OPTION = "Text" ]]
|
||||
then
|
||||
POST_TYPE="Text"
|
||||
break
|
||||
fi
|
||||
|
||||
if [[ $OPTION = "Quote" ]]
|
||||
then
|
||||
POST_TYPE="Quote"
|
||||
break
|
||||
fi
|
||||
|
||||
if [[ $OPTION = "Image" ]]
|
||||
then
|
||||
POST_TYPE="Image"
|
||||
break
|
||||
fi
|
||||
|
||||
if [[ $OPTION = "Audio" ]]
|
||||
then
|
||||
POST_TYPE="Audio"
|
||||
break
|
||||
fi
|
||||
|
||||
if [[ $OPTION = "Video" ]]
|
||||
then
|
||||
POST_TYPE="Video"
|
||||
break
|
||||
fi
|
||||
|
||||
if [[ $OPTION = "Link" ]]
|
||||
then
|
||||
POST_TYPE="Link"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Get the title for the new post
|
||||
|
||||
read -p "Enter title of the new post: " POST_TITLE
|
||||
|
||||
# Convert the spaces in the title to hyphens for use in the filename
|
||||
|
||||
FNAME_POST_TITLE=`echo $POST_TITLE | tr ' ' "-"`
|
||||
|
||||
# Now, put it all together for the full filename
|
||||
|
||||
FNAME="$FNAME_DATE-$FNAME_POST_TITLE.$JEKYLL_FORMATTING"
|
||||
|
||||
# And, finally, create the actual post file. But we're not done yet...
|
||||
|
||||
touch "$FNAME"
|
||||
|
||||
# Write a little stuff to the file for the YAML Front Matter
|
||||
|
||||
echo "---" >> $FNAME
|
||||
|
||||
# Now we have to get the date, again. But this time for in the header (YAML Front Matter) of
|
||||
# the file
|
||||
|
||||
YAML_DATE=$(date "+%B %d %X")
|
||||
|
||||
# Echo the YAML Formatted date to the post file
|
||||
|
||||
echo "date: $YAML_DATE" >> $FNAME
|
||||
|
||||
# Echo the original post title to the YAML Front Matter header
|
||||
|
||||
echo "title: $POST_TITLE" >> $FNAME
|
||||
|
||||
# And, now, echo the "post" layout to the YAML Front Matter header
|
||||
|
||||
echo "layout: post" >> $FNAME
|
||||
|
||||
# Close the YAML Front Matter Header
|
||||
|
||||
echo "---" >> $FNAME
|
||||
echo >> $FNAME
|
||||
|
||||
# Generate template text based on the post type
|
||||
|
||||
if [[ $JEKYLL_FORMATTING = "markdown" ]]
|
||||
then
|
||||
if [[ $POST_TYPE = "Text" ]]
|
||||
then
|
||||
true
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Quote" ]]
|
||||
then
|
||||
echo "> Quote" >> $FNAME
|
||||
echo >> $FNAME
|
||||
echo "— Author" >> $FNAME
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Image" ]]
|
||||
then
|
||||
echo "" >> $FNAME
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Audio" ]]
|
||||
then
|
||||
echo "<html><audio src=\"/path/to/audio/file\" controls=\"controls\"></audio></html>" >> $FNAME
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Video" ]]
|
||||
then
|
||||
echo "<html><video src=\"/path/to/video\" controls=\"controls\"></video></html>" >> $FNAME
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Link" ]]
|
||||
then
|
||||
echo "[link][1]" >> $FNAME
|
||||
echo >> $FNAME
|
||||
echo "> Quote" >> $FNAME
|
||||
echo >> $FNAME
|
||||
echo "[1]: url" >> $FNAME
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $JEKYLL_FORMATTING = "textile" ]]
|
||||
then
|
||||
if [[ $POST_TYPE = "Text" ]]
|
||||
then
|
||||
true
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Quote" ]]
|
||||
then
|
||||
echo "bq. Quote" >> $FNAME
|
||||
echo >> $FNAME
|
||||
echo "— Author" >> $FNAME
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Image" ]]
|
||||
then
|
||||
echo "!url(alt text)" >> $FNAME
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Audio" ]]
|
||||
then
|
||||
echo "<html><audio src=\"/path/to/audio/file\" controls=\"controls\"></audio></html>" >> $FNAME
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Video" ]]
|
||||
then
|
||||
echo "<html><video src=\"/path/to/video\" controls=\"controls\"></video></html>" >> $FNAME
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Link" ]]
|
||||
then
|
||||
echo "\"Site\":url" >> $FNAME
|
||||
echo >> $FNAME
|
||||
echo "bq. Quote" >> $FNAME
|
||||
fi
|
||||
fi
|
||||
|
||||
# Open the file in your favorite editor
|
||||
|
||||
$EDITOR $FNAME
|
||||
}
|
||||
50
plugins/nginx.plugins.bash
Normal file
50
plugins/nginx.plugins.bash
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
|
||||
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
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
alias f='open -a Finder '
|
||||
|
||||
function tab() {
|
||||
osascript 2>/dev/null <<EOF
|
||||
tell application "System Events"
|
||||
@@ -13,3 +11,27 @@ function tab() {
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
|
||||
# this one switches your os x dock between 2d and 3d
|
||||
# thanks to savier.zwetschge.org
|
||||
function dock-switch() {
|
||||
|
||||
if [ $(uname) = "Darwin" ]; then
|
||||
|
||||
if [ $1 = 3d ] ; then
|
||||
defaults write com.apple.dock no-glass -boolean NO
|
||||
killall Dock
|
||||
|
||||
elif [ $1 = 2d ] ; then
|
||||
defaults write com.apple.dock no-glass -boolean YES
|
||||
killall Dock
|
||||
|
||||
else
|
||||
echo "usage:"
|
||||
echo "dock-switch 2d"
|
||||
echo "dock-switch 3d."
|
||||
fi
|
||||
else
|
||||
echo "sorry. you're currently not using os x"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Rails Commands
|
||||
alias r='rails'
|
||||
alias rg='rails g'
|
||||
alias rs='rails s'
|
||||
alias rc='rails c'
|
||||
alias rn='rails new'
|
||||
alias rd='rails dbconsole'
|
||||
alias rp='rails plugin'
|
||||
alias ra='rails application'
|
||||
alias rd='rails destroy'
|
||||
|
||||
alias ss='script/server'
|
||||
alias ts="thin start" # thin server
|
||||
alias sc='script/console'
|
||||
alias restartapp='touch tmp/restart.txt'
|
||||
alias restart='touch tmp/restart.txt' # restart passenger
|
||||
alias devlog='tail -f log/development.log'
|
||||
alias taild='tail -f log/development.log' # tail dev log
|
||||
|
||||
function rails-help() {
|
||||
echo "Rails Aliases Usage"
|
||||
echo
|
||||
echo " r = rails"
|
||||
echo " rg = rails generate"
|
||||
echo " rs/ss = rails server"
|
||||
echo " ts = thin server"
|
||||
echo " rc/sc = rails console"
|
||||
echo " rn = rails new"
|
||||
echo " rd = rails dbconsole"
|
||||
echo " rp = rails plugin"
|
||||
echo " ra = rails application"
|
||||
echo " rd = rails destroy"
|
||||
echo " restartapp = touch tmp/restart.txt"
|
||||
echo " restart = touch tmp/restart.txt"
|
||||
echo " devlog = tail -f log/development.log"
|
||||
echo " taild = tail -f log/development.log"
|
||||
echo
|
||||
}
|
||||
|
||||
@@ -13,4 +13,4 @@ rvm_default () {
|
||||
|
||||
function rvm_version () {
|
||||
ruby --version
|
||||
}
|
||||
}
|
||||
9
plugins/ssh.plugins.bash
Normal file
9
plugins/ssh.plugins.bash
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
function add_ssh() {
|
||||
echo -en "\n\nHost $1\n HostName $2\n User $3\n ServerAliveInterval 30\n ServerAliveCountMax 120" >> ~/.ssh/config
|
||||
}
|
||||
|
||||
function sshlist() {
|
||||
awk '$1 ~ /Host$/ { print $2 }' ~/.ssh/config
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Textmate
|
||||
alias e='mate . &'
|
||||
alias et='mate app config db lib public script test spec config.ru Gemfile Rakefile README &'
|
||||
50
plugins/vagrant.plugins.bash
Normal file
50
plugins/vagrant.plugins.bash
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
_vagrant()
|
||||
{
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
commands="box destroy halt help init package provision reload resume ssh ssh_config status suspend up version"
|
||||
|
||||
if [ $COMP_CWORD == 1 ]
|
||||
then
|
||||
COMPREPLY=($(compgen -W "${commands}" -- ${cur}))
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ $COMP_CWORD == 2 ]
|
||||
then
|
||||
case "$prev" in
|
||||
"box")
|
||||
box_commands="add help list remove repackage"
|
||||
COMPREPLY=($(compgen -W "${box_commands}" -- ${cur}))
|
||||
return 0
|
||||
;;
|
||||
"help")
|
||||
COMPREPLY=($(compgen -W "${commands}" -- ${cur}))
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ $COMP_CWORD == 3 ]
|
||||
then
|
||||
action="${COMP_WORDS[COMP_CWORD-2]}"
|
||||
if [ $action == 'box' ]
|
||||
then
|
||||
case "$prev" in
|
||||
"remove"|"repackage")
|
||||
local box_list=$(find $HOME/.vagrant/boxes/* -maxdepth 0 -type d -printf '%f ')
|
||||
COMPREPLY=($(compgen -W "${box_list}" -- ${cur}))
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
complete -F _vagrant vagrant
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
alias v='mvim --remote-tab'
|
||||
|
||||
Reference in New Issue
Block a user