Every time I accidentally git commit --amend
instead of a normal git commit I have to google git reset --soft HEAD@{1}
to save the day.
Imagine you have a file called foo.txt
and your Git history looked like this:
A -> B -> C (HEAD)
But really easy to re-sort because the items aren't really numbered:
1. one
#!/usr/bin/osascript | |
# vim: set syntax=applescript | |
(* | |
Launch multiple commands in iTerm2 split views | |
inspired by github.com/xgdlm/iterm2-cssh. | |
Usage: |
function inherit (child, parent) { | |
function proxy () {}; | |
proxy.prototype = parent.prototype; | |
child.prototype = new proxy(); | |
}; | |
function Parent () {} | |
function Child () {} | |
inherit(Child, Parent); |
#!/bin/bash | |
export FOO=100 | |
python - <<END | |
import os | |
print "foo:", os.environ['FOO'] | |
END |
# Quick and dirty script to read unique IDs from NFC tags using the ACR122U USB | |
# reader. | |
# | |
# PC/SC-based API details for the ACR122U available at | |
# http://acs.com.hk/drivers/eng/API_ACR122U_v2.01.pdf | |
# | |
# Assumes ruby >= 1.9.2 | |
# `gem install smartcard` first | |
# |
<html> | |
<head> | |
<title>Animated Sparkline using SVG Path and d3.js</title> | |
<script src="http://mbostock.github.com/d3/d3.v2.js"></script> | |
<style> | |
/* tell the SVG path to be a thin blue line without any area fill */ | |
path { | |
stroke: steelblue; | |
stroke-width: 1; | |
fill: none; |
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
# username@Machine ~/dev/dir[master]$ # clean working directory | |
# username@Machine ~/dev/dir[master*]$ # dirty working directory | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" |