Skip to content

Instantly share code, notes, and snippets.

David Glick davisagli

Block or report user

Report or block davisagli

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
class Pipe:
def __init__(self, source):
self.source = source
def __or__(self, sink):
return Pipe(sink(self.source))
def reverse(s):
return s[::-1]
View multibehaviors.json
"properties": {
"behaviors": {
"additionalProperties": {
"oneOf": [
"properties": {
"@type": {
# Change set.__module__ to 'builtins'
# so that it will pickle with the right module for Python 3
from ctypes import Structure, c_ssize_t, c_void_p, c_char_p
class PyTypeObject(Structure):
_fields_ = [
('ob_refcnt', c_ssize_t),
('ob_type', c_void_p),
('ob_size', c_ssize_t),
('tp_name', c_char_p),

Keybase proof

I hereby claim:

  • I am davisagli on github.
  • I am davisagli ( on keybase.
  • I have a public key ASDutQViikK1K9Mb7n1PuFHh81ZWUMYDNO-OEIorm5xxTwo

To claim this, I am signing this object:

davisagli /
Created May 17, 2016
Filemaker CSV reader
import csv
class FilemakerCSVDictReader():
"""CSV reader to read Filemaker CSV exports as dicts.
Applies a few transformations to all values:
* Decodes as cp1252
* Replaces vertical tabs with newlines
* Splits fields containing the Group Separator control character into lists
davisagli / gist:0315c6d206351c5daa4c
Created Oct 29, 2014
class for using CiviCRM API from Python
View gist:0315c6d206351c5daa4c
import json
import requests
class Action(object):
def __init__(self, entity, name):
self.civi = entity.civi
self.entity_name = = name
davisagli / gist:23663cfa164460f3b3a2
Created Sep 25, 2014
Using the CloudShare API from Python
View gist:23663cfa164460f3b3a2
from hashlib import sha1
import random
import requests
import string
import time
# these come from your CloudShare account page
USER_ID = ''
KEY = ''
davisagli / gist:1128383064b1ba5c06b4
Last active Aug 29, 2015
authenticating to google API using Service Account credentials
View gist:1128383064b1ba5c06b4
import httplib2
# these are from the google-api-python-client package
from apiclient.discovery import build
from oauth2client.client import SignedJwtAssertionCredentials
def _get_google_service(email, key):
"""Get a Google API client using Service Account credentials"""
credentials = SignedJwtAssertionCredentials(
View gist:8998503
from Products.Five import BrowserView
from zope.interface import implementer
from zope.publisher.interfaces.browser import IPublishTraverse
class AuthorView(BrowserView):
user_id = None
def publishTraverse(self, request, name):
davisagli / ram.ipynb
Last active Dec 27, 2015
Experiments with Plone object RAM use (ipython notebook viewer:
View ram.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.