Skip to content

Instantly share code, notes, and snippets.

View brodo's full-sized avatar

Julian Dax brodo

View GitHub Profile
@brodo
brodo / gist:5637455
Last active December 17, 2015 16:19
public static Action<IMaybe<TA>> LiftToMaybe<TA>(this Action<TA> func) where TA : class
{
return param =>
{
var justparam = param as Just<TA>;
if (justparam == null || justparam.Value == null) return;
func(justparam.Value);
};
}
@brodo
brodo / sniffFileAccess
Created March 10, 2013 23:17
D program to sniff all access to a file.
#! /usr/sbin/dtrace -s
#pragma D option quiet
dtrace:::BEGIN
{
self->start = 0;
}
syscall::write:entry,
syscall::write_nocancel:entry,
@brodo
brodo / serialsniffer.rb
Last active February 11, 2025 17:10
Serialsniffer for Mac OS X: Sniffs an OPEN serial connection. The connection must be open before you run the script.
#!/usr/bin/env ruby
# Sniffs a serial Connection. Prints all unprintable characters!
# Only tested under Mac OS X 10.8. (should work with earlier versions)
# Uses dtruss, which comes with Mac OS.
#
# Usage:
# $ ./serialsniffer.rb <serial device>
#
# Example: