Skip to content

Instantly share code, notes, and snippets.

View rofr's full-sized avatar

Robert Friberg rofr

View GitHub Profile
@rofr
rofr / xsockets-origodb.cs
Created August 30, 2015 09:10
OrigoDB persistence plugin for XSockets
//Found this on pastebin at http://pastebin.com/zkS4Wszb
// See comments below
/// <summary>
/// Key/Value pairs where key is string and value is object
/// </summary>
public interface IStorageModel
{
object AddOrUpdate(string key, object entity);
bool Remove(string key);
@rofr
rofr / 0. Output.txt
Last active January 5, 2017 11:30
OrigoDB simplified - complete engine in 50 lines of code. 2000 writes per second, 3 million reads
Num threads: 10
Start: 2015-08-20 01:42:10
Reads: 133758452
Writes: 66050
Reads/s: 4458615,06666667
Writes/s: 2201,66666666667
Total: 133824502
TPS: 4460816,73333333
Stop time: 2015-08-20 01:42:50
@rofr
rofr / command line
Created August 18, 2015 07:54
I love perl
$ perl text-lint.pl text-input.txt
line 1 violates rule \bhaz\b
my dog haz fleas
line 2 violates rule \bhaz\b
can I haz code, please?
line 3 violates rule \bibm\b
ibm is a big company
@rofr
rofr / Isolation.cs
Last active August 29, 2015 14:27
Smurf naming?
[Flags]
public enum Isolation
{
Unknown = 0,
Input = 1,
Output = 2,
InputOutput = 3
}
@rofr
rofr / FlightModel.cs
Created August 8, 2015 17:53
OrigoDB GeoSpatial and GraphModel using QuickGraph (quickgraph.codeplex.com)
[Serializable]
public class FlightModel : Model
{
[NonSerialized]
private AdjacencyGraph<string, Leg> _airports;
private readonly GeoSpatialIndex<string> _locations
= new GeoSpatialIndex<string>();
@rofr
rofr / MessageBroker.cs
Last active August 29, 2015 14:25
Message broker built with OrigoDB
using System;
using System.Collections.Generic;
using System.Linq;
namespace OrigoDB.Core.Models
{
/// <summary>
/// Message broker supporting any number of queues (competing consumers)
/// or topics (multiple subscribers)
@rofr
rofr / code.cs
Created July 17, 2015 20:27
Spiking Relational for OrigoDB
/* */
using System;
using System.Collections.Generic;
using System.Linq;
namespace OrigoDB.Core.Models
{
/// <summary>
/// Entities must implement this interface
internal static Boolean HasRefArg(MethodInfo methodInfo)
{
const string pattern = " ByRef[,)]";
return Regex.IsMatch(methodInfo.ToString(), pattern);
}
create table Demo (
Number int not null primary key
)
go
create proc wtf as
begin tran
insert demo values(1)
insert demo values(1)
commit tran
C:\Users\rofr>@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex
((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/s
criptcs-contrib/svm/master/install/installer.ps1'))" && SET PATH=%HOME%\.svm\bin
\;%HOME%\.svm\shims\;%PATH%
scriptcs version manager - installer
Cannot find an overload for "Combine" and the argument count: "3".
At line:127 char:42
+ $downloadPath = [System.IO.Path]::Combine <<<< ($env:TEMP, [Guid]::NewGuid(),