Skip to content

Instantly share code, notes, and snippets.

View demonbane's full-sized avatar

Alex Malinovich demonbane

View GitHub Profile
@demonbane
demonbane / gist:942965
Created April 26, 2011 19:44 — forked from schacon/gist:942899
delete all remote branches that have already been merged into master
$ git branch -r --merged |
awk -F"/" '!/(>|master)/ {print $2}' |
xargs -L1 git push origin --delete
alexmalinovich@Shrike:~$ echo role[webserver]
role[webserver]
alexmalinovich@Shrike:~$ touch rolev
alexmalinovich@Shrike:~$ echo role[webserver]
rolev
alexmalinovich@Shrike:~$ echo 'role[webserver]'
role[webserver]
alexmalinovich@Shrike:~$ touch roler
alexmalinovich@Shrike:~$ echo role[webserver]
roler rolev
@demonbane
demonbane / Gemfile
Created April 1, 2010 21:39 — forked from atmos/Gemfile
source :gemcutter
group :runtime do
gem 'sinatra', '~>1.0.0'
gem 'rack', '~>1.0.0'
end
# vim:ft=ruby
function migrate rollback () {
if [ -z "$1" ]; then
rake db:"$0" RAILS_ENV=development && rake db:"$0" RAILS_ENV=test
else
rake db:"$0" RAILS_ENV="$1"
fi
}
[format]
pretty="format:%C(yellow)%h%Creset %C(magenta bold)%aN%Creset%C(blue) %ad%Creset %s"
[log]
date=short
[alias]
amend = commit -v --amend
addp = add --patch
axe = !sh -c 'git log -S"$0"'
emacs () {
if ! /Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n "$@" 2>/dev/null; then
open -a Emacs.app && sleep 1 && /Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n "$@"
fi
}
# Got a bunch of subdirectories in a project that aren't submodules, but should be?
# Here's a quick way to add them all. Just change the find command to only look in
# the directory you want.
for dir in `find vendor/extensions -type d -name .git`; do url=`cd "$dir" && git config --get remote.origin.url`; dir="${dir%/.git}"; git rm -r --cached "$dir" && git submodule add "$url" "$dir"; done
## Or, slightly more readable
for dir in `find vendor/extensions -type d -name .git`; do
url=`cd "$dir" && git config --get remote.origin.url`
@demonbane
demonbane / gist:93488
Created April 11, 2009 07:17 — forked from schacon/gist:1
This is gist.
There are many like it, but this one is mine.
It is my life.
I must master it as I must master my life.
Without me gist is useless.
Without gist, I am useless.
IP=$(wget -qO - http://ww)
while [ "$type" != "0" ]; do
echo 1 - Eject SCD0
echo 2 - Eject SCD1
echo 3 - Close SCD0
echo 4 - Close SCD1
echo 0 - Quit
read -n1 type
case "$type" in
"1")
# This requires modifications to your personal .bashrc as well as
# root's .bashrc (and changes to the sudo setup). It is dirty and
# should not ever be used by anyone. Ever. :)
########## personal .bashrc #############
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups