Skip to content

Instantly share code, notes, and snippets.

View amueller's full-sized avatar

Andreas Mueller amueller

View GitHub Profile
@dwf
dwf / gist:828099
Created February 15, 2011 19:50
Pull out a submatrix from a COO SciPy sparse matrix.
import scipy as S
def coo_submatrix_pull(matr, rows, cols):
"""
Pulls out an arbitrary i.e. non-contiguous submatrix out of
a sparse.coo_matrix.
"""
if type(matr) != S.sparse.coo_matrix:
raise TypeError('Matrix must be sparse COOrdinate format')
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@shimizukawa
shimizukawa / _templates-localtoc.html
Created March 11, 2013 03:35
Sphinx extension to render local toctree in templates (ex. sidebar). see also: https://groups.google.com/d/topic/sphinx-users/dqfCLab4oB0/discussion
<h3>toctree</h3>
{{ local_toctree(pagename, maxdepth=-1) }}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.