Skip to content

Instantly share code, notes, and snippets.

brickZA / README.rst
Last active August 25, 2016 15:13
Experimentation with hdbextractor python library

Seems to be built as part of hdb++/hdbextractor/cpp

Initial test files taken from


Assuming you are using HDB++ with the new mysql schema with the database host, database user, database password and database name as specified in db++config.dat, and that hdbextractor is install prefix is /usr/local, execute :

brickZA /
Last active May 5, 2016 15:00
Minimal test of tango events an file database using PyTango
import sys
import logging
from PyTango import Database, DbDevInfo
from PyTango import server as TS
class Polled(TS.Device):
__metaclass__ = TS.DeviceMeta
brickZA /
Last active August 29, 2015 14:08
Logging a future exception
import tornado
from functools import wraps
def log_coroutine_exceptions(coro):
"""Coroutine (or any method that returns a future) decorator to log exceptions
brickZA /
Created December 23, 2011 11:12
Python class decorator to automatically add lock-protected setters to variables
class AddLockSettersGetters(object):
class add(object):
def __init__(self, initial_value=None):
self.initial_value = initial_value
def __init__(self, lock_name):
self.lock_name = lock_name
def make_getter(self, name):
def getter(self):
brickZA / examples.txt
Created December 13, 2011 12:45
Tests for quoting with fabric.contrib.files.append. original.txt is generated using 6c483ef261ab8ed243b39a337b0382a8c84e5994, patched version using 6d91ffff8cb1c9ed468475a6ca4d167751f4dff0
test (one)
test '(' \ ) two
test "'three)' '' the
test \'a\'$ four
test ""'""'' five
^six $(('")"((thing)it's)'\'')'' test$
brickZA / System_info.txt
Created December 13, 2011 12:14
Sytem info for fabric tests
Ubuntu 11.04 amd64
$ python --version
Python 2.7.1+
Python package version: 2.7.1-0ubuntu5
brickZA /
Created September 6, 2011 12:37
A TempDir object that is compatible with the 'with' statment use, similar to tempfile.NamedTemporaryFile
import tempfile
import shutil
class TempDir(object):
def __init__(self, delete=True, **kwargs):
self.tempdir = tempfile.mkdtemp(**kwargs)
self.delete = delete
def __enter__(self):