Skip to content

Instantly share code, notes, and snippets.

View bcantrill's full-sized avatar

Bryan Cantrill bcantrill

View GitHub Profile
#pragma D option nspec=100
#pragma D option flowindent
pid$target::libusb_submit_transfer:entry
{
self->spec = speculation();
}
pid$target:*libusb*::entry,
@bcantrill
bcantrill / ub.c
Created January 11, 2019 18:41
Punishment doesn't fit the crime?
#define NULL ((void *)0)
static char *arr[2] = { "nasal", "demons" };
long
func()
{
int i;
for (i = 0; i <= 2; i++) {
@bcantrill
bcantrill / uts.txt
Last active March 4, 2017 05:43
Memorial Day in uts
From bmc Sun May 26 23:33:47 2002
Subject: Memorial Day in uts
To: kernel@eng
Date: Sun, 26 May 2002 23:33:47 -0700 (PDT)
X-Mailer: ELM [version 2.4ME+ PL31H (25)]
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 1906
Status: RO
@bcantrill
bcantrill / gist:5dabd838b7f3ce0bfde8a4934a39cc0d
Last active August 20, 2016 13:19
Running DTrace on Powershell for Linux (!) running inside an LX-branded Ubuntu 14.04 zone on SmartOS
root@1eec2cd3-2cba-e416-e1b6-845b715b736c:~# dtrace -n lx-syscall:::entry'/progenyof($target)/{@[probefunc] = count()}' -c "powershell Get-Process > /dev/null"
dtrace: description 'lx-syscall:::entry' matched 676 probes
dtrace: pid 60025 has exited
arch_prctl 1
exit_group 1
getppid 1
getuid 1
mincore 1
mlock 1
11:15 Graeme - Distributed DTrace
Max - (Useful!) DTrace intro, including DTrace production golf?
12:30 George - D language improvements
Matt - D syntactic sugar
Robert - CTF everywhere!
1:30 Eric - DTracing apps
JoshC - DTrace json() subroutine
Dan - Dynamic asserts
@bcantrill
bcantrill / gist:aec10341f8819501704e
Created June 19, 2015 22:47
The day was April 27, 1999, and I'm pretty sure that sun4c was EOL'd by the time that eli finally booted...
BOOT SHOCKER! JAZZMAN KO'S ELI IN MULTIUSER UPSET!
In a sold-out Lab 3219, league veteran and 20 MHz war-horse, jazzman, defeated
the 40 MHz favorite, eli, in a PROM-to-multiuser sprint. jazzman's time of
four minutes, thirty-eight seconds soundly defeated eli's lethargic five
minutes, fifteen seconds.
While the match was at times close, jazzman only stumbled early. "jazzman
was slow bringing up interfaces; I should have caught him then, but I
@bcantrill
bcantrill / unmarshal.d
Created April 25, 2015 02:43
DTrace on Go running in an LX branded zone on Triton
#pragma D option flowindent
pid$1::encoding*json.Unmarshal:entry
{
self->in = vtimestamp;
}
pid$1::encoding*:entry,
pid$1::encoding*:return
/self->in/
@bcantrill
bcantrill / dtrace-on-rust
Last active May 29, 2023 07:37
DTrace on Rust. This shows running dtrace(1M) on a simple Rust program. Rust is running in a 64-bit LX-branded zone on SmartOS, an illumos derivative. Running stock (alpha) Rust and latest SmartOS.
root@1eec2cd3-2cba-e416-e1b6-845b715b736c:~# uname -a
Linux 1eec2cd3-2cba-e416-e1b6-845b715b736c 3.13.0 BrandZ virtual linux x86_64 x86_64 x86_64 GNU/Linux
root@1eec2cd3-2cba-e416-e1b6-845b715b736c:~# rustc -Vv
rustc 1.0.0-nightly (44a287e6e 2015-01-08 17:03:40 -0800)
binary: rustc
commit-hash: 44a287e6eb22ec3c2a687fc156813577464017f7
commit-date: 2015-01-08 17:03:40 -0800
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly
root@1eec2cd3-2cba-e416-e1b6-845b715b736c:~# cat hello.rs
@bcantrill
bcantrill / gist:8550468
Created January 21, 2014 23:14
Mail exchange with Aram Hăvărneanu on emulating edge-triggered events on event ports -- including a brilliant rant by Aram on why edge-triggered events are, in fact, a terrible idea. ;)
MIME-Version: 1.0
Sender: bryancantrill@gmail.com
Received: by 10.68.33.97 with HTTP; Sat, 21 Dec 2013 00:11:05 -0800 (PST)
In-Reply-To: <CA+0vZFK2i8aq5DUQpt7wdk=QgodKOOEFgU7vz6n1ti0di-r4hw@mail.gmail.com>
References: <CANp9fE8t68+5_oVc=k=7oQPrSCNH5pnLZ2oP9x3YG8g4a9063A@mail.gmail.com>
<CA+0vZFLRGYwysd8kO+KnazBG=vupfORTD+h1yj_dWur2f7LpPQ@mail.gmail.com>
<CA+0vZFLpu5HFhJZLmpm01WOyzHjnaeHrKcuU7YEpMr6hEvyiRA@mail.gmail.com>
<CAAm8y+jXcQ1ix5neUusW6NHXg+mb0V_ZNxrudjTaETdxhUQzKQ@mail.gmail.com>
<F811D3C5-531A-492A-B390-5086F206DD6C@cheney.net>
<CA+0vZFK2i8aq5DUQpt7wdk=QgodKOOEFgU7vz6n1ti0di-r4hw@mail.gmail.com>
@bcantrill
bcantrill / Pinto Moneyball
Created May 22, 2013 04:37
Me (pathetically) going moneyball on my 8-year-old's baseball season. This is expressing successful putouts (throws or unassisted outs for infield; caught flies for outfield) vs. opportunities. Data was compiled over a course of 12 games with GameChanger, which should be called LifeChanger if you find yourself the scorekeeper for a youth basebal…
INFIELD:
PLAYER P 1B 2B SS 3B
============ ============ ============ ============ ============ ============
Bxxxx 5/7 ( 71%) - 5/8 ( 62%) 3/9 ( 33%) 6/20 ( 30%)
Cxxxxxxx - 2/2 (100%) 2/4 ( 50%) 2/5 ( 40%) 0/3 ( 0%)
Cxxxxxxx - - 2/7 ( 29%) 1/4 ( 25%) -
Dxx - - 3/7 ( 43%) 1/1 (100%) 1/2 ( 50%)
Dxxxxxx 1/2 ( 50%) - 3/10 ( 30%) - 0/4 ( 0%)
Kxx-Cxxxxx - - 1/2 ( 50%) - -