Skip to content

Instantly share code, notes, and snippets.

View voronoipotato's full-sized avatar

Alan Ball voronoipotato

  • NC
View GitHub Profile
@voronoipotato
voronoipotato / EventStoreConnectionExtensions.cs
Created April 24, 2017 17:46 — forked from jen20/EventStoreConnectionExtensions.cs
Quick and dirty way to hook up RX to an Event Store subscription. Emphasis on "quick" and "dirty".
static class EventStoreConnectionExtensions
{
public static Task<EventStoreRxSubscription> SubscribeToAll(this EventStoreConnection connection, bool resolveLinkTos)
{
return Task<EventStoreRxSubscription>.Factory.StartNew(() => {
var subject = new Subject<ResolvedEvent>();
var subscriptionTask = connection.SubscribeToAll(resolveLinkTos, subject.OnNext, () => subject.OnError(new SubscriptionDroppedException()));
subscriptionTask.Wait();
public class PaperTimer : IDisposable
{
private readonly Stopwatch _stopwatch;
private readonly Action<Stopwatch> _action;
public PaperTimer(Action<Stopwatch> action = null)
{
_action = action ?? (s => Console.WriteLine(s.ElapsedMilliseconds));
_stopwatch = new Stopwatch();
_stopwatch.Start();
}
/*
let rec gcd a b =
match a, b with
| _ , 0 -> a
| _ , _ -> gcd b (a%b)
let lcm a b = a * b / (gcd a b)
*/
var arr = [1,2,3,4,5]

Keybase proof

I hereby claim:

  • I am voronoipotato on github.
  • I am voronoipotato (https://keybase.io/voronoipotato) on keybase.
  • I have a public key whose fingerprint is 72C6 923A FED0 D885 683D 68E1 47D4 E22D 1A1C F9F8

To claim this, I am signing this object:

// Place your settings in this file to overwrite the default settings
{
"editor.fontFamily": "pragmatapro",
"editor.fontSize": 15,
"editor.fontLigatures": true,
"indentRainbow.colors": [
"rgba(180,237,210,.5)",
"rgba(160,207,211,.5)",
"rgba(141,148,186,.5)",
"rgba(154,122,160,.5)",
@voronoipotato
voronoipotato / introrx.md
Created August 18, 2016 14:31 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@voronoipotato
voronoipotato / latency.txt
Created February 16, 2016 21:22 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@voronoipotato
voronoipotato / tmux-cheatsheet.markdown
Created January 14, 2016 16:19 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
""" Pathogen Settings
filetype off
call pathogen#infect()
syntax on
filetype plugin indent on
""" End Pathogen Settings
""" Airline Settings
set laststatus=2 " statusline appears even without page split
""" End Airline Settings

Keybase proof

I hereby claim:

  • I am voronoipotato on github.
  • I am voronoipotato (https://keybase.io/voronoipotato) on keybase.
  • I have a public key whose fingerprint is B07E 9524 F29A EBE1 2295 733B DBB5 64B4 2721 C45E

To claim this, I am signing this object: