Skip to content

Instantly share code, notes, and snippets.

@aphahn
aphahn / gist:5202851
Created March 20, 2013 07:08
Tired of cleaning out your merged Gerrit branches by hand? Freaked out when git tells you your branches aren't fully merged yet (but it's actually fine because it changed SHA1 at rebase time)? Just run `gerrit-clean` in your repository and it will delete branches that have been merged into your master.
function gerrit-clean () {
for branch in $(git for-each-ref --format='%(refname:short)' refs/heads/); do
if git log master|ack -1 "$(git log "$branch"|ack -1 Change-Id)" > /dev/null; then
if [ "$branch" != "master" ]; then
git branch -D "$branch"
fi
fi
done
}
@aphahn
aphahn / gist:815100
Created February 7, 2011 20:16
Christina Aguilera Star-Spangled Banner diff
--- starspangled 2011-02-07 12:03:39.000000000 -0800
+++ starmangled 2011-02-07 12:04:39.000000000 -0800
@@ -1,8 +1,8 @@
O! say can you see by the dawn's early light,
What so proudly we hailed at the twilight's last gleaming,
Whose broad stripes and bright stars through the perilous fight,
-O'er the ramparts we watched, were so gallantly streaming?
+What so proudly we watched at the twilight's last gleaming,
And the rockets' red glare, the bombs bursting in air,
Gave proof through the night that our flag was still there;
@aphahn
aphahn / suffix.py
Created December 24, 2010 22:47
A fun little tool that, given suffixes and a wordlist, prints words that end in those suffixes
#!/usr/bin/env python
import sys
def to_set(collection):
return "{" + ",".join(collection) + "}"
suffixes = {}
for suffix in sys.argv[1:-1]:
suffixes[suffix] = set()
while (window.parent != window.self) {
window.parent.location.replace(window.location.href); // Kick!
}
console.log("Did I make it all the way out? " + window.top.wobble);