Skip to content

Instantly share code, notes, and snippets.

@sprhawk
sprhawk / git_submodule
Created November 23, 2011 17:08
git command: submodule
$ git submodule add (NOTE: Do not use local URLs here if you plan to publish your superproject!)
Pulling down the submodules is a two-step process. First run git submodule
init to add the submodule repository URLs to .git/config:
$ git submodule init
$ git submodule update
If you want to make a change within a submodule and you have a detached head, then you should create or checkout a branch, make your changes, publish the change within the submodule, and then update the superproject to reference the new commit:
@sprhawk
sprhawk / gist:1389453
Created November 23, 2011 18:24
git command: revert
$ git revert HEAD
Finished one revert.
[master]: created 1e689e2:
"Revert "Updated to Rails 2.3.2 and edge hoptoad_notifier""
$ git revert HEAD~3
ssh-keygen -t rsa -C "..."
to ~/.ssh/github_id_rsa
ssh-add ~/.ssh/github_id_rsa
ssh -T [email protected]
@sprhawk
sprhawk / gist:1398957
Created November 28, 2011 03:24
git command: stash
$ git stash save "work in progress for foo feature"
$ git commit -a -m "blorpl: typofix"
$ git stash apply
$ git stash list
$ git stash apply stash@{1}
@sprhawk
sprhawk / gist:1399047
Created November 28, 2011 04:04
git command: creating new empty branches
git symbolic-ref HEAD refs/heads/newbranch
rm .git/index
git clean -fdx
<do work>
git add your files
git commit -m 'Initial commit'
http://book.git-scm.com/5_creating_new_empty_branches.html
@sprhawk
sprhawk / gist:1399969
Created November 28, 2011 10:55
imagemagick
mogrify -path ../temp/ -resize 40% *.jpg
@sprhawk
sprhawk / 12306.user.js
Created January 5, 2012 10:29 — forked from quietlynn/12306.user.js
12306 Auto Query => A javascript snippet to help you book ticket
/*
12306 Auto Query => A javascript snippet to help you book tickets online.
Copyright (C) 2011 Jingqin Lynn
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes Sizzle.js
@sprhawk
sprhawk / gist:2012266
Created March 10, 2012 17:44
change file extension
for a in *.added; do mv $a $
{a%%.added}; done
@sprhawk
sprhawk / gist:2202691
Created March 26, 2012 03:36
postgresql
postgres=# select * from pg_stat_activity;
select pg_terminate_backend(13514) from pg_stat_activity where datname='collab';
dwarfdump --lookup 0x00003a04 --arch armv6 myApp.app.dSYM
atos -arch armv7 -o 'app name.app'/'app name' 0x0003b508