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 / 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 / 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 / appending_to_csv.py
Created April 20, 2015 19:45
appending to csv
def append_frame(f='foo.csv', df=df, keep_open=False, n=1000):
if keep_open:
with open(f, mode='a') as f_:
for i in xrange(n):
df.to_csv(f_, mode='a')
else:
for i in xrange(n):
df.to_csv(f, mode='a')
os.remove(f)
@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 / inspect.py
Created March 27, 2015 23:10
inspect.py
"""Get useful information from live Python objects.
This module encapsulates the interface provided by the internal special
attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.
Here are some of the useful functions provided by this module:
ismodule(), isclass(), ismethod(), isfunction(), isgeneratorfunction(),
isgenerator(), istraceback(), isframe(), iscode(), isbuiltin(),
@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 / 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 / commands
Last active August 29, 2015 14:08
Extracting counts of test failures
nosetests 2> nose_output.log
@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 / 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: