Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Threading;
namespace SearchBench {
@abdullin
abdullin / fdb-flow.md
Created August 12, 2016 14:47 — forked from Preetam/fdb-flow.md
FoundationDB Flow

Flow: Actor-based Concurrency with C++

Engineering challenges

FoundationDB began with ambitious goals for both high performance per node and scalability. We knew that to achieve these goals we would face serious engineering challenges while developing the FoundationDB core. We'd need to implement efficient asynchronous communicating processes of the sort supported by Erlang or the Async library in .NET, but we'd also need the raw speed and I/O efficiency of C++. Finally, we'd need to perform extensive simulation to engineer for reliability and fault tolerance on large clusters.

To meet these challenges, we developed several new tools, the first of which is Flow, a new programming language that brings actor-based concurrency to C++11. To add this capability

@abdullin
abdullin / Program.cs
Created October 6, 2011 18:27
Wiring Lokad-CodeDSL in a MightyMoose style.
// This is a hacky sample (that works for me) of alternative way to use Lokad-codeDSL
// or any similar way of generating message contracts on-the-fly. Original approach was
// with using T4 template, that would rebuild cs files from DSL representation, whenever
// we hit Ctrl-S.
// This approach works almost exactly like this (Ctrl-S to rebuild), but does not require VS
// to run or does not require unloading VS to change the underlying generator code.
// in fact it is extremely boring. Lolcats from MightyMoose could be used to improve the situation, though.
// any takers? :)
@abdullin
abdullin / RedirectToWhen.cs
Created June 26, 2011 08:59
Static helper class for invoking handling methods on AR and AR state.
// snippet is for http://abdullin.com/journal/2011/6/26/event-sourcing-a-la-lokad.html
// simple helper, that looks up and calls the proper overload of
// When(SpecificEventType event). Reflection information is cached statically
// once per type.
public static class RedirectToWhen
{
static class Cache<T>
{
public static readonly IDictionary<Type, MethodInfo> Dict = typeof(T)
// Bookmarklet for making Houzz useful
javascript:$("img.viewImage, img.currentImage, img.space, img[id^=galleryImg], img[class^=browseListImage], .gallery-photo img").each(function() { var newSrc = this.src.replace(/[fs]images\/(\d+).*/, 'simages/$1_0_9-.jpg').replace(/_\d-/,'_16-'); $(this).parents("div.browseListBody").before("<a href='"+newSrc+"'><img src='"+newSrc+"' width=400></a>") });$("div.content-row").remove();
@abdullin
abdullin / reader.clj
Created January 26, 2016 20:02
Sample clojure code for searching log entries stored in chunks in custom binary format on Windows Azure
(ns azurelog.reader
(:require [clj-time.core :as t]
[clj-time.format :as f]
[clojure.java.io :as io])
(:import [com.microsoft.azure.storage CloudStorageAccount]
[java.nio ByteOrder ByteBuffer]
[com.microsoft.azure.storage.blob]
[java.util.zip GZIPInputStream]
[org.apache.commons.io.input BoundedInputStream]))
@abdullin
abdullin / FizzBuzz.hs
Created December 23, 2013 10:03
In search of perfection
m n p v|mod v n==0=p|True=[]
p n|null w=show n|True=w where w=(m 3"Fizz"n)++(m 5"Buzz"n)
f=map p[1..100]
@abdullin
abdullin / main.go
Created December 16, 2013 08:51
Sample web server written in Go with Tom Janssens. Nobody had any real experience in go :)
package main
import (
"fmt"
"net/http"
)
var queue chan string
var joblist []string
@abdullin
abdullin / StartupProjectionHost.cs
Last active December 30, 2015 21:09
Projection replayer for Lokad.CQRS projects (legacy)
#region Copyright (c) 2006-2013 LOKAD SAS. All rights reserved
// This document is shared under BSD license
#endregion
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
@abdullin
abdullin / AzureLogSink.cs
Created October 16, 2013 06:30
Simple azure log that persists sliding log buffer in Azure blobs.
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;
namespace Lokad
{
// Simple azure log that persists sliding log buffer in Azure blobs.