Skip to content

Instantly share code, notes, and snippets.


Dan O'Donovan danodonovan

View GitHub Profile
danodonovan /
Last active Oct 29, 2019
Testing out performance of the multiprocessing.shared_memory in python 3.8
from functools import partial
import multiprocessing
from multiprocessing.managers import SharedMemoryManager
import random
import time
danodonovan /
Created Jul 18, 2018
Script to restore items deleted from a versioned S3 bueckt
import logging
import boto3
from healx.batching import batched
from healx.iterables import flatten
logger = logging.getLogger(__file__)
client = boto3.client('s3')
danodonovan / cypher.cql
Last active Jan 15, 2018
Handy Neo4j Queries
View cypher.cql
// count all node labels
RETURN labels(n), count(DISTINCT n);
// describe metagraph
CALL db.schema();
// list node stats
// Sample some nodes, reporting on property and relationship counts per node.
MATCH (n) WHERE rand() <= 0.1
danodonovan /
Last active Mar 6, 2017
PyHamcrest not catching SystemExit exception
import sys
import unittest
from hamcrest import assert_that, calling, raises
import pytest
def call_exit():
danodonovan /
Created Jul 25, 2016
Call a non-static function on a class in parallel.
from multiprocessing import Pool
from multiprocessing.pool import ApplyResult
def call_it(instance, name, args=(), kwargs=None):
if kwargs is None:
kwargs = {}
return getattr(instance, name)(*args, **kwargs)
View gist:795f7aad8c8c660f325d
### Keybase proof
I hereby claim:
* I am danodonovan on github.
* I am danodonovan ( on keybase.
* I have a public key whose fingerprint is 910D 91FB 2702 4C4C 4330 0268 B631 1E01 140A B905
To claim this, I am signing this object:
import bisect
class NFA(object):
EPSILON = object()
ANY = object()
def __init__(self, start_state):
self.transitions = {}
self.final_states = set()
self._start_state = start_state