Skip to content

Instantly share code, notes, and snippets.

View mgmarino's full-sized avatar

Michael Marino mgmarino

View GitHub Profile
import configparser
import os
import boto3
import sys
import random
import string
def fail(msg):
sys.stderr.write("{}\n".format(msg))
sys.exit(1)
var jwkToPem = require("jwk-to-pem");
var jwk = JSON.parse(process.env.OAUTH_TOKEN_KEY)
var output = {
signingKey: jwkToPem(jwk, {
private: true
}),
verifierKey: jwkToPem(jwk, {
private: false
})
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# coding: utf-8
# In[1]:
import numpy
import itertools
import h5py
# make an array with a lot of stuff

Keybase proof

I hereby claim:

  • I am mgmarino on github.
  • I am mikemarino (https://keybase.io/mikemarino) on keybase.
  • I have a public key ASAIGPtdpd5bBv6KvKHsHC9UxPObznQYc1RLm4WzumGbdQo

To claim this, I am signing this object:

@mgmarino
mgmarino / make_3d_pdf.py
Created February 16, 2012 14:22
Split Geant4 VRML files
import sys
import re
def split_g4_vrml_file(afile):
one_string = open(afile).read()
split_string = one_string.split('#')
file_output_list = {}
camera = ""
temp = re.compile("---------- (.*)")
obj_name = re.compile("(.*): (.*)\..*")
@mgmarino
mgmarino / grab_events.py
Created January 27, 2014 17:04
From EXOEventSummary, make (run, event) tuple list.
import ROOT
dataTree = #...
# Make sure there is enough space in the arrays
dataTree.SetEstimate(dataTree.GetEntries())
dataTree.Draw("runNum:eventNum", "", "goff")
v1 = dataTree.GetV1()
import ROOT
import sys
import array
ROOT.gSystem.Load("software/OrcaROOT/Bindings/libPyOrcaROOT")
ROOT.gSystem.Load("software/TWaveform/lib/libWaveWaveBase")
class WFConvert(ROOT.ORPyTreeWriter):
def __init__(self, dec, treeName):
ROOT.ORPyTreeWriter.__init__(self, dec, treeName)
@mgmarino
mgmarino / remove_schema.py
Last active January 4, 2016 04:09
Removes the rules schema for EXOTRefArray to improve processing. Mirrors a directory. Usage: python remove_schema.py [input_dir] [output_dir] where input_dir should look like: input_dir/[0-9][0-9][0-9][0-9]/denoised*.root output_dir does not need to exist.
import sys
import ROOT
import glob
import os
def copy_tree_without_schema(input_file, output_file):
an_input = ROOT.TFile(input_file)
try:
ROOT.EXOTRefArray.Class().GetSchemaRules().GetRules().Clear()
@mgmarino
mgmarino / etc_rc.d_couchdb.diff
Last active December 29, 2015 02:39
Changes to couchdb (1.3.0) startup script
*** etc/init/couchdb Tue Apr 30 15:11:17 2013
--- /etc/rc.d/couchdb Thu May 2 11:34:40 2013
***************
*** 66,72 ****
command="$command $COUCHDB_OPTIONS"
fi
if test -n "$COUCHDB_USER"; then
! if su $COUCHDB_USER -c "$command"; then
return $SCRIPT_OK
else