Skip to content

Instantly share code, notes, and snippets.

@cspickert
cspickert / GoogleSpreadsheets.py
Created January 20, 2012 23:40
Export a Google Spreadsheet using python.
#!/usr/bin/python
import re, urllib, urllib2
class Spreadsheet(object):
def __init__(self, key):
super(Spreadsheet, self).__init__()
self.key = key
class Client(object):
from collections import defaultdict
tasks = defaultdict(list)
for line in open('day7.txt'):
components = line.split(' ')
dep, task = components[1], components[7]
tasks[task].append(dep)
if dep not in tasks: tasks[dep] = []
result = ''
# Remove 64-bit build architecture from Pods targets
post_install do |installer|
installer.project.targets.each do |target|
target.build_configurations.each do |configuration|
target.build_settings(configuration.name).delete 'ARCHS'
end
end
end
------------------------------------------------------------
/Users/cameron/Documents/Development/oyster-api/venv/bin/pip run on Fri Nov 8 13:57:35 2013
Downloading/unpacking git+git://github.com/oysterbooks/oyster-django-tastypie.git@f7ffbf38c5d68edc10845b3be8f798e54d1ec62b (from -r requirements/base.txt (line 74))
Cloning git://github.com/oysterbooks/oyster-django-tastypie.git (to f7ffbf38c5d68edc10845b3be8f798e54d1ec62b) to /var/folders/xc/kd8mgzfd5d9c4215hfm69pph0000gn/T/pip-I_X9Jx-build
Found command 'git' at '/usr/local/bin/git'
Running command /usr/local/bin/git clone -q git://github.com/oysterbooks/oyster-django-tastypie.git /var/folders/xc/kd8mgzfd5d9c4215hfm69pph0000gn/T/pip-I_X9Jx-build
Running command /usr/local/bin/git show-ref
f7ffbf38c5d68edc10845b3be8f798e54d1ec62b refs/heads/master
@cspickert
cspickert / word_frequency.py
Last active December 16, 2015 02:09
Plot word frequency over time in a git repo's commit messages using matplotlib.
#!/usr/bin/python
"""
Plot the frequency of the given words in the commit messages of a git repository.
Usage: python word_frequency.py git_dir word1 [word2...]
Example: python word_frequency.py /path/to/repo/.git fix add remove
"""
import sys
import datetime
@cspickert
cspickert / mimetype.py
Created March 19, 2013 19:58
A quick command line tool for determining the MIME type of a local file as returned by NSURLConnection. Requires Mac OS X.
#!/usr/bin/python
from Foundation import *
def MIMETypeForFileAtPath(path):
url = NSURL.fileURLWithPath_(path)
request = NSURLRequest.requestWithURL_(url)
data, response, error = NSURLConnection.sendSynchronousRequest_returningResponse_error_(request, None, None)
return response.MIMEType()
@cspickert
cspickert / xcopen.sh
Last active December 10, 2015 09:49
A shell function for quickly opening Xcode project files.
#!/bin/sh
# Usage:
# xcopen [projfile|dirname]
#
# The argument is optional. If an argument is specified and its extension
# is 'xcodeproj', it is treated as a project file. Otherwise, it is treated
# as the directory name. If no argument is specified, the directory name is
# set to '.' (the current working directory). If a project file is specified,
# it is opened. Otherwise, the first project file in the specified directory
@cspickert
cspickert / objc.cfg
Created October 2, 2012 16:10 — forked from tszming/objc.cfg
My uncrustify config file for objective-c
#
# uncrustify config file for objective-c and objective-c++
#
indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs
output_tab_size = 4 # new tab size
indent_columns = output_tab_size
indent_label = 2 # pos: absolute col, neg: relative column
indent_align_assign = FALSE
@cspickert
cspickert / objc.cfg
Created September 20, 2012 18:27 — forked from tszming/objc.cfg
My uncrustify config file for objective-c
#
# uncrustify config file for objective-c and objective-c++
#
indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs
output_tab_size = 4 # new tab size
indent_columns = output_tab_size
indent_label = 2 # pos: absolute col, neg: relative column
indent_align_assign = FALSE