Skip to content

Instantly share code, notes, and snippets.

@brickZA
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

svn://svn.code.sf.net/p/tango-cs/code/archiving/hdb++/hdbextractor/cpp/tags/release-0.94.0/hdbxtest

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
brickZA / PolledDS.py
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
@TS.attribute(dtype='DevBoolean',
@brickZA
brickZA / log_future_exception.py
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
Example
-------
@brickZA
brickZA / add_lock_setters_getters.py
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
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$
_test%(seven')')
@brickZA
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
brickZA / tempdir.py
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):