Skip to content

Instantly share code, notes, and snippets.

View aconz2's full-sized avatar

Andrew Consroe aconz2

View GitHub Profile
@aconz2
aconz2 / many_plots.py
Created September 17, 2015 17:50
Iterate through a series of matplotlib plots, waiting for keyboard input (from the terminal)
import numpy as np
from matplotlib import pyplot as plt
plt.ion()
# say you have a bunch of distributions you'd like to look at
data_sets = [np.random.poisson(lam, size=100), for lam in np.random.randint(1, 100, size=10)]
# in a REPL, this one-liner makes it easy to plot each one successively waiting for ENTER from the terminal
_ = [[plt.hist(data), input()] for data in data_sets]
@aconz2
aconz2 / get_all_pip_packages.py
Created June 14, 2015 23:54
Retreive a list of all available packages from pip. (pip(1) doesn't output in a nice format)
#!/usr/bin/env python3
import pip
searcher = pip.commands.SearchCommand()
options, _ = searcher.parse_args([])
hits = searcher.search('*', options)
hits_transformed = pip.commands.search.transform_hits(hits)
for hit in hits_transformed:
print(hit['name'])
@aconz2
aconz2 / component-emitter
Created September 9, 2013 01:01
weird bug with component install, happens only sometimes, and happens to the following files a lot, always at the bottom
/**
* Expose `Emitter`.
*/
module.exports = Emitter;
/**
* Initialize a new `Emitter`.
*
* @api public

List of components to remember

DOM

component/query component/classes component/value

DOM Events

Simple

@aconz2
aconz2 / font_stacks_stylus
Last active December 11, 2015 01:58
Stylus variables of css font stacks, grabbed from http://css-tricks.com/snippets/css/font-stacks/
/* Times New Roman-based stack */
$timesNewRoman = Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif
/* Modern Georgia-based serif stack */
$modernGeorgia = Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif
/* Traditional Garamond-based serif stack */
$garamond = "Palatino Linotype", Palatino, Palladio, "URW Palladio L", "Book Antiqua", Baskerville, "Bookman Old Style", "Bitstream Charter", "Nimbus Roman No9 L", Garamond, "Apple Garamond", "ITC Garamond Narrow", "New Century Schoolbook", "Century Schoolbook", "Century Schoolbook L", Georgia, serif
/* Helvetica/Arial-based sans serif stack */