This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Generate a LaTeX longtable automatically spanning on multiple pages with images proportionally | |
scaled appropriately. Adds a scale ruler too. Image names must have a certain format. | |
""" | |
from __future__ import print_function | |
import sys | |
import os.path | |
import re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from __future__ import print_function | |
def disaster_function(a_default=[]): | |
# BEWARE: the next line, if a_default is not provided, modifies the default | |
# object, and **not a copy** of the default object! This is because you are | |
# modifying in place a "name" pointing to the default, by effectively changing | |
# the default value for all future function calls | |
a_default.append("a string") | |
print("disaster_function(): %s" % a_default) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Will print: | |
# init method | |
# decorator here | |
# called with a message | |
# 12345 | |
# modern decorator here with decorator with a message | |
# yabba with another message | |
# 54321 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from time import sleep | |
ncpus = sum([ 1 for x in open("/proc/cpuinfo").read().split("\n") if "bogomips" in x ]) | |
def getup(): | |
tot,idle = open("/proc/uptime").read().split(" ") | |
return float(tot)*ncpus,float(idle) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Usage: | |
# cvm-context-api.py [--user-data] <context_id> [<context_key>] | |
import sys | |
import requests | |
import base64 | |
import hashlib | |
from Crypto.Cipher import AES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 2.8) | |
project(testoptargsandescape) | |
macro(testmacro testarg1 testarg2) | |
message(STATUS "testarg1 = \"${testarg1}\"") | |
message(STATUS "testarg2 = \"${testarg2}\"") | |
message(STATUS "Optional arg = \"${ARGV2}\"") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ShowRootMaps() { | |
TObjArray *oa = gInterpreter->GetRootMapFiles(); | |
TIter i(oa); | |
TObject *o; | |
TNamed *n; | |
TString s; | |
while ((o = i.Next()) != NULL) { | |
n = dynamic_cast<TNamed *>(o); | |
Printf("%-40s --> %s", n->GetName(), n->GetTitle()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Pretend that all jobs have very low memory requirements: useful | |
## when running pilot jobs (e.g. AliEn) | |
JOB_DEFAULT_REQUESTMEMORY = 42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd $(dirname "$0") | |
ucvm=$PWD/ucernvm-prod.1.18-2.cernvm.x86_64.hdd | |
[ ! -e ${ucvm}.orig ] && cp $ucvm ${ucvm}.orig | |
t=$(mktemp -d /tmp/cvm-initrd-XXXXX) | |
cd $t | |
echo starting guestfish | |
eval "`guestfish --listen`" || exit 1 | |
echo mounting fs | |
guestfish --remote add $ucvm : run : mount /dev/sda1 / || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# "Quotas" per user | |
# | |
# Our requirements contain an expression that changes at every accepted job. We | |
# cannot therefore optimize matchmaking by caching the results for a specific | |
# "requirements" string, but we will need to evaluate it per job. | |
NEGOTIATOR_MATCHLIST_CACHING = False | |
# The following two variables are set to enforce these "quotas" on setups with |
NewerOlder