Skip to content

Instantly share code, notes, and snippets.

View bmwiedemann's full-sized avatar

Bernhard M. Wiedemann bmwiedemann

View GitHub Profile
What is not in git will be bitrotten
What is not tested will not work
What's done by hand will be forgotten
Since bugs in every corner lurk.
/* gcc -O1 -o benchreg benchreg.c
./benchreg 100000
* find out how many CPU clock cycles are used
* for a certain number of loop iterations (default: 1 million)
* to reveal specre-related slowdowns ; see also rdmsr 0x48
*/
#include <stdio.h>
static __inline__ unsigned long long rdtsc(void)
#!/bin/sh -x
# run as pycbench.sh 2>&1 | tee /tmp/pycbenchlog
t=/dev/shm/tmp
rm -rf $t ; mkdir $t ; cd $t
find /usr/lib*/python2.7/ -name \*.py -print0 | xargs -0 -iarg cp -a arg .
rm -f py3_test_grammar.py
du -s
find -name \*.py -print0 | xargs -0 cat | wc -
time find -name \*.py -print0 | xargs -0 python -m py_compile
find -name \*.py -print0 | xargs -0 rm
@bmwiedemann
bmwiedemann / keybase.md
Created October 24, 2014 10:49
keybase public proof

Keybase proof

I hereby claim:

  • I am bmwiedemann on github.
  • I am bmwiedemann (https://keybase.io/bmwiedemann) on keybase.
  • I have a public key whose fingerprint is 64E0 ABD0 12D7 C6DF 6347 A6B5 4936 0B3B 1DFB A164

To claim this, I am signing this object:

@bmwiedemann
bmwiedemann / gist:1970670
Created March 4, 2012 04:29
JSON transformer
#!/usr/bin/perl -w
use strict;
# zypper -n in perl-JSON-XS
use JSON::XS;
my $input = decode_json(`cat in.json`);
my $output = {};
my $unpacked = $input->{unpacked};
foreach my $path (keys(%$unpacked)) {