Skip to content

Instantly share code, notes, and snippets.

View jrmontag's full-sized avatar

Josh Montague jrmontag

View GitHub Profile
@jrmontag
jrmontag / gist:6908140
Last active December 25, 2015 03:09
geo1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jrmontag
jrmontag / git-branch-prompt
Last active August 29, 2015 13:56
git branch in prompt (minimal working example)
# (ubuntu)
# add to end of .bashrc :
export PS1="\$(__git_ps1) "$PS1
# gives e.g. (when in a repo):
(master) user@host:~$
# more info: http://stackoverflow.com/questions/15883416/adding-git-branch-on-the-bash-command-prompt
@jrmontag
jrmontag / gist:9470730
Last active August 29, 2015 13:57
figsize handle in ggplot?
# previous experience...
# cell
import pandas as pd
...
# cell
%pylab inline
# use pd helper, plot()
@jrmontag
jrmontag / pelican-requirements
Last active August 29, 2015 13:57
pip requirements.txt for Pelican
Pelican==3.2
Markdown==2.3
ghp-import==0.3
@jrmontag
jrmontag / gist:9902846
Created March 31, 2014 21:32
make pandas dataframe slightly easier to read in IPython notebook
pd.set_option('display.max_columns', 10) # repr shows <=10 cols (scrollable)
pd.set_option("display.max_colwidth", 150) # repr shows <=150 characters in each column (line wraps)
# many more options available:
# http://pandas.pydata.org/pandas-docs/stable/basics.html?highlight=set_option#working-with-package-options
Jinja2==2.7.2
MarkupSafe==0.19
Pygments==1.6
backports.ssl-match-hostname==3.4.0.2
boto==2.27.0
boto-rsync==0.8.1
brewer2mpl==1.3.2
gapi==0.1.4
ggplot==0.4.7
gnacs==0.7.5
@jrmontag
jrmontag / PyCon-2014.md
Created April 9, 2014 01:58
PyCon 2014 plans
@jrmontag
jrmontag / gist:957b4bb8f4b89d5006a8
Last active September 21, 2022 12:07
split a string at every nth occurrence of a delimiter (here, a pipe) in Python
import re
s = 'id|tag1|id|tag2|id|tag3|id|tag4'
# nb: escaping | (delimiter) necessary *outside* of character set ( [] ), not inside
print re.findall("[^|]+\|[^|]+", s)
# ['id|tag1', 'id|tag2', 'id|tag3', 'id|tag4']
n=3
@jrmontag
jrmontag / gist:9980ee3f79154ec81bff
Created June 13, 2014 23:58
Example of gnacs.py geojson output with Foursquare data as input
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jrmontag
jrmontag / README.md
Last active August 29, 2015 14:04
Built a new virtualenv from scratch (brewed Python 2.7.7) with this list. Results in 48 packages in ``pip list``

Build fresh Pydata stack

  • last updated: 2015-02-27

requirements.txt files for setting up a new data project stack for Python. First, install virutalenv and virtualenvwrapper, then build new Python virtualenv for data projects.

From a fresh OS X install with homebrew installed:

$ brew intall python

$ brew install python3 # optional