Skip to content

Instantly share code, notes, and snippets.

View alexsparrow's full-sized avatar

Alex Sparrow alexsparrow

View GitHub Profile

Privacy Policy

Alex Sparrow built the Craft Beer Finder app as a Free app. This SERVICE is provided by Alex Sparrow at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at Craft Beer Finder unless otherwise defined in this Privacy Policy.

<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:;databaseName=/tmp/metastore_db;create=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>org.apache.derby.jdbc.EmbeddedDriver</value>
<description>Driver class name for a JDBC metastore</description>
from fastkml import kml
k = kml.KML()
k.from_string(open("data/48cb6f8ca308484097e6ed4720b27faa_1.kml").read())
# This map will be a dict of borough name -> shapely geometry
map = {}
doc = list(k.features())[0]
for folder in doc.features():
@alexsparrow
alexsparrow / my-formula.rb
Created April 30, 2013 15:13
Homebrew formula exhibiting hanging system call
require 'formula'
require 'find'
require 'version'
class MyFormula < Formula
BASEDIR=File.dirname(Pathname.new(__FILE__).realpath)
def self.init
homepage 'www.foo.com'
keg_only "We don't need all the stuff on the PATH"
depends_on 'foo/brew/postgis-15'
class Node:
def __init__(self, name, left, right):
self.name = name
self.left = left
self.right = right
class Tree:
def __init__(self):
self.root = Node('1', Node('2', Node('4', None, None), Node('5', None, None)), Node('3', Node('6', None, None), Node('7', None, None)))
class Node(object):
def __init__(self, depth):
# Node children keyed by character
self.children = {}
# Reference count
self.count = 0
# Depth from root node
self.depth = depth
def add(self, key):
@alexsparrow
alexsparrow / gambit.sh
Created October 10, 2012 15:15
gambit
ANS=$(wget -qO- http://quiz.gambitresearch.com/ --save-cookies "gambit.cookies" | grep "To apply" | cut -f 2 -d ':' | cut -f 2 -d '{' | cut -f 1 -d '}' | bc -l)
echo $ANS
wget -qO- --load-cookies "gambit.cookies" http://quiz.gambitresearch.com/job/$ANS
@alexsparrow
alexsparrow / TPyMultiGenFunction.py
Created November 2, 2011 14:50
Example using TPyMultiGenFunction
import ROOT as r
class Rosenbrock( r.TPyMultiGenFunction ):
def __init__( self ):
print "CREATED"
r.TPyMultiGenFunction.__init__( self, self )
def NDim( self ):
print 'PYTHON NDim called'
@alexsparrow
alexsparrow / post-receive
Created October 11, 2011 13:31
Git post-receive hook for building thesis
#. /usr/share/doc/git-core/contrib/hooks/post-receive-email
#export GEM_HOME=/home/hep/as1604/.gems/
git checkout -f
cd $HOME/Research/thesis_workdir
cp -r packages/* ~/texmf
texhash $HOME/texmf
#ruby -I ~/.rubygem/lib -I ~/lib64/ruby/ ~/.gems/bin/rake pdf
source ~/.thesis_env/bin/activate
scons pdf
cp thesis.pdf ~/public_html/thesis/
@alexsparrow
alexsparrow / sconsenv.sh
Created July 5, 2011 10:26
Script to setup scons in private area via virtualenv
#!/bin/sh
echo ">> Downloading virtualenv..." && \
wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.6.4.tar.gz#md5=1072b66d53c24e019a8f1304ac9d9fc5 && \
echo ">> Extracting..." && \
tar -xvzf virtualenv-1.6.4.tar.gz && \
echo ">> Creating '.pythondir'..." && \
mkdir .pythondir && \
cd virtualenv-1.6.4 && \
echo ">> Installing virtualenv..." && \
python setup.py install --prefix ../.pythondir && \