This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static ushort GetShardId(string key) | |
{ | |
using var md5 = MD5.Create(); | |
{ | |
var hash = md5.ComputeHash(Encoding.UTF8.GetBytes(key)); | |
return BitConverter.ToUInt16(hash, 14); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service.pwd = swordfish | |
# or | |
service.pwd.file = ../config/prod/service.password | |
# or | |
service.pwd.dpapi = FFD1C0A03C6087C65EB47CE669B0C95D0C63202A53F834A8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
discover.assembly = MyApp | |
discover.namespace = MyApp.Services | |
discover.interface = required |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Log.Level = Error | |
Log.Archive = 1 | |
Status.Port = 6090 | |
Status.RefreshRate = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float a = 0.281642526f; | |
float b = 0.844927669f; | |
float c = a + a + b; | |
float d = a + b + a; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |