Skip to content

Instantly share code, notes, and snippets.

View pelson's full-sized avatar

Phil Elson pelson

View GitHub Profile
@ahomu
ahomu / shot.js
Created September 30, 2012 23:28
Create slides(Reveal.js) PNG images using phantomjs
console.log('Loading a web page');
var page = require('webpage').create();
var url = 'http://localhost:1947/';
page.viewportSize = {
width: 1024,
height: 768
};
page.open(url, function (status) {
//Page is loaded!
var iz, i = 0, queue = {};
@pelson
pelson / EIDA50_201211061300_clip2.png
Last active December 19, 2015 00:49
Scipy Presentation 2013: Iris & Cartopy
EIDA50_201211061300_clip2.png
@minrk
minrk / SWCDemo.ipynb
Created October 4, 2012 22:32
Demo of hideable hints and scrubbing solutions from IPython notebooks
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ozh
ozh / xkcd.css
Created March 12, 2014 09:41
XKCD font
/* font from https://github.com/ipython/xkcd-font
* converted to web font in base64 with
* http://www.fontsquirrel.com
*/
@font-face {
font-family: 'xkcdregular';
src: url(data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAFUEABMAAAAAmIwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABqAAAABwAAAAcZzPs3EdERUYAAAHEAAAAHQAAACAAqwAER1BPUwAAAeQAAAUsAAAI6KIfuCpHU1VCAAAHEAAAACwAAAAwuP+4/k9TLzIAAAc8AAAARwAAAGB0yJOSY21hcAAAB4QAAAEcAAAB6qFMdl1jdnQgAAAIoAAAAEgAAABIE5kZd2ZwZ20AAAjoAAABsQAAAmVTtC+nZ2FzcAAACpwAAAAIAAAACAAAABBnbHlmAAAKpAAARK4AAH+Mp+zsDGhlYWQAAE9UAAAALwAAADYD5y0taGhlYQAAT4QAAAAeAAAAJA4xBqpobXR4AABPpAAAAU0AAAH48WoV22xvY2EAAFD0AAAA7AAAAP7KyqwybWF4cAAAUeAAAAAfAAAAIAGbAvduYW1lAABSAAAAAQ4AAAKyORJbEXBvc3QAAFMQAAABIwAAAcgo6S23cHJlcAAAVDQAAADFAAABdD4epAl3ZWJmAABU/AAAAAYAAAAGwE1THwAAAAEAAAAAzD2izwAAAADLsNlAAAAAAM9FcMx42mNgZGBg4ANiCQYQYGJgBMJaIGYB8xgACakAsAAAAHjaVZbfa5tVGMefNOkPejG0v9ReDJXSH/nRNI1tmqZppJSXEkIo4SWU8BJiqCVE29K1Yw6VoTJkypDhnYiUUYoXu5Aio4wxmLPUGTcpMnbjjVf+Fcvx855zlErIkpP3fT/ne77P93lWCYhIr0zJonQsO
@mrocklin
mrocklin / trace.py
Created July 11, 2016 21:03 — forked from jcrist/trace.py
Dask Execution Tracer
import os
from dask.callbacks import Callback
from dask.dot import dot_graph
class Track(Callback):
def __init__(self, path='dasks'):
self.path = path
self.n = 0
@HeinrichHartmann
HeinrichHartmann / RPi_ADC8032.py
Created December 14, 2014 21:04
Raspbery Pi Analog Input with ADC0832
#!/usr/bin/env python
#
# Analog Input with ADC0832 chip
#
# Datasheet: http://www.ti.com/lit/ds/symlink/adc0838-n.pdf
# Part of SunFounder LCD StarterKit
# http://www.sunfounder.com/index.php?c=show&id=21&model=LCD%20Starter%20Kit
#
import time
@dmcdougall
dmcdougall / xkcd.py
Created October 4, 2012 09:42
XKCD-style graphs in matplotlib
import numpy as np
from matplotlib import rcParams
rcParams['text.usetex'] = False
from matplotlib.backends.backend_agg import FigureCanvasAgg as fc
from matplotlib.figure import Figure
import matplotlib.font_manager as fm
# Function to draw a random function. Yo dawg...
def rand_func():
# Some random Fourier coefficients
@dan-blanchard
dan-blanchard / .1.miniconda.md
Last active December 11, 2019 22:38
Quicker Travis builds that rely on numpy and scipy using Miniconda

For ETS's SKLL project, we found out the hard way that Travis-CI's support for numpy and scipy is pretty abysmal. There are pre-installed versions of numpy for some versions of Python, but those are seriously out of date, and scipy is not there are at all. The two most popular approaches for working around this are to (1) build everything from scratch, or (2) use apt-get to install more recent (but still out of date) versions of numpy and scipy. Both of these approaches lead to longer build times, and with the second approach, you still don't have the most recent versions of anything. To circumvent these issues, we've switched to using Miniconda (Anaconda's lightweight cousin) to install everything.

A template for installing a simple Python package that relies on numpy and scipy using Miniconda is provided below. Since it's a common s

@ericdill
ericdill / render_env.py
Last active October 20, 2021 20:22
Render the dependency graph for your conda environment (needs graphviz!)
import json
import glob
import os
from os.path import join, basename
# install this with "conda install -c conda-forge python-graphviz"
import graphviz as gv
# path to your conda environment
path = os.environ.get('CONDA_PREFIX')
if path is None:
@psmay
psmay / svg-to-fontforge-python.md
Created December 2, 2014 15:14
Notes on mass-importing SVG outlines into FontForge via Python

Notes on dumping SVG outlines into a FontForge file

Sources I've looked at:

I have a hunch that createMappedChar() doesn't work unless you've done loadNameList('glyphlist.txt') or loadNameList('aglfn.txt') (BSD-licensed Adobe glyph lists). An alternative seems to be to go by codepoint with createChar().