Skip to content

Instantly share code, notes, and snippets.

View jesserobertson's full-sized avatar
🐍
geopythonining

Jess Robertson jesserobertson

🐍
geopythonining
View GitHub Profile
@jesserobertson
jesserobertson / git-diet.py
Last active August 29, 2015 14:05
Get the big blobs from your git repostory, in Python
import subprocess, os
def get_big_blobs(git_repo, nitems=10):
# Query the git repo for large items
os.chdir(git_repo)
big_blobs = subprocess.Popen(
('git verify-pack -v .git/objects/pack/pack-*.idx | '
'grep -v chain | sort -k3nr | head --lines={1} -').format(git_repo, int(nitems)),
shell=True,
stdout=subprocess.PIPE)
@jesserobertson
jesserobertson / property_example.py
Last active August 29, 2015 14:02
Demo of a property on a class
class Foo(object):
def __init__(self):
self.datasource = something
self.cache = {}
@property
def data(self):
if 'data' in cache.keys():
return cache['data']
@jesserobertson
jesserobertson / test_log_contourf.py
Created May 20, 2014 02:05
Contourf with log scale bug in mpld3
"""Plot to test line contours"""
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.mlab as mlab
import mpld3
def create_plot():
x = np.linspace(-3.0, 3.0, 30)
y = np.linspace(-2.0, 2.0, 30)
@jesserobertson
jesserobertson / chapter.tex
Created January 6, 2014 04:48
An example chapter
%!TEX root = ../thesis.tex
%!TEX TS-program = pdflatex
%!TEX encoding = UTF-8 Unicode
\chapter{Results} % (fold)
\label{cha:isothermal_results}
Isothermal flow solutions were calculated for 1666 flow configurations: these had 49 aspect ratios between 1/5$\;\leq\beta\leq\;$25, with 34 values of the Bingham number per aspect ratio. I only performed actual calculations for flows with $\beta \geq\;$2, since cases with $\beta<2$ can be obtained from these results via the symmetry of the flow configuration (i.e. by swapping $H$ and $W$ and rescaling other values). The Bingham number varied between zero for Newtonian flows, to the critical value $B=B^{\star}(\beta)$ when the weight of the fluid is completely supported by its yield strength (discussed in \S\ref{sub:viscoplastic_rheology}). I outline how the critical Bingham number $B^{\star}$ can be obtained analytically for rectangular channel flows in \S\ref{sec:critical_bingham_numbers}. The number of iterations required for convergence of the Lagrangian optimiz
@jesserobertson
jesserobertson / frontmatter.tex
Created January 6, 2014 04:47
The frontmatter for my thesis
%!TEX root = ../thesis.tex
%!TEX TS-program = pdflatex
%!TEX encoding = UTF-8 Unicode
%!TEX root = thesis.tex
% Jess Robertson, 2011-01-30
\newpage
\pagestyle{empty}
\singlespacing
\vspace{80mm}
@jesserobertson
jesserobertson / thesis.tex
Created January 6, 2014 04:45
My thesis in LaTeX - needs pdflatex, minion pro and biber packages
%!TEX TS-program = pdflatex
%!TEX encoding = UTF-8 Unicode
% Preamble (fold)
\documentclass[12pt, openright]{book}
% \includeonly{chapters/frontmatter, chapters/introduction}
% Load packages
\usepackage[ibycus, english]{babel}
% \usepackage{amsmath, amssymb}