Skip to content

Instantly share code, notes, and snippets.

View ayende's full-sized avatar

Ayende Rahien ayende

View GitHub Profile
static void GenerateMatch(string key, ref string prefix)
{
var orig = GetShardId(key);
var tries = 0;
var sb = new StringBuilder(prefix).Append("-");
while (true)
{
for (int i = 0; i < 25; i++)
{
tries++;
static ushort GetShardId(string key)
{
using var md5 = MD5.Create();
{
var hash = md5.ComputeHash(Encoding.UTF8.GetBytes(key));
return BitConverter.ToUInt16(hash, 14);
}
}
static ushort GetShardId(string key)
{
using var md5 = MD5.Create();
{
var hash = md5.ComputeHash(Encoding.UTF8.GetBytes(key));
var integer = BigInteger.Abs(new BigInteger(hash));
return (ushort)(integer % ushort.MaxValue);
}
}
service.pwd = swordfish
# or
service.pwd.file = ../config/prod/service.password
# or
service.pwd.dpapi = FFD1C0A03C6087C65EB47CE669B0C95D0C63202A53F834A8
discover.assembly = MyApp
discover.namespace = MyApp.Services
discover.interface = required
serviceAssemblies = ( Assembly.Load("MyApp"), )
for asm in serviceAssemblies:
for type in asm.GetTypes():
continue unless type.NameSpace == "MyApp.Services"
continue if type.IsInterface or type.IsAbstract or type.GetInterfaces().Length == 0
Component(type.FullName, type.GetInterfaces()[0], type)
Log.Level = Error
Log.Archive = 1
Status.Port = 6090
Status.RefreshRate = 10
float a = 0.281642526f;
float b = 0.844927669f;
float c = a + a + b;
float d = a + b + a;
public class GetIdeas_Index: AbstractMultiMapIndexCreationTask<GetIdeas_Index.Result>
{
public class Result
{
public int TenantId { get; set; }
public int ApplicationId { get; set; }
public Guid IdeaId { get; set; }
public string IdeaTitle { get; set; }
public string CultureTag { get; set; }
public int StateId { get; set; }
var parliment = new Dictionary<string, (int Seats, int Index)>
{
["Likud"] = (36, 0),
["KahulLaval"] = (33, 1),
["JointList"] = (15, 2),
["Shas"] = (9, 3),
["YahadutHatora"] = (7, 4),
["IsrealBeitenu"] = (7, 5),
["AvodaGesherMeretz"] = (7, 6),
["Yemina"] = (6,7)