Skip to content

Instantly share code, notes, and snippets.

"""
Copyright 2017 Red Hat, Inc
Author: John Spray <john.spray@redhat.com>
License: LGPLv2
Middle name: Danger
"""
import rados
import cephfs
# License: LGPL2.1 or later
from glob import glob
import os
import re
import socket
import subprocess
import struct
import json
@jcsp
jcsp / 962_client_1.py
Created April 7, 2014 12:07
libzmq issue #962 reproducer
import zmq
import sys
def send(payload):
"""
This emulates the salt SREQ class's __init__() and send()
methods, which are called together repeatedly if using
Minion._fire_master to send monitoring data. Hopefully
we're going to reproduce the ZMQ crash that sometimes happens
in that case.
@jcsp
jcsp / gevent_nosleep
Created January 8, 2014 16:41
Decorator and context manager for asserting a region of code does not yield to another greenlet. Doesn't catch sleep()s yet.
from gevent import getcurrent
from functools import wraps
from contextlib import contextmanager
class ForbiddenYield(Exception):
pass
@contextmanager