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
@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 / 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 / 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 / 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 / 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;
}
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 / TensorFlow-GPU-Mac.md
Last active July 30, 2018 03:05
Compiling TensorFlow with GPU support on Mac

Compiling TensorFlow with GPU support on Mac

Compiling TensorFlow on a mac with GPU is no longer officially supported. But it's still possible and a lot of fun(!) to compile.

I mainly followed this repo:

Here is a run down of everything I did:

mzhyHzqa@EFYTFIGFUJEEEi@Mc@Bk@DICk@Sa@C[WmAIOCGM?KDD@?VGjAKv@Dx@\DUz@D^?r@Ib@Ct@HdA@v@JJFABDNBDFBXAdAr@CfBQNBLG|@KFABDXIp@ILIj@Ix@WfAKNKD??JDAJBTEP@L?~@SP?`@EJO\Kl@C\EXILAv@Z\CJQvAqAjAcA`As@l@k@b@u@V_@jC_DCEBMT]b@_@hAc@LUzA{An@e@^]bBw@l@c@`@Qh@_@V[r@g@^Ub@QRAZGJ?rAe@JKx@]~AcAj@SdBeAXWj@Yz@w@LA|@_@BUO{@KkA]{AG{@G[@YIw@IgBCUYgAU[IYKIOu@@uANuA@_BAa@o@eIc@uHKcCKaAo@cLOWCi@I[I_A?}@KYAwA]eFS}BG[IyAOiBUuBQ}BMqBAu@SmBCo@c@gDa@{AG]IQCSGC@G?SBEGq@AcAHgAFaF@gAImCRi@B]Iy@?cCRaEh@}GNyBB{@L}ABa@RuBJ}BV_CF}AE{B@[W{AEi@Ks@Aq@GmAiAkLUoAYcDUaBQ_BOOCS?Wg@aCc@}AMQSEm@eAW[]SQGo@e@UGIGIMOCa@Se@][[M[c@e@_@k@uAyCm@_BSy@_@mAo@kAa@g@a@c@u@e@wBkBw@g@s@i@WEa@MyC_AiAMSGwACSDa@@QNc@CSFYGK?KBe@RK@MGGKEMZ}ADe@PmFHw@XmGNkAGa@Wy@@a@P_@FU@YOi@g@oAKe@Ks@WiDG[YaDaAgGAu@GIK]K}@Qy@gAsHq@gEKa@?c@Ig@KWDKEEGc@Eu@MaA}@_F{@yFAo@YcACYIWEg@UkAGi@i@cC_@kAo@yA_AoAE?GJGCQFMKOm@AQDg@FQBk@GgGKsDGkAQyBGcBO_AC_HC[Bq@G[Es@@WKkB@e@EEQAIG{@qAm@a@MSKE@Kd@yACHC@AILaATu@p@uADYHUTgALYj@oBRgA\sAFEFBHM?I@H`@d@DTFLB
}|hyHvta@@XHw@Uu@]k@Ri@BYHUE}@_B_BKe@IMh@e@?jDC\@VDf@\h
@davipatti
davipatti / install_pymol.sh
Created April 26, 2018 11:17
Build pymol from source on mac
#!/bin/bash -e
cd /tmp
wget "https://sourceforge.net/projects/pymol/files/pymol/2/pymol-v2.1.0.tar.bz2"
tar -xf pymol-v2.1.0.tar.bz2
cd pymol
mkdir -p ~/bin/pymol/modules
python2.7 setup.py build install \
--install-scripts=~/bin/pymol \
@davipatti
davipatti / csv headers
Last active January 30, 2018 21:05
Run internet speed test every 20 mins. Log the results and plot
/usr/local/bin/speedtest-cli --csv > ~/.speedtest.log.csv