Skip to content

Instantly share code, notes, and snippets.

View ruslander's full-sized avatar

Ruslan Rusu ruslander

View GitHub Profile
@ruslander
ruslander / refactor.sh
Last active December 13, 2015 18:48
Renaming Erlang projects in nix shell
rename 's/^static_world/web/' static_world*
osx
find . -type f -print0 | xargs -0 sed -i '' -e 's/static_world/web/g'
@ruslander
ruslander / gist:5013846
Created February 22, 2013 14:36
insert/find/delete with Ets
-module(sc_store).
-export([
init/0,
insert/2,
delete/1,
lookup/1
]).
-define(TABLE_ID, ?MODULE).
@ruslander
ruslander / gist:5188133
Last active December 15, 2015 02:38
Price time matching
http://ejrh.wordpress.com/2011/04/21/price-time-matching-engine/
http://www.quantcup.org/home/spec
https://gist.github.com/Jud/2855852
Fix message viewer
http://fixparser.targetcompid.com/
http://eprystupa.wordpress.com/2012/12/25/matching-engine-with-scala-and-cucumber-crossing-limit-orders/
http://eprystupa.wordpress.com/2012/12/23/prototyping-a-matching-engine-with-scala-and-cucumber/
/*****************************************************************************
* QuantCup 1: Price-Time Matching Engine
*
* Submitted by: voyager
*
* Design Overview:
* In this implementation, the limit order book is represented using
* a flat linear array (pricePoints), indexed by the numeric price value.
* Each entry in this array corresponds to a specific price point and holds
* an instance of struct pricePoint. This data structure maintains a list
@ruslander
ruslander / om.erl
Last active December 21, 2015 13:19
play with records
% definition
1>rd(om, {nume, gen, virsta}).
om
% new instance
2> I = #om{nume=ru, gen=f, virsta=12}.
#om{nume = ru,gen = f,virsta = 12}
% new from template
3> P = I#om{nume=go}.
@ruslander
ruslander / mailgun.erl
Last active August 24, 2016 20:14
Update the api key to reflect your account
%curl -s --user 'api:key-8av0ox9abrs2icvagny' \
% https://api.mailgun.net/v2/bang.mailgun.org/messages \
% -F from='Excited User <[email protected]>' \
% -F [email protected] \
% -F subject='Hello' \
% -F text='Testing some Mailgun awesomness!'
-module(mailgun).
-compile(export_all).
@ruslander
ruslander / gist:dc5b9fe265b2f7da6530
Created August 7, 2014 20:17
nsb.acceptance.testing.cs
[TestFixture]
public abstract class Given_a_clean_environment
{
[SetUp]
public void Setup()
{
Init();
Given();
When();
}
@ruslander
ruslander / program.cs
Created March 10, 2015 22:03
Dynamic discovery
class Program
{
private static readonly NetMQContext Context = NetMQContext.Create();
static void Main(string[] args)
{
Task.Factory.StartNew(() =>
{
using (var responder = Context.CreateResponseSocket())
{
@ruslander
ruslander / program.cs
Created March 11, 2015 15:24
Dynamic discovery by cluster key
class Program
{
private static readonly NetMQContext Context = NetMQContext.Create();
static void Main(string[] args)
{
Task.Factory.StartNew(() =>
{
using (var cluster_A_Node1 = Context.CreateResponseSocket())
{
@ruslander
ruslander / main.cs
Last active August 29, 2015 14:16
Polymorphic dispatch
class Program
{
static void Main(string[] args)
{
var p1 = new ChatServerProcess();
p1.When(new NewMessage(){Text = "Hello"});
p1.When(new NewMessage(){Text = "World"});
var p2= new ChatServerProcess();
p2.HydrateState(p1.HandOffState());