Skip to content

Instantly share code, notes, and snippets.

View cranmer's full-sized avatar

Kyle Cranmer cranmer

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cranmer
cranmer / README.md
Last active August 19, 2022 20:18
Karabinder-elements control+a and control+e for begin and end of line

Microsoft office seems to over-ride control+a to be select all and control+e doesn't seem to do anything. This fixes that.

Add the remap_for_office.json file to ~/.config/karabiner/assets/complex_modifications/ then go to add complex modification and you should see a new rule called "Remap for office"

See also: https://www.youtube.com/watch?v=iiSIaMD4vqY

\documentclass[11pt]{article}
\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper} % ... or a4paper or a5paper or ...
%\geometry{landscape} % Activate for for rotated page geometry
%\usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{epstopdf}
\usepackage[
@cranmer
cranmer / gist:24f6b1f4074b65dd34f0
Created June 15, 2015 19:23
Embed custom.css into IPython for slides customization
from IPython.display import HTML
try:
myf = open('custom.css')
htmlstring = "<style>%s </style>" %(myf.read())
HTML(htmlstring)
except IOError:
print "no file"
@cranmer
cranmer / gist:96c4930b87b98387a11a
Created October 17, 2014 18:40
Betterize with Arial font instead
javascript:(function%20()%20%7Bvar%20els%20=%20%5B'div',%20'p',%20'span',%20'td',%20'th',%20'tr',%20'body',%20'section'%5D;%20for%20(var%20k%20=%200;%20k%20%3C%20els.length;%20++k)%20%7B%20$(els%5Bk%5D).css('font-family',%20'Arial');%7D%7D)();
@cranmer
cranmer / RooBSplineExample.py
Created September 2, 2014 20:18
RooBSpline example
import ROOT
import numpy as np
def makeBSpline(w,interpParam, observable, pdfList, paramPoints):
# source code for these classes can be found here:
# https://github.com/svenkreiss/roostats/tree/development/roofit/histfactory
#if you don't have this class in your ROOT library, but have it locally
ROOT.gROOT.ProcessLine(".L RooBSpline.cxx+")
paramVec = ROOT.TVectorD(len(paramPoints))
@cranmer
cranmer / RooMomentMorphExample.C
Last active February 5, 2020 13:44
RooMomentMorph example for RooFit
#for python, look here: https://gist.github.com/cranmer/46fff8d22015e5a26619
void testMM(){
// #Make statistical model
w = new RooWorkspace("w");
w->factory("Exponential::e(x[-5,15],tau[-.15,-3,0])");
x = w->var("x");
w->factory("mu[0,10]");
mu = w->var("mu");
frame = x->frame();
RooArgList pdfs;
@cranmer
cranmer / RooMomentMorphExample.py
Last active December 31, 2021 11:54
RooMomentMorph example for RooFit
#for C++ look here: https://gist.github.com/cranmer/b67830e46d53d5f7cf2d
import ROOT
import numpy as np
def testMomentMorph():
#Going to make a few statistical models we want to interpolate
#initialize workspace with some common background part
w = ROOT.RooWorkspace('w')
w.factory('Exponential::e(x[-5,15],tau[-.15,-3,0])')
x = w.var('x')