Skip to content

Instantly share code, notes, and snippets.

View JeremyMcCormick's full-sized avatar
:octocat:

Jeremy McCormick JeremyMcCormick

:octocat:
View GitHub Profile
ss << std::setprecision(10)
<< std::scientific
<< std::uppercase
<< "\t" << hepeup.IDUP[line]
<< "\t" << hepeup.ISTUP[line]
<< "\t" << hepeup.MOTHUP[line].first
<< "\t" << hepeup.MOTHUP[line].second
<< "\t" << hepeup.ICOLUP[line].first
<< "\t" << hepeup.ICOLUP[line].second
<< "\t" << hepeup.PUP[line][0]
get_cmake_property(_variableNames VARIABLES)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
<!-- userinfo defs -->
<auxiliary auxtype="DetectorID" auxvalue="DefaultID">
<auxiliary auxtype="IDField" auxvalue="subdet">
<auxiliary auxtype="StartBit" auxvalue="0"/>
<auxiliary auxtype="EndBit" auxvalue="3"/>
</auxiliary>
<auxiliary auxtype="IDField" auxvalue="layer">
<auxiliary auxtype="StartBit" auxvalue="4"/>
<auxiliary auxtype="EndBit" auxvalue="11"/>
</auxiliary>
import multiprocessing
from multiprocessing import Pool
def power(x):
if x==0:
exponent=.5
elif x==1:
exponent=2
elif x==2:
#!/usr/bin/env python
import MySQLdb
f = open('hodo_channels_daq.csv', 'r')
lines = f.readlines()
lines = lines[1:]
records = []
for l in lines:
rec = l.strip().split(',')
@JeremyMcCormick
JeremyMcCormick / jupyterhub_aws.md
Created May 16, 2019 16:21 — forked from widdowquinn/jupyterhub_aws.md
Set up JupyterHub on AWS

JupyterHub on AWS

EC2 Setup

  • Log in to AWS
  • Go to a sensible region
  • Start a new instance with Ubuntu Trusty (14.04) - compute-optimised instances have a high vCPU:memory ratio, and the lowest-cost CPU time. c4.2xlarge is a decent choice.
  • Set security group (firewall) to have ports 22, 80, and 443 open (SSH, HTTP, HTTPS)
  • If you want a static IP address (for long-running instances) then select Elastic IP for this VM
  • If you want to use HTTPS, you'll probably need a paid certificate, or to use Amazon's Route 53 to get a non-Amazon domain (to avoid region blocking).
import boto3
# For a Boto3 client.
ddb = boto3.client('dynamodb', endpoint_url='http://localhost:8000')
response = ddb.list_tables()
print(response)
# For a Boto3 service resource
ddb = boto3.resource('dynamodb', endpoint_url='http://localhost:8000')
print(list(ddb.tables.all()))
#include <vector>
void MakeGeometry() {
TGeoManager *geom = new TGeoManager ("simple1", "Simple geometry");
//--- define some materials
TGeoMaterial *matVacuum = new TGeoMaterial ("Vacuum", 0, 0, 0);
TGeoMaterial *matAl = new TGeoMaterial ("Al", 26.98, 13, 2.7);
//--- define some media
TGeoMedium *Vacuum = new TGeoMedium ("Vacuum", 1, matVacuum);
#include <vector>
#include <iostream>
#include "TEveManager.h"
#include "TEveBrowser.h"
#include "TEveGeoNode.h"
#include "TEveScene.h"
#include "TEveViewer.h"
#include "TGLViewer.h"
auto vec = step->GetPreStepPoint()->GetPosition();
const double pos[] = {vec[0], vec[1], vec[2]};
double bfield[] = {0, 0, 0, 0};
G4StepPoint* pre = step->GetPreStepPoint();
G4FieldManager* globalFieldMgr = G4TransportationManager::GetTransportationManager()-> GetFieldManager();
globalFieldMgr->GetDetectorField()->GetFieldValue(pos, bfield);
std::cout << ">>>> Field val: " << pre->GetPosition() << " -> ("
<< bfield[0] << ", " << bfield[1] << ", " << bfield[2] << ") " << std::endl;