Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Malinovich demonbane

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am demonbane on github.
  • I am demonbane (https://keybase.io/demonbane) on keybase.
  • I have a public key whose fingerprint is 9584 D5C6 0538 9579 552A 2368 9EA1 AAC6 985B 9388

To claim this, I am signing this object:

View gist:7207
#!/bin/bash
echo -n "Dumping database... "
if mysqldump -u xxxx mydbname > db/fulldump.sql; then
echo "done."
echo -n "Committing new changes... "
if git add db/fulldump.sql; then
echo "done."
else
echo 'failed!'
exit 1
View pre-commit
#!/bin/bash
echo -n "Dumping database... "
if mysqldump -u xxxx mydbname > db/fulldump.sql; then
echo "done."
echo -n "Committing new changes... "
if git add db/fulldump.sql; then
echo "done."
else
echo 'failed!'
exit 1
View gist:54695
# 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
View gist:93444
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")
View gist:93488
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.
View gist:142249
# 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`
View gist:252998
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
}
View .gitconfig
[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"'
View rails_migration.sh
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
}