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 / 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}
@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 / 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 / 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 / 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 / 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 / randomizing_authors.py
Created January 8, 2015 07:24
Randomizing an author list using atmospheric noise
import requests, simplejson
# Insert your API key here
api_key = '<my_api_key>'
# Some random names from http://www.namesgenerator.org/100-random-names/
authors = [
"Staffan Krammerer", "Rosalinda Stavoua", "Tahsin Tomms",
"Saikhantuya Stronge", "Bronte Movileanu", "Mykel Eletti",
"Brendan Hamzová", "Utaka Heldt", "Alekzander Ogiemwonyi",
@jesserobertson
jesserobertson / Gerris.YAML-tmLanguage
Created March 10, 2015 00:55
Syntax highlighting for Gerris solver files for Sublime Text editors
# [PackageDev] target_format: plist, ext: tmLanguage
# Gerris syntax highlighting (fairly crappy at this stage)
---
name: Gerris
scopeName: source.gerris
fileTypes: ["gfs"]
uuid: 959c45c1-fa9c-428c-b2a2-e74f9ee51c2f
foldingStartMarker: '\{\s*$'
foldingStopMarker: '^\s*\}'
@jesserobertson
jesserobertson / install_bfg.md
Created March 16, 2016 02:39
Notes on burning out big git commits using the BFG repo cleaner on OSX

Installing the BFG

First make sure that you install Java using homebrew - the Oracle installer makes a terrible fscking mess of your machine :(

$ brew tap caskroom/cask
$ brew install brew-cask
$ brew cask install java
@jesserobertson
jesserobertson / gist:3ea35b3ff1bf7f95ffdc36244e22203d
Created November 2, 2016 10:27 — forked from tjcorr/gist:3baf86051471062b2fb7
CloudFormation to demo etcd-aws-cluster
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "An etcd cluster based off an auto scaling group",
"Mappings" : {
"RegionMap" : {
"eu-central-1" : {
"AMI" : "ami-840a0899"
},
"ap-northeast-1" : {
"AMI" : "ami-6c5ac56c"