Skip to content

Instantly share code, notes, and snippets.

View davipatti's full-sized avatar

David Pattinson davipatti

  • UW-Madison
  • New York, USA
View GitHub Profile
david ~> vf new -p python3 pystart-env
Running virtualenv with interpreter /usr/local/bin/python3
Using base prefix '/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/david/.virtualenvs/pystart-env/bin/python3.6
Also creating executable in /Users/david/.virtualenvs/pystart-env/bin/python
Installing setuptools, pip, wheel...done.
(pystart-env) david ~> pip install pystart
Collecting pystart
Collecting validate-email>=1.3 (from pystart)
Requirement already satisfied: pip>=9.0.1 in ./.virtualenvs/pystart-env/lib/python3.6/site-packages (from pystart) (10.0.1)
@davipatti
davipatti / custom.css
Last active June 12, 2018 12:23
jupyter notebook theme
@font-face {
font-family: "Roboto Mono";
font-weight: normal;
font-style: normal;
src: local('"Roboto Mono"'), url('fonts/roboto.ttf') format('truetype');
}
div.CodeMirror {
font-family: "Roboto Mono", monospace, monospace;
}
@davipatti
davipatti / hi_table.csv
Created June 25, 2018 15:29
Simple hi table for Alex
a b c d e f g h i j
A/HongKong/8/1968 2560 1280 40 <10 <10 <10 10 10 <10 <10
A/England/42/1972 320 1280 80 20 <10 <10 <10 <10 <10 <10
A/Victoria/3/1975 <10 80 320 40 10 20 10 <10 <10 <10
A/Texas/1/1977 <10 80 160 1280 160 320 320 10 10 <10
A/Bangkok/1/1979 <10 <10 80 640 640 640 640 20 10 <10
A/Philippines/2/1982 <10 <10 10 40 40 320 160 10 10 <10
A/Mississippi/1/1985 <10 <10 40 160 80 640 640 40 20 20
A/Shanghai/11/1987 <10 <10 <10 <10 <10 <10 80 320 160 20
A/Beijing/353/1989 <10 <10 <10 <10 <10 <10 <10 160 320 40
@davipatti
davipatti / mpltricks.py
Created July 21, 2018 12:25
Matplotlib tricks
import matplotlib
import matplotlib.pyplot as plt
def truncate_colormap(cmap, minval=0.0, maxval=1.0, n=100):
"""Clip the top and/or bottom off a colormap.
Args:
cmap (matplotlib.colors.ListedColormap): E.g. plt.cm.viridis
minval (number): [0 - 1]. 'Bottom' of the colormap.
maxval (number): [0 - 1]. 'Top' of the colormap.
@davipatti
davipatti / Makefile
Created September 6, 2018 15:04
Turn markdown into html
SRC = $(wildcard *.md)
TAR = $(SRC:.md=.html)
.PHONY: all clean
all: $(TAR)
%.html : %.md
pandoc --to html --css style.css --standalone -o $@ $<
@davipatti
davipatti / lissajous-curve.js
Created October 9, 2018 09:14
Lissajous curve table in javascript using p5.js.
let cols, rows;
let n = 7;
let points = [];
class Circle {
constructor(x, y, r, speed) {
this.speed = speed;
this.cx = x; // Centre of circle x, y
this.cy = y;
this.theta = 0; // Radial position of point
@davipatti
davipatti / life-expectancy.ipynb
Last active October 24, 2018 20:31
Life expectancy in the UK
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Entity Code Year Life expectancy (Clio-Infra up to 1949; UN Population Division for 1950 to 2015)
Afghanistan AFG 1950 27.537001
Afghanistan AFG 1951 27.809999
Afghanistan AFG 1952 28.35
Afghanistan AFG 1953 28.879999
Afghanistan AFG 1954 29.399
Afghanistan AFG 1955 29.907
Afghanistan AFG 1956 30.403999
Afghanistan AFG 1957 30.891001
Afghanistan AFG 1958 31.367001
@davipatti
davipatti / convexHull.R
Last active February 4, 2019 10:42
Plotting convex hulls in R with Arwen
library(geometry)
library(plotly)
xyz <- c("x", "y", "z")
convexHull <- function(group) {
# I forget whata he name of the variable containing
# the data.frame is, and the name of the column
# that contains the groups
@davipatti
davipatti / thinkpad-setup.md
Last active December 17, 2019 01:14
ThinkPad Ubuntu setup

ThinkPad setup

Notes from installing Ubuntu 18.04 on a Lenovo ThinkPad X1 Extreme, with nvidia graphics.

  • Turn off secure boot in the BIOS.

Installer freezing / non-responsive