Skip to content

Instantly share code, notes, and snippets.

View hayd's full-sized avatar
😎
chillin'

Andy Hayden hayd

😎
chillin'
View GitHub Profile
@hayd
hayd / keybase.md
Created October 2, 2014 01:11
keybase.md

Keybase proof

I hereby claim:

  • I am hayd on github.
  • I am hayd (https://keybase.io/hayd) on keybase.
  • I have a public key whose fingerprint is D034 7EA2 0535 504B B3AC 27EF 2125 41F4 444C 4308

To claim this, I am signing this object:

@hayd
hayd / from_image.jl
Last active August 29, 2015 14:08
Delaunay Tessellation from_image
import VoronoiDelaunay: Point2D, DelaunayTessellation, push!
# Create DelaunayTessellation with n points from an image
function from_image(img, n)
# placing points in places that represent the image
pts = Point2D[]
for i in 1:n
x = rand()
@hayd
hayd / commands
Last active August 29, 2015 14:08
Extracting counts of test failures
nosetests 2> nose_output.log
@hayd
hayd / MetaDoc.jl
Created January 20, 2015 03:43
MetaDoc type
type MetaDoc
docstring::Base.Markdown.MD
sections::Vector{Pair}
MetaDoc(docstring, sections) = new(docstring, [sections])
MetaDoc(docstring, sections...) = new(docstring, [sections...])
end
m = MetaDoc(doc"....docs.... for `m`", :author=>"Me", :section=>"Foo functions")
@hayd
hayd / doc_base.jl
Created March 26, 2015 06:03
WIP julia docs (rst to md)
@doc """
""" Base
# Essentials
# ==========
#
# Introduction
# ------------
#
# The Julia standard library contains a range of functions and macros appropriate for performing scientific and numerical computing, but is also as broad as those of many general purpose programming languages. Additional functionality is available from a growing collection of available packages. Functions are grouped by topic below.
@hayd
hayd / autopep8_diff
Created April 20, 2015 06:05
offsets_yapf_autopep8
--- original/pandas/tseries/tests/test_offsets.py
+++ fixed/pandas/tseries/tests/test_offsets.py
@@ -44,7 +44,7 @@
####
-## Misc function tests
+# Misc function tests
####
@hayd
hayd / Makefile
Created June 2, 2015 23:03
leanpub makefile
all: book sample
book:
pandoc $(shell cat Book.txt) --smart --table-of-contents --chapters -o Book.pdf
sample:
pandoc $(shell cat Sample.txt) --smart --table-of-contents --chapters -o Sample.pdf
watch:
watchmedo shell-command --patterns="*.md" --command=make
@hayd
hayd / build.jl
Last active August 29, 2015 14:26
lexicon test build script
using LightGraphs
macro file(args...) buildfile(args...) end
buildfile(t, s::AbstractString) = buildfile(t, Expr(:string, s))
buildfile(target, source::Expr) = quote
open(joinpath(dirname(@__FILE__), $(esc(target))), "w") do file
println(" - '$($(esc(target)))'")
println(file, "<!-- AUTOGENERATED. See 'docs/build.jl' for source. -->")
@hayd
hayd / cs258ps3sudokuCheckAndFill.py
Created July 12, 2012 13:07
Sudoku checker - checks whether a sudoku grid is allowable, or completable (and if so fills it in)
def check_sudoku(grid):
'''If grid is a valid sudoku board, so far filled-in correctly: returns True
else if grid is a valid sudoku board but has been filled-in incorrectly: returns False
else: returns None
Note: returning True does not imply there is a solution for grid, see solve_sudoku.
'''
def sanity_check():
'''If grid is of the sudoku board format: returns True
else: returns None
@hayd
hayd / sudukoObject.py
Created July 13, 2012 16:48
Sudoku object - with hints
#Note this requires the function solve_sudoku.
def Sudoku(grid):
def __init__(self):
self.grid = grid
self.solution = solve_sudoku(self.grid)
self.hints = self.get_hints()
def solvable(self):
return bool(self.solution)