Skip to content

Instantly share code, notes, and snippets.

@jdbrice
jdbrice / arange.py
Last active January 31, 2019 21:30
Makes numpy arange ranges from the shell, even chain together with commas
#!/usr/bin/env python
import numpy
import sys
if len(sys.argv) < 4:
print( "Usage: arange start stop step [, ndecimals]" )
exit()
if not sys.stdin.isatty():
@jdbrice
jdbrice / jupyter.css
Created December 16, 2018 17:52
Styling for jupyter notebooks saved to html
/*!
*
* Twitter Bootstrap
*
*/
/*!
* Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
@jdbrice
jdbrice / battery.applescript
Created September 5, 2018 02:16
battery widget applescript for better touch tools
set theList to paragraphs of text of (do shell script "pmset -g batt")
set percent to word 6 of theList's item 2
set charge to word 7 of theList's item 2
if (charge = "charging") then
set iconC to "⚡️"
else
set iconC to ""
end if
@jdbrice
jdbrice / spotify_now_playing.applescript
Created September 5, 2018 01:59
apple script for spotify now playing in better touch tools
if application "Spotify" is running then
tell application "Spotify"
if player state is playing then
return (get artist of current track) & " – " & (get name of current track)
else
return ""
end if
end tell
end if
@jdbrice
jdbrice / play_pause.applescript
Created September 5, 2018 01:58
play pause apple script for Better TouchTools
if application "Spotify" is running then
tell application "Spotify"
if player state is playing then return "pause"
end tell
end if
if application "iTunes" is running then
tell application "iTunes"
if player state is playing then return "pause"
end tell
@jdbrice
jdbrice / sample_submit.xml
Created August 28, 2018 14:18
Sample RCF condor submit XML file
<job name="MuDst2FemtoDst_Run15_pp200" simulateSubmission ="false" maxFilesPerProcess="10" filesPerHour="50" >
<stdout URL="file:/star/data03/pwg/jdb/scratch/log/log_$JOBID.log" />
<stderr URL="file:/star/data03/pwg/jdb/scratch/log/err_$JOBID.err" />
<output fromScratch="*FemtoDst.root" toURL="file:/star/data03/pwg/jdb/scratch/" />
<input URL="catalog:star.bnl.gov?trgsetupname=AuAu200_production_2011,filetype=daq_reco_MuDst,filename~st_upc,storage=local" nFiles="50000" />
<command>
@jdbrice
jdbrice / blank.condor.config.sh
Created June 13, 2018 17:02
Submit jobs to condor easily
GetEnv = True
@jdbrice
jdbrice / scale.C
Created May 29, 2018 04:33
Shuai's ccbar scaling code
void scale(){
TFile *f = new TFile( "cc2ee_dimuonAcc_2014BR.root" );
TH1 * hnParent = (TH1*)f->Get( "nParent" );
TH2 * hMcAcc = (TH2*)f->Get( "hMCAcc1MvsPtcc2ee" );
double Ncc = hnParent->GetBinContent(1);
@jdbrice
jdbrice / bias.C
Created May 29, 2018 04:30
NColl Bias
TChain *c = NULL;
double meanNcollAt( float mlow, float mhigh ){
TH1D * hncoll = new TH1D( "hncoll", "", 1000, 0, 1000 );
TString cut = TString::Format("mult > %f && mult <= %f", mlow, mhigh );
c->Draw( "ncoll>>hncoll", cut );
@jdbrice
jdbrice / export_params.C
Created May 29, 2018 04:23
Run13 TOF reso export
void print_tray( int tray ){
cout << endl << tray << " 0" << endl;
}
void export_params(){