Skip to content

Instantly share code, notes, and snippets.

Eric Higgins erichiggins

Block or report user

Report or block erichiggins

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am erichiggins on github.
  • I am erichiggins (https://keybase.io/erichiggins) on keybase.
  • I have a public key ASDQ1plERE4G6ef8c_KV640t0DUHHeD6FJFO1DbYX9X8xwo

To claim this, I am signing this object:

@erichiggins
erichiggins / zipimportify.py
Last active Dec 10, 2016
Converts a directory of Python packages installed by pip into importable zip files for use on Google App Engine.
View zipimportify.py
#!/usr/bin/env python
"""
Convert a directory of pip-installed libraries into zip-imports for use on GAE.
Usage:
pip install -U <library_name>
pip freeze > requirements_dev.txt
pip install -U --egg --target <path_to_zips> -r requirements_dev.txt
python zipimportify.py <path_to_zips>
@erichiggins
erichiggins / datastore_fetch_all.py
Last active Apr 26, 2019
Efficiently page over a Query to fetch all entities from the Google App Engine Datastore.
View datastore_fetch_all.py
#!/usr/bin/python
"""
Functions are provided for both the DB and NDB Datastore APIs.
References:
* https://cloud.google.com/appengine/docs/python/datastore/queries
* https://cloud.google.com/appengine/docs/python/ndb/queries
"""
def db_fetch_all(query, limit=100, cursor=None):
@erichiggins
erichiggins / docker_passthru.bash.inc
Last active Dec 4, 2015
Enables command deligation to Docker images for a specific repo or directory.
View docker_passthru.bash.inc
# https://gist.github.com/erichiggins/a8bcd07295597d91dea7/
# version: 0.1.0
# author: Eric Higgins <erichiggins@gmail.com>
#
# Installation:
#
# 1) Copy this file into your repo's directory.
# cp docker_passthru.bash.inc ~/src/myrepo/
# 2) Add the following to your ~/.bash_profile to include this script.
# source ~/src/myrepo/docker_passthru.bash.inc
@erichiggins
erichiggins / bootstrap.py
Last active Jan 2, 2017
Adding Google App Engine SDK to Python virtualenv
View bootstrap.py
#!/usr/bin/env python
"""
Setup a virtualenv with the Google App Engine SDK.
References:
http://virtualenv.readthedocs.org/en/latest/virtualenv.html#creating-your-own-bootstrap-scripts
http://mindtrove.info/virtualenv-bootstrapping/
"""
import hashlib
import os
@erichiggins
erichiggins / search_models.py
Created Apr 29, 2014
GAE Search-augmented NDB Models: Keep a searchable index up-to-date with the latest information in your datastore Models.
View search_models.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Search-augmented NDB Models for Google App Engine.
Usage:
import search_models
# Define an index for the document type.
@erichiggins
erichiggins / gae_ndb_revisions
Last active Aug 29, 2015
GAE NDB Revisions: Create automatic versions of your datastore models, allowing you to undo changes!
View gae_ndb_revisions
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Create automatic versions of your App Engine Datastore Models, allowing you to undo changes!
Usage:
import gae_ndb_revisions
# Add two properties to your Model(s).
@erichiggins
erichiggins / jsbin.bavel.css
Last active Aug 29, 2015
Simple box-and-whisker graph created from Magnetospeed data (in JSON format) using D3.js. http://jsbin.com/bavel/2/ based on http://bl.ocks.org/mbostock/4061502
View jsbin.bavel.css
.box {
font: 10px sans-serif;
}
.box line,
.box rect,
.box circle {
fill: #fff;
stroke: #000;
stroke-width: 1.5px;
View jsbin.bahijuve.css
.line {
fill: none;
stroke: lightblue;
stroke-width: 1.5px;
stroke-linecap: butt;
shape-rendering: geometricPrecision ;
}
.axis--x text {
}
@erichiggins
erichiggins / ndb_json.py
Last active Nov 20, 2018
JSON serializer/deserializer adapted for use with Google App Engine's NDB Datastore API. This script can handle Model, Expando, PolyModel, Query, QueryIterator, Key, datetime, struct_time, and complex types.
View ndb_json.py
#!/usr/bin/env python
"""
JSON encoder/decoder adapted for use with Google App Engine NDB.
Usage:
import ndb_json
# Serialize an ndb.Query into an array of JSON objects.
query = models.MyModel.query()
You can’t perform that action at this time.