Skip to content

Instantly share code, notes, and snippets.

@jdbrice
jdbrice / gist:8205ad1ac558b76eb409
Created June 1, 2014 19:37
Bootstrap form for selecting state and entering region / city
<form class="form-horizontal" action="../action-add-region" method="post">
<fieldset>
<!-- Form Name -->
<legend>Form Name</legend>
<!-- Select Basic -->
<div class="form-group">
<label class="col-md-4 control-label" for="state">Select State</label>
<div class="col-md-4">
@jdbrice
jdbrice / pidSigma
Last active August 29, 2015 14:07
Sigma Data from pid Oct3
500 files, traditional recentering, on K
sigmaK = {{325, 0.0174083}, {375, 0.0150993}, {425, 0.0133778}, {475, 0.0127929},
{525, 0.0121848}, {575, 0.0118757}, {625, 0.0117165}, {675, 0.0114338}, {725, 0.011562},
{775, 0.0114157}, {825, 0.0114278}, {875, 0.0112749}, {925, 0.0112676}, {975, 0.0112449},
{1025, 0.011016}, {1075, 0.0109425}, {1125, 0.0111513} };
meanK = {{325, -0.0020003}, {375, -0.00367079}, {425, -0.00412365}, {475, -0.00545558},
{525, -0.00561379}, {575, -0.00613719}, {625, -0.00638883}, {675, -0.00639244},
{725, -0.00671236}, {775, -0.00698594}, {825, -0.00701241}, {875, -0.00674716},
{925, -0.00692614}, {975, -0.00709467}, {1025, -0.0067737}, {1075, -0.00823214}, {1125, -0.00709135} };
@jdbrice
jdbrice / Kong_Sim_Fit.cpp
Last active August 29, 2015 14:19
Kong's Simultaneous Blast Wave fit code
#include <iostream>
#include <fstream>
#include <math.h>
#include "TMath.h"
#include <stdio.h>
#include <iomanip>
#include <vector>
#include "TGraph.h"
#include "TF1.h"
#include "TH1D.h"
@jdbrice
jdbrice / jdbrice_codex.js
Last active August 29, 2015 14:21
STAR related code index for quick finding
var jdbrice_codex =
{
"code":
[
{
"name": "TOF Calibration ntupler",
"value": "/star/institutions/rice/jdb/calib/",
"owner": "daniel"
},
{
@jdbrice
jdbrice / TreeAnalyzer_Config.xml
Created May 26, 2015 14:30
An example config file for the Tree Analyzer boiler plate code
<?xml version="1.0" encoding="UTF-8"?>
<!-- A root node is required -->
<!-- It can be anything <root></root>, it just has to exist -->
<config>
<TreeAnalyzer>
<!-- Use an input tag for setting up the chain only. It isup to you to use an adapter -->
@jdbrice
jdbrice / HistoAnalyzer_config.xml
Last active August 29, 2015 14:21
Example Config for the HistoAnalyzer Boiler plate class
<?xml version="1.0" encoding="UTF-8"?>
<!-- A root node is required -->
<!-- It can be anything <root></root>, it just has to exist -->
<config>
<HistoAnalyzer>
<!-- Use an input tag for Specifying the input data file - it will be loaded for you -->
@jdbrice
jdbrice / sshfs_mount
Created July 7, 2015 23:09
A script for mounting sshfs locations on OS X
#!/bin/bash
# Script for mounting remote directories using sshfs
# $1 - remote host
# $2 - remote dir
# $3 - local mount point
if mount | grep "on $3" > /dev/null; then
echo "Local directory $3 already mounted"
@jdbrice
jdbrice / rcf_website_backup.sh
Created July 7, 2015 23:10
script to backup my rcf website
#!/bin/bash
# backup the website on the server
bnlMountHome
now=$(date +"%m_%d_%Y")
#/Users/danielbrandenburg/bnl/local/www/backup
tar -cvf "bnl_site_${now}.tar" /star/u/jdb/WWW/site
gzip -9 "bnl_site_${now}.tar"
mv "bnl_site_${now}.tar.gz" ../backup/
@jdbrice
jdbrice / wordwrap_custom.js
Created July 9, 2015 19:54
IPython3 Notebook wordwrap
// Put this inside your custom.js file
// works for ipython 3 notebooks
$([IPython.events]).on('app_initialized.NotebookApp', function(){
IPython.CodeCell.options_default['cm_config']['lineWrapping'] = true;
});
@jdbrice
jdbrice / ipynb_bi_direction.js
Created July 14, 2015 15:01
ipynb bi directional js communication ( may be a little old as of July 2015 )
# Example from http://jakevdp.github.io/blog/2013/06/01/ipython-notebook-javascript-python-communication/ adapted for IPython 2.0
# Add an input form similar to what we saw above
input_form = """
<div style="background-color:gainsboro; border:solid black; width:600px; padding:20px;">
Code: <input type="text" id="code_input" size="50" height="2" value="sin(pi / 2)"><br>
Result: <input type="text" id="result_output" size="50" value="1.0"><br>
<button onclick="exec_code()">Execute</button>
</div>
"""