Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Security.Cryptography;
using System.Text;
namespace Logos.Utility
{
/// <summary>
/// Helper methods for working with <see cref="Guid"/>.
/// </summary>
public static class GuidUtility
@dlidstrom
dlidstrom / Projections.cs
Created December 6, 2013 12:44
Create projections from C#.
private static void Main(string[] args)
{
var projectionsManager = new ProjectionsManager(new ConsoleLogger(), new IPEndPoint(IPAddress.Loopback, 1113));
const string projStr =
"fromCategory('12-testentity').foreachStream().whenAny(function(s, e) { linkTo('test-12', e) })";
var credentials = new UserCredentials("admin", "changeit");
projectionsManager.CreateContinuous("$test-12", projStr, credentials);
projectionsManager.Enable("$test-12", credentials);
@dlidstrom
dlidstrom / gist:7153002
Created October 25, 2013 11:07
MiniNode setup
netsh http add urlacl url=http://+:8084/ user=ad-username
netsh http add urlacl url=http://127.0.0.1:8083/ user=ad-username
@dlidstrom
dlidstrom / commandBuffer-es6.js
Last active January 16, 2017 08:03
Command buffer service for AngularJS used to manage asynchronous calls in a synchronized fashion.
/**
* This service is used to serialize asynchronous events.
* It uses a buffering solution: http://ricostacruz.com/backbone-patterns/animation-buffer.html
* To use it, put your asynchronous actions (animations/ajax) inside an anonymous function
* to be passed into add().
* Be sure to trigger next() when done.
*
* Example:
* commandBuffer.add(next => {
* somePromise.done(next);
@dlidstrom
dlidstrom / RavenIndexTest_working.cs
Created October 13, 2011 15:10
Raven indexing test (working)
namespace RavenIndexTest
{
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition.Hosting;
using System.Linq;
using Newtonsoft.Json;
using Raven.Client.Embedded;
using Raven.Client.Indexes;
@dlidstrom
dlidstrom / RavenIndexTest.cs
Created October 13, 2011 14:39
Raven indexing test
namespace RavenIndexTest
{
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition.Hosting;
using System.Linq;
using System.Threading;
using Newtonsoft.Json;
using Raven.Client.Embedded;
using Raven.Client.Indexes;

GridBook, Large Scale Othello

Introduction

This is a project where I am intending to do a large-scale distributed calculation of an opening book for the board game Othello. Positions are stored in a relational database (I have chosen PostgreSQL) using NHibernate object/relational mapper.

The project is still in its infancy, but the goal is to use Edax, a very good Othello engine, to calculate new positions. I am also intending to use a service bus, probably

@dlidstrom
dlidstrom / NLog.config
Created January 19, 2011 12:57
How to configure Castle Windsor with logging.
<?xml version="1.0" encoding="utf-8" ?>
<!--
This file needs to be put in the application directory. Make sure to set
'Copy to Output Directory' option in Visual Studio.
-->
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target xsi:type="Console" name="console" layout="${message}" />
<target xsi:type="ColoredConsole" name="console-detailed" layout="${longdate} ${logger} ${level:upperCase=true}: ${message}${newline}(${stacktrace}) ${exception:format=ToString}" />
@dlidstrom
dlidstrom / Specification.cs
Created January 15, 2011 11:00
Specification design pattern
using System;
using System.Linq;
using System.Linq.Expressions;
using Infrastructure.Data.Extensions;
namespace Infrastructure.Data.Specification
{
public class Specification<TEntity> : ISpecification<TEntity>
{
public Specification(Expression<Func<TEntity, bool>> predicate)