Skip to content

Instantly share code, notes, and snippets.

View AndiH's full-sized avatar
🤖
q|^_^|p

Andreas Herten AndiH

🤖
q|^_^|p
View GitHub Profile
#!/usr/bin/env python
import argparse
import filecmp
import subprocess
def compareFilecmp(a, b):
# See https://docs.python.org/3/library/filecmp.html
return filecmp.cmp(a.name, b.name)
def compareFileLengths(a, b):
@AndiH
AndiH / fixnumpad-osx.plugin.zsh
Created November 13, 2015 13:17
Enables numpad keys of Apple keyboards to be recognized in zsh via oh-my-zsh plugin
# Fix numeric keypad
# 0 . Enter
bindkey -s "^[Op" "0"
bindkey -s "^[On" "."
bindkey -s "^[OM" "^M"
# 1 2 3
bindkey -s "^[Oq" "1"
bindkey -s "^[Or" "2"
bindkey -s "^[Os" "3"
# 4 5 6
#!/usr/bin/env bash
xattr -r -d com.apple.quarantine /Volumes/Dokumente/
@AndiH
AndiH / aTextSuperSubScript.csv
Created August 30, 2015 11:41
List of Superscript and Subscript Unicode Replacements for aText
;bar ̄
;^1 ¹
;^2 ²
;^3 ³
;^4
;^5
;^6
;^7
;^8
;^9
@AndiH
AndiH / colorVis.cpp
Last active August 29, 2015 14:17
Create color table based on Tableau20 colors
// Script for generating a table of Tableau colors, as defined in A. Goerres script (https://gist.github.com/Nepomuk/859fef81a912a9fe425e).
// AH, 25.3.2015
TString getStringForColorNumberT20(Int_t numb) {
if ( numb == 0 ) return TString("SteelBlue");
else if ( numb == 1 ) return TString("LightSteelBlue");
else if ( numb == 2 ) return TString("DarkOrange");
else if ( numb == 3 ) return TString("PeachPuff");
else if ( numb == 4 ) return TString("Green");
else if ( numb == 5 ) return TString("LightGreen");
@AndiH
AndiH / mergeRootFilesByTxt.sh
Created March 14, 2015 12:22
ROOT hadd-based recursive merger with input.txt
#!/bin/bash
# hadd recursive merger by Andre Goerres and Andreas Herten
# 14.3.2015
function fileToArray {
output=""
while read line; do
output=$output" "$line
done < $1
echo $output
@AndiH
AndiH / colors.py
Last active April 22, 2022 14:33
Tableau 20 and TableauColor Blind 10 Colors
# Tableau 20 Colors
tableau20 = [(31, 119, 180), (174, 199, 232), (255, 127, 14), (255, 187, 120),
(44, 160, 44), (152, 223, 138), (214, 39, 40), (255, 152, 150),
(148, 103, 189), (197, 176, 213), (140, 86, 75), (196, 156, 148),
(227, 119, 194), (247, 182, 210), (127, 127, 127), (199, 199, 199),
(188, 189, 34), (219, 219, 141), (23, 190, 207), (158, 218, 229)]
# Tableau Color Blind 10
tableau20blind = [(0, 107, 164), (255, 128, 14), (171, 171, 171), (89, 89, 89),
(95, 158, 209), (200, 82, 0), (137, 137, 137), (163, 200, 236),
@AndiH
AndiH / ana.C
Last active August 29, 2015 14:14
Fitter Precharaterization
// ***
// Needed for ntuple: how good is the fit of the current d meson. is it the best fit of all the reconstructed d mesons of the current event? or is there a d meson candidate with a better fit.
// 1 - of all candidates, this is the best-fitting candidate
// 2 - of all candidates, there's one better fitting candidate; this is the 2nd best...
// ..
// nCand - this is the worst fitting candidate of all candidates
//
// negative number: same scheme as before, but the chi2 probability cut (> 0.01) is not passed
// ***
std::map<double, int> vtx_chi2ForIndex;

Keybase proof

I hereby claim:

  • I am andih on github.
  • I am andih (https://keybase.io/andih) on keybase.
  • I have a public key whose fingerprint is 646C 9C05 B676 1FC6 1D30 3B25 BF0F 31D7 2D3C DA3E

To claim this, I am signing this object:

@AndiH
AndiH / README.md
Last active August 29, 2015 14:06
Graph generation for a bunch of pictures

Here are Python scripts to generate and analyze and print data of a bunch of pictures. I made them for our scout campsite, at which we generated 1700 pictures with five photographers in the summer of 2014.

You find a write-up in German here: http://static.andreasherten.de/2014/09/06/campsite-pictures.html

The scripts are a bit messy. I'm sorry for that.

Files

  • picStats.py gathers information and saves them into a JSON file
  • createPictureGraphs.py reads in this information, does some resorting and stuff, and uses pyplot (with prettyplotlib) to display them
  • compareYears.py looks at three different JSON files of three different years and display some graph.