-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 import urllib2 | |
2 import json | |
221 def basic_authorization(user, password): | |
222 s = user + ":" + password | |
223 return "Basic " + s.encode("base64").rstrip() | |
224 | |
225 def submit_pull_request(user, repo): | |
226 auth = (settings.username, settings.password) | |
227 url = 'https://api.github.com/repos/' + user + '/' + repo + '/pulls' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) | |
if [ -z "$GIT_DIR" ]; then | |
echo >&2 "fatal: hooks/functions: GIT_DIR not set" | |
exit 1 | |
fi | |
read oldrev newrev refname |
Contributing to Open Source
=======
First Rule: You can find the time
- It doesn’t take much
- Weekends are good
- Find what other time you’re wasting
- Try something that’s not your day job
Second Rule: What to contribute to?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
HTTP Link Header Parsing | |
Simple routines to parse and manipulate Link headers. | |
""" | |
__license__ = """ | |
Copyright (c) 2009 Mark Nottingham |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
chrome.browserAction.onClicked.addListener(function(tab) { | |
var script = "function iprl5(){var d=document,z=d.createElement('scr'+'ipt'),b=d.body,l=d.location;try{if(!b)throw(0);d.title='(Saving...) '+d.title;z.setAttribute('src',l.protocol+'//www.instapaper.com/j/pUgLJLCrwjg0?u='+encodeURIComponent(l.href)+'&t='+(new Date().getTime()));b.appendChild(z);}catch(e){alert('Please wait until the page has loaded.');}}iprl5();void(0)" | |
chrome.tabs.executeScript(tab.id, {code: script}); | |
}); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: bin/python test-webapp.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (phantom.state.length === 0) { | |
if (phantom.args.length !== 1) { | |
console.log('Usage: run-jasmine.js URL'); | |
phantom.exit(); | |
} else { | |
phantom.state = 'run-jasmine'; | |
phantom.open(phantom.args[0]); | |
} | |
} else { | |
window.setInterval(function () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
rbdWrapper can take several data- attributes: | |
1. data-url : to specificy a specific URL to link to (useful for index pages) | |
2. data-text-color : the text color of "Read". 6 digit hex or "transparent" | |
3. data-bg-color : the bg color. 6 digit hex or "transparent" | |
4. data-show-send-to-kindle : 1 or 0, whether to show the "send to kindle" button or not. | |
5. data-show-read : 1 or 0, whether to show the read buttons or not. | |
A sample is like: | |
--> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Dump | |
mysqldump db | gzip -c > db.sql.gz | |
pg_dump db | gzip -c > db.sql.gz | |
#use gzip --fast | |
#Restore | |
gunzip < db.sql.gz | mysql db | |
bunzip2 < db.sql.bz2 | mysql db |