Skip to content

Instantly share code, notes, and snippets.

@atheriel
atheriel / ralloc.bt
Last active April 6, 2020 12:09
Trace allocations of R vectors using bpftrace
#!/usr/bin/env bpftrace
/*
* ralloc - Print allocations of R vectors.
*
* Copyright 2020 Aaron Jacobs
* Licensed under the MIT License or the Apache License, version 2.0.
*/
BEGIN
{
year Mining, Quarrying, and Oil & Gas Extraction Public Administration Manufacturing Utilities Real Estate and Leasing Transportation and Warehousing Information, Culture and Recreation Other Industries
2006 48.1 21.8 17.1 15.0 14.4 11.9 8.5 37.0
2007 50.0 25.6 17.6 17.2 13.6 14.5 7.5 39.9
2008 54.9 30.2 17.2 18.7 13.9 16.8 9.0 44.0
2009 35.2 31.7 12.0 22.0 12.2 15.1 8.6 44.4
2010 53.7 36.0 13.4 22.1 11.6 13.0 9.4 46.6
2011 67.7 33.4 15.3 24.3 9.7 14.7 8.7 48.5
2012 78.3 31.7 15.2 26.0 9.2 18.2 8.3 49.2
2013 83.9 29.8 15.8 29.6 10.0 24.4 9.6 49.9
2014 83.4 31.3 17.1 31.6 11.1 23.2 11.3 52.0
year Patented Medicines (Notice of Compliance) Patent Infringement Other
2001 5 0 5
2002 16 5 3
2003 28 2 0
2004 27 0 3
2005 29 0 2
2006 38 3 3
2007 41 3 2
2008 43 9 7
2009 40 7 5
@atheriel
atheriel / macroexpand.c
Last active January 20, 2018 07:58
Can one write a Python extension in Rust?
PyObject * RustPy_InitModule(const char *name, PyMethodDef *methods, const char *doc) {
// return Py_InitModule4(name, methods, doc, (PyObject *) NULL, PYTHON_API_VERSION);
return Py_InitModule3(name, methods, doc);
}
@atheriel
atheriel / newpost.py
Created February 12, 2014 23:09
A simple program for generating new posts and pages for Pelican.
#!/usr/bin/env python
__doc__ = '''
Create a new post/page.
Usage:
newpost.py <title> [--page] [-t <tag>...]
newpost.py -h | --help | --version
Options: