Skip to content

Instantly share code, notes, and snippets.

View sburns's full-sized avatar

Scott Burns sburns

View GitHub Profile
@sburns
sburns / map_dev.ipynb
Created December 2, 2013 18:24
initial work on plotting tn data
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sburns
sburns / keybase.md
Created March 25, 2014 14:19
Proving keybase identity

Keybase proof

I hereby claim:

  • I am sburns on github.
  • I am sburns (https://keybase.io/sburns) on keybase.
  • I have a public key whose fingerprint is B51D 917C 6E42 FACB 28CA 1CB2 CD41 A371 1C6D 28CC

To claim this, I am signing this object:

@sburns
sburns / intelligent_ordering_of_destrieux.ipynb
Created April 2, 2014 13:47
ipython notebook exploring a data-driven approach to ordering the Destrieux labels from freesurfer
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sburns
sburns / ipynb.conf
Created April 23, 2014 18:41
ipython notebook supervisor recipe
[program:ipynb]
command=/gpfs22/home/burnsss1/env6/bin/ipython notebook --profile=external #change
numprocs=1
numprocs_start=0
autostart=true
autorestart=true
startsecs=1
startretries=3
exitcodes=0,2
stopsignal=QUIT
@sburns
sburns / 00_nbimport.py
Created May 9, 2014 18:50
A startup file for IPython that provides a hook into python's import infrastructure so we can import notebooks as python modules. This helps code sharing/re-use between notebooks.
import io
import os
import sys
import types
from IPython.nbformat import current
from IPython.core.interactiveshell import InteractiveShell
def find_notebook(fullname, path=None):
@sburns
sburns / dict_answer.md
Last active August 29, 2015 14:01
Answers to [Aur Saraf's Software Carpentry Instructor Training Assessment](http://teaching.software-carpentry.org/2014/05/15/assessment-for-python-dicts-aur-saraf/)

These are good questions. Q1 covers the very important knowledge that a key has one and only one value. I think Q2 requires a little more python knowledge than what's covered in the dictionary concept map but is otherwise a good exercise in assessing how to iterate over a dictionary and operate on the key, value pairs.

Q1

3

Q2

cities = {
 'Jerusalem': 'Israel',
@sburns
sburns / gist:5bd6a203721bfaef4031
Created June 27, 2014 16:23
Python scientific stack in <40 seconds!
$ mkvirtualenv test && workon test
New python executable in test/bin/python2.7
Not overwriting existing python script test/bin/python (you must use test/bin/python2.7)
Installing setuptools, pip...done.
$ pip --version
pip 1.5.4 from /Users/scottburns/.virtualenvs/test/lib/python2.7/site-packages (python 2.7)
$ date; pip install numpy pandas scipy > /dev/null; date
Fri Jun 27 11:19:57 CDT 2014
Fri Jun 27 11:20:35 CDT 2014
@sburns
sburns / gist:dfc70a3952e05ee3d32f
Created August 5, 2014 18:23
pandas dateutil awesome sauce
In [2]: import pandas as pd
In [3]: p = pd.Period('4Q2005')
In [4]: p.start_time
Out[4]: Timestamp('2005-10-01 00:00:00')
In [5]: p.end_time
Out[5]: Timestamp('2005-12-31 23:59:59.999999999')
In [7]: p.end_time.date()
@sburns
sburns / print_sql.py
Created December 10, 2014 15:07
Print a literal SQLAlchemy statement
print(str(select.compile(engine, compile_kwargs={'literal_binds': True}))
@sburns
sburns / script.md
Last active July 9, 2018 08:35
This is a 5-minute (hahaha yeah right) demo of some things you might not have thought to do with the jupyter notebook to make it a good dev environment.

tmux all the things

$ tmux new -s demo

Make & activate a virtualenv

pyenv virtualenv 3.5.0 demo
pyenv activate demo
python --version