Skip to content

Instantly share code, notes, and snippets.

View gadamc's full-sized avatar

G Adam Cox gadamc

  • Q-CTRL
  • Seattle, WA
  • 16:25 (UTC -12:00)
View GitHub Profile
@gadamc
gadamc / no_merge_flow.md
Last active January 23, 2019 21:16
Git Workflow that uses only rebase to ensure chronological commits.

Rebase Flow

This workflow is based on GitHub Flow.

The main goal is to simplify the workflow by applying a rigid structure to how new material is added to the repo, which avoids complicated git merges.

Rebase Flow Commandments

  1. Never commit any changes to the local working master branch. Your local working master branch should never get ahead of the master branch on Github. Only commit changes to a working branch.
import ibmos2spark
credentials = {
'auth_url': 'https://identity.open.softlayer.com', #your URL might be different
'project_id': '',
'region': '',
'user_id': '',
'username': '',
'password': '',
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
from couchdbkit import Server
from csv import DictReader
import time, sys, subprocess, math, os, datetime, pytz, calendar, json
#______________
# parseDoc
def parseDoc(doc):
for k,v in doc.items():
@gadamc
gadamc / acurl.py
Last active December 30, 2015 20:59
set up a curl alias (acurl) to include credentials so that you don't have to type them out
import base64
import os
import sys
user = raw_input('username:')
password = raw_input('password:')
b64encoded = base64.urlsafe_b64encode('{0}:{1}'.format(user,password))
shell = os.path.basename(os.environ.get('SHELL'))
http://cpsievert.wordpress.com/
https://github.com/cpsievert/pitchFX
http://fastballs.wordpress.com/2007/08/23/how-to-build-a-pitch-database/
http://www.fangraphs.com/library/misc/pitch-fx/
http://www.fangraphs.com/library/interpreting-pitchfx-data/
http://www.fangraphs.com/library/pitch-type-abbreviations-classifications/
http://gd2.mlb.com/components/game/mlb/year_2007/
http://www.fangraphs.com/blogs/the-early-trend-of-2013-dingers/#more-120259
@gadamc
gadamc / map.js
Created June 13, 2013 18:49
I called this design doc == geonames, view == nopoliticalinfo
function(doc){
if(doc.text && !doc.countryName && !doc.adminName1 && doc.geo && typeof doc["geo"]["coordinates"][0] === 'number' && typeof doc["geo"]["coordinates"][1] === 'number')
emit( doc._id, 1);
}
def geoname(lat, lng, usrname):
url = 'http://api.geonames.org/countrySubdivisionJSON?lat=%f&lng=%f&username=%s' % (lat, lng, usrname)
r = requests.get(url)
r.raise_for_status() #we'll quit if we have any problems.
return r.json()
@gadamc
gadamc / csvtocouch.py
Created June 5, 2013 18:57
Example on how to read a CSV file using DictReader and then upload them to couchdb (with couchdbkit)
#!/usr/bin/env python
from couchdbkit import Server
from csv import DictReader
import time, sys, subprocess, math, os, datetime, pytz, calendar, json
#______________
# parseDoc
def parseDoc(doc):
for k,v in doc.items():