Skip to content

Instantly share code, notes, and snippets.

View mazurov's full-sized avatar

Alexander Mazurov mazurov

View GitHub Profile
@mazurov
mazurov / webcam.sh
Created January 8, 2014 19:35
Record from webcam
vlc -vvv v4l2:///dev/video1 :input-slave="alsa://hw:2,0" :sout='#transcode{vcodec=VP80,vb=2000,scale=0,acodec=vorb,ab=128,channels=2,samplerate=44100}:file{dst=/home/amazurov/Videos/test.webm}' :sout-keep
@mazurov
mazurov / colorize.sh
Last active December 28, 2015 16:39
#!/bin/sh
enscript --pretty-print -C -f "Courier8" -F "Courier9" --color TrigT1CaloMonitoring/share/TrigT1CaloMonitoring_forRecExCommission_Run2.py -p -|psnup -m 43 -l -b1 -4 -d | ps2pdf - output.pdf
enscript -r --pretty-print -C -f "Courier8" -F "Courier9" --color TrigT1CaloMonitoring/share/TrigT1CaloMonitoring_forRecExCommission_Run2.py -p -|psnup -l -b1 -4 -d | ps2pdf - output.pdf
enscript --pretty-print -C -f "Courier12" -F "Courier14" -MA4 --color Rearrange.cpp Parity* -p -|psnup -6 -pa4 -d |ps2pdf - output.pdf
#enscript --pretty-print -C -j -f "Courier12" -F "Courier14" -MA4 --color *.js -p -|psnup -4 -pa4 -m2cm |ps2pdf - output.pdf
"""
Helper module for displaying ROOT canvases in ipython notebooks
Usage example:
# Save this file as rootnotes.py to your working directory.
import rootnotes
c1 = rootnotes.default_canvas()
fun1 = TF1( 'fun1', 'abs(sin(x)/x)', 0, 10)
c1.SetGridx()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mazurov
mazurov / iROOT.py
Created August 1, 2013 19:08
First prototype
import sys
sys.argv.append("-b") # Enable batch mode
import ROOT
import tempfile
from IPython.core import display
def display_canvas(canvas):
file = tempfile.NamedTemporaryFile(suffix=".png")
canvas.SaveAs(file.name)
@mazurov
mazurov / chib.py
Last active December 18, 2015 21:09
Double CrystalBall
import ROOT
# from AnalysisPython.PyRoUts import hID, cpp, VE
# from lib import utils
from lib import pdg
from lib.model import AbstractModel
from IPython import embed as shell # noqa
from AnalysisPython.PyRoUts import cpp
@mazurov
mazurov / Shell.sh
Last active December 17, 2015 08:59
LbLogin -c "x86_64-slc5-gcc46-opt"
for i in `seq 65`; do xrdcp xroot://castorlhcb.cern.ch//castor/cern.ch/user/a/amazurov/ganga/MC11a/b1/${i}_chib_tuples.root . ; done
files=`find -name "chib_tuples.root"|grep -e 104 -e 105 -e 106 -e 107 -e 108 -e 109`
grep "SUCCESS [0-9]* events processed" $(find -name stdout)| awk '{count += $3} END {print count}'
@mazurov
mazurov / nextNode.js
Created April 30, 2013 12:38
Traverse all nodes in DOM
var nextS = function(node) {
if (node == null) return null;
if (node.nextSibling == null) return nextS(node.parentNode);
return node.nextSibling;
}
var nextNode = function(node) {
if (node.childNodes.length == 0) {
return nextS(node);
}
return node.childNodes[0];
@mazurov
mazurov / Moore_TCK.py
Created March 22, 2013 11:44
Example of Moore job
#!/usr/bin/env gaudirun.py
#
# SetupProject Moore v14r11
#
import Gaudi.Configuration
from Configurables import Moore
from LHCbKernel.Configuration import *
from Gaudi.Configuration import *
@mazurov
mazurov / Upsilon472.opts
Created December 7, 2012 10:33
chi_b decay files
Generation.PileUpTool = "FixedLuminosityForRareProcess";
#include "$DECFILESROOT/options/SwitchOffAllPythiaProcesses.opts"
Generation.Special.PythiaProduction.Commands +=
{"pysubs msel 0" ,
"pysubs msub 461 1" ,
"pysubs msub 462 1" ,
"pysubs msub 463 1" ,
"pysubs msub 464 1" ,
"pysubs msub 465 1" ,
"pysubs msub 466 1" ,