Skip to content

Instantly share code, notes, and snippets.

View kofemann's full-sized avatar
Working on the next great thing....

Tiramisu Mokka kofemann

Working on the next great thing....
View GitHub Profile
@kofemann
kofemann / dcache-billing-demo.json
Last active August 29, 2015 14:01
dCache-billing-demo
{
"title": "Billing",
"services": {
"query": {
"list": {
"0": {
"query": "proto:gftp",
"alias": "GridFTP",
"color": "#7EB26D",
"id": 0,
@kofemann
kofemann / avg.awk
Last active August 29, 2015 14:01
Calculating Running Average with AWK
BEGIN {
avg = 0.0
sigma = 0.0
}
{
v = $1
avg = (avg*(NR - 1) + v) / NR
sigma = (sigma*(NR - 1) + v*v) / NR
}
@kofemann
kofemann / perfect-desktop-with-sl6.md
Last active August 29, 2015 14:03
Perfect (or so) Desktop with SL 6.5 (CentOS 6.5)

Perfect (or so) Desktop with SL (CentOS) 6.5

Install from Live CD

Post-install:

Disable unneeded services:

@kofemann
kofemann / 00-Pentax-k50.lrtemplate
Created August 17, 2014 19:46
Lightroot import preset for Pentax-K50
s = {
id = "9B3C1961-C7B7-4C03-AD92-D4AE6440655B",
internalName = "00-Pentax-k50",
title = "00-Pentax-k50",
type = "Develop",
value = {
settings = {
AutoLateralCA = 1,
ChromaticAberrationB = 0,
ChromaticAberrationR = 0,
@kofemann
kofemann / Bitmap.java
Created October 9, 2014 08:44
A vector of bits backended with a byte array.
import java.util.Arrays;
public class Bitmap {
private final byte[] _bitmap;
public Bitmap(int size) {
_bitmap = new byte[size];
}
@kofemann
kofemann / dcap-vs-nfs.gp
Last active August 29, 2015 14:10
sript to plot cms job efficiency
set key off
set yrange [0:1]
set xrange [:24]
set ylabel "Efficiency (cpu/wall time)"
set xlabel "execution time (hour)"
set xtics rotate
#set xdata time
set multiplot layout 1,2 rowsfirst title "CMS job efficiency by access protocol"
stats 'w07' using 3 nooutput
@kofemann
kofemann / mkfile.py
Created January 12, 2012 14:41
mkfile utility, like on Solaris.
#!/usr/bin/env python
"""
A small utility to create a file of specified size:
$ mkfile 100g
"""
import sys
import time
import os
@kofemann
kofemann / hexdump.py
Created April 4, 2012 15:45
A program which dumps the content of a file in HEX format
#!/usr/bin/env python
# hexdump.py
'''A program which dumps the content of a file in HEX format like:
$ ./hexdump.py hexdump.py
00000 23 21 2f 75 73 72 2f 62 69 6e 2f 65 6e 76 20 70 ...usr.bin.env.p
00010 79 74 68 6f 6e 0a 0a 69 6d 70 6f 72 74 20 6d 6d ython..import.mm
00020 61 70 0a 69 6d 70 6f 72 74 20 63 6f 6e 74 65 78 ap.import.contex
00030 74 6c 69 62 0a 69 6d 70 6f 72 74 20 73 79 73 0a tlib.import.sys.
@kofemann
kofemann / xsu.sh
Created August 16, 2012 07:37
execute command as a defiend user with X forwarding
#!/bin/sh
#
# execute command as a defiend user with X forwarding
# Example:
# xsu auser gedit /some/text/file
#
if [ $# -lt 2 ]
then
echo "Usage: xsu <user> <command> [args....]"
@kofemann
kofemann / jumbo-proxy.sh
Created November 27, 2012 20:06
scrip to produce jumbo grid proxies
#!/bin/sh
N=30
ID=`id -u`
PROXY_FILE=/tmp/x509up_u${ID}
STD_OPTS="-q -rfc --voms desy"
# gen initial proxy
voms-proxy-init ${STD_OPTS}