Skip to content

Instantly share code, notes, and snippets.

@hgrecco
hgrecco / flux.py
Created March 12, 2014 06:00
A GUI to travel through time in your filesystem using Camlistore.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Camlistore Flux Capacitor
~~~~~~~~~~~~~~~~~~~~~~~~~
A GUI to travel through time in your filesystem using Camlistore.
:copyright: 2014 by Hernan E. Grecco.
:license: BSD.
from __future__ import division, unicode_literals, print_function, absolute_import
import re
from collections import defaultdict
_NEST_SCOPES = {'[': ']', '(': ')', '{': '}'}
_STR_SCOPES = '"' + "'"
#: Regex to find function calls.
@hgrecco
hgrecco / code
Last active December 22, 2015 14:39 — forked from ColinBrosseau/code
SampleRateUnit = {'Seconds': '0', 'Minutes': '1', 'Hours': '2',
'Days': '3', '%': '4'}
SamplePeriodUnit = {'Seconds': '0', 'Minutes': '1', 'Hours': '2',
'Days': '3', 'Weeks': '4', 'Pulses': '5'}
TotalDurationUnit = {'Period': '0', 'Seconds': '1', 'Minutes': '2',
'Hours': '3', 'Days': '4', 'Weeks': '5', 'Continuous': '6',
'predefinded': '7'}
TimeStampEnabled = {False: 0, True: 1}
@Feat(values=(None, SampleRateUnit, None, SamplePeriodUnit, None,
@hgrecco
hgrecco / test_wrap.py
Created August 21, 2013 01:28
Wrapping a ndarray
import numpy as np
class C(object):
def __init__(self, value):
self.value = value
def __getattr__(self, name):
return getattr(self.value, name)
@hgrecco
hgrecco / tasks.py
Last active June 22, 2022 07:49
Simple concurrent tasks with dependencies in Python.
from collections import defaultdict
import concurrent.futures
class TasksGroup(object):
"""A group of tasks with dependencies.
>>> tasks = TasksGroup()
>>> @tasks.add()
@hgrecco
hgrecco / lantz_multiple.py
Created October 5, 2012 12:09
Writting a multiple interface driver in lantz
class _A33120(object):
"""Agilent 33120A Function/Arbitrary Waveform Generator
"""
# Here goes the code for the instrument functions that
# are available in *both* GPIB and RS-232
class A33120Serial(_A33120, SerialDriver):
"""Agilent 33120A Function/Arbitrary Waveform Generator