Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew J. McCullough matthewmccullough

View GitHub Profile
@matthewmccullough
matthewmccullough / gist:47267
Created Jan 15, 2009 — forked from halbtuerke/gist:31934
Show Git dirty status in your Unix bash prompt (symbols not compatible with CygWin)
View gist:47267
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
View gist:885658
-------------------------------------------------------------------------
USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor) Dec. 29, 2005
Compiled by Eric Pement - pemente[at]northpark[dot]edu version 5.5
Latest version of this file (in English) is usually at:
http://sed.sourceforge.net/sed1line.txt
http://www.pement.org/sed/sed1line.txt
This file will also available in other languages:
Chinese - http://sed.sourceforge.net/sed1line_zh-CN.html
@schacon
schacon / gist:942899
Created Apr 26, 2011
delete all remote branches that have already been merged into master
View gist:942899
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
@schacon
schacon / auto-backup.rb
Created May 12, 2011
Example Scripts from Three Trees Talk
View auto-backup.rb
back_branch = 'refs/heads/backup'
`rm /tmp/backup_index`
ENV['GIT_INDEX_FILE'] = '/tmp/backup_index'
last_commit = `git rev-parse #{back_branch}`.strip
last_tree = `git rev-parse #{back_branch}^{tree}`.strip
`git add --all`
next_tree = `git write-tree`.strip
@schacon
schacon / plumbing.md
Created Aug 18, 2011
plumbing cheat sheet
View plumbing.md

the plumbing commands

  • rev-parse [something]

    • show the SHA of any weird git phrase
  • hash-object -w [file]

    • take any file or stdin and return a blob sha
  • ls-tree (-r) [sha]

    • show the entries of a git tree in the db
@matthewmccullough
matthewmccullough / Writing Tools Writeup.md
Created Jan 13, 2012
How To Write A Technical Book (One Man's Modest Suggestions)
View Writing Tools Writeup.md
@Dierk
Dierk / pre-receive.groovy
Created Feb 9, 2012
a pre-receive hook to allow both: feature branches and agile CI
View pre-receive.groovy
// a git pre-receive hook
// that automatically merges all pushes to feature branches
// into a dedicated continuous-integration (ci) branch.
// Since we cannot merge in a bare repo, we work on a temporary clone.
// Dierk Koenig
def ciBranch = 'master'
def mergeName = 'merge'
def hereDirPath = new File('.').canonicalPath
@mtnygard
mtnygard / gist:2254147
Created Mar 30, 2012
Books I recommended today
View gist:2254147
@schacon
schacon / get_token.sh
Created Apr 9, 2012
shell command to get a GitHub OAuth token
View get_token.sh
# sh get_token.sh user pass
curl -s -d '{"scopes":["repo"],"note":"admin script"}' -u "$1:$2" -XPOST https://api.github.com/authorizations | grep token
@tkarpinski
tkarpinski / github_issues_to_csv.rb
Created Apr 12, 2012 — forked from henare/github_issues_to_csv.rb
Exports Github issues to CSV (API v3)
View github_issues_to_csv.rb
require 'octokit'
require 'csv'
require 'date'
# Github credentials to access your private project
USERNAME="USER_NAME"
PASSWORD="SEKRIT"
# Project you want to export issues from
USER="REPO_OWNER"
PROJECT="REPO_NAME"