Skip to content

Instantly share code, notes, and snippets.

View mgmarino's full-sized avatar

Michael Marino mgmarino

View GitHub Profile
@mgmarino
mgmarino / toggle_laser_status.py
Created March 5, 2014 13:24
Toggle status using cloudant module
import cloudant
# Authentication
acct = cloudant.Account(uri="http://raid.nedm1:5984")
res = acct.login("username", "password")
assert res.status_code == 200
# Grab the correct database
db = acct["nedm%2Fhg_laser"]
des = db.design("nedm_default")
@mgmarino
mgmarino / test_ft.py
Created March 12, 2014 16:20
Test functionality of TWaveform
import ROOT
import os
import numpy as np
ROOT.gSystem.Load(os.path.expanduser("~/software/TWaveform/lib/libWaveWaveBase"))
wf_dbl = ROOT.TDoubleWaveform()
wf_dbl.SetLength(1000000)
# put in a delta function
import cloudant
import time
# Authentication
acct = cloudant.Account(uri="http://127.0.0.1:5984")
res = acct.login("username", "password")
assert res.status_code == 200
# Grab the correct database
db = acct["nedm%2Ftemperature_environment"]
import cloudant
import time
import random
# Authentication
acct = cloudant.Account(uri="http://127.0.0.1:5984")
res = acct.login("username", "password")
assert res.status_code == 200
# Grab the correct database
@mgmarino
mgmarino / read_example.py
Created March 25, 2014 16:10
General read with time range for all data, and only one variable.
import cloudant
# Authentication
acct = cloudant.Account(uri="http://raid.nedm1:5984")
res = acct.login("username", "password")
assert res.status_code == 200
# Grab the correct database
db = acct["nedm%2Factive_coil_compensation"]
import sys
import ROOT
import itertools
import numpy
import math
class FailedComparison(Exception):
pass
def compare_objects(a, b):
@mgmarino
mgmarino / toptica_readout.py
Last active August 29, 2015 14:01
For Bernd...
import socket
class SocketObj:
def __init__(self, address, port, term_character="\n"):
s = socket.socket()
s.connect((str(address), port))
self.s = s
self.tc = term_character
self.flush_buffer()
self.cmd_and_return("echo=false")
# Makefile for linking against ROOT
# M. Marino 22 May 2007
TARGETS = gistfile1
SOURCES = $(wildcard *.cpp) #uncomment these to add all cc files in directory to your compile list
OBJS = $(SOURCES:.cpp=.o)
TARGETOBJ = $(patsubst %, %.o, $(TARGETS))
CXX = g++
@mgmarino
mgmarino / root_5.28.00h_xrootd_patch.diff
Created June 11, 2014 13:09
Diff to apply to 5.28.00h to be able to build with xrootd 3.1.1 and later. Usage: 'patch -p0 < root_5.28.00h_xrootd_patch.diff'
diff --git net/netx/Module.mk net/netx/Module.mk
index 897ea26..a55e93b 100644
--- net/netx/Module.mk
+++ net/netx/Module.mk
@@ -58,7 +58,7 @@ endif
ifeq ($(PLATFORM),win32)
NETXLIBEXTRA += $(XROOTDDIRL)/libXrdClient.lib
else
-NETXLIBEXTRA += -L$(XROOTDDIRL) -lXrdOuc -lXrdSys \
+NETXLIBEXTRA += -L$(XROOTDDIRL) \
@mgmarino
mgmarino / couchdb_updater.py
Created June 11, 2014 17:26
daemon to be run as an update_notification process for couchdb
import cloudant
import sys
import json
import re
import logging
# global variables
_ignored_dbs = []
_handled_dbs = {}
_max_updates = 100