Skip to content

Instantly share code, notes, and snippets.

$ cargo install perfcnt
gives this when building raw-cpuid crate:
error[E0554]: #![feature] may not be used on the stable release channel
--> /home/sean/.cargo/registry/src/github.com-1ecc6299db9ec823/raw-cpuid-2.0.2/src/lib.rs:1:1
|
1 | #![feature(prelude_import, asm)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@chisophugis
chisophugis / reproducer.py
Created February 26, 2015 23:31
Minimal test case for lit lockup on Mac.
import _multiprocessing
import multiprocessing
q = multiprocessing.Queue()
COUNT = 2**15 - 1
if COUNT > _multiprocessing.SemLock.SEM_VALUE_MAX:
print('It is going to lock up')
else:
@chisophugis
chisophugis / options.py
Created August 21, 2014 19:55
Command line options as JSON
#!/usr/bin/env python
#
# A prototype for consistently handling command line options by
# interpreting them as a JSON object, following a schema.
# The result of command line option parsing is a "JSON object" which is
# can be passed around and manipulated as desired.
#
# Example:
# $ ./options.py --vectorizer-loop-enable=true --inliner-enable=true --inliner-threshold=6
# {
@chisophugis
chisophugis / bracedexpand.py
Created July 7, 2014 22:45
Braced shell expansion
import itertools
import re
import sys
try:
INPUT = sys.argv[1]
except:
print('Usage: {} <string-to-expand>'.format(sys.argv[0]), file=sys.stderr)
sys.exit(1)
@chisophugis
chisophugis / main.c
Created August 18, 2012 01:09
uddt_fasttrap_sprint
//usr/bin/true && clang $0 && exec ./a.out
//usr/bin/true && exit 1
/* This program demonstrates how to dynamically create DTrace probes with
* fasttrap. It currently works on Mac x86(_64) but can be easily adapted
* to other platforms.
*
* Quickstart:
* To see it work, just execute it (that magic at the top will compile and
* run it). It will dynamically create a probe and print its probe