Skip to content

Instantly share code, notes, and snippets.

View ayende's full-sized avatar

Ayende Rahien ayende

View GitHub Profile

1 server

~/wrk2/wrk --latency -R 250 -d 3m -c 128 -t 4 -s getAnnotationsForUser_Paged.lua http://172.31.36.34:5000 Running 3m test @ http://172.31.36.34:5000 4 threads and 128 connections Thread calibration: mean lat.: 24.660ms, rate sampling interval: 10ms Thread calibration: mean lat.: 30.325ms, rate sampling interval: 10ms Thread calibration: mean lat.: 7.590ms, rate sampling interval: 10ms Thread calibration: mean lat.: 38.346ms, rate sampling interval: 13ms Thread Stats Avg Stdev Max +/- Stdev

@ayende
ayende / index.cs
Last active August 16, 2020 09:36
AddMap<Company>(companies => from company in companies
select new
{
CompanyName = company.CompanyName,
UserCount = 0
CompanyId = company.Id
});
AddMap<User>(users => from user in users
from companyId in user.Companies
from o in docs.Orders
select new {
o.State,
o.CreatedAt
}
var user = new
{
AcceptedEula = default(bool?), // set to null, mark the field as bool?
RegisteredAt = DateTime.Today, // set to today, the field is DateTime
Name = default(string), // set to null, mark the field as string
ActiveTasks = 0, // set to 0, the field is an int
};
from e in docs.Events
select new {
Registration = default(object)
}
// map
from o in docs.Orders
from l in o.Lines
select new {
l.Product,
Related = o.Lines.Select(x=>x.Product)
.Where(x=>x!=l.Product)
.Select(x=>new { Count = 1, Product = x}),
Count = 1
}
try
{
result = await httpClient.Get("/update/status");
}
catch(HttpRequestException e)
{
// handle error
}
try
{
result = await httpClient.Get("/update/status");
}
catch(HttpRequestException e)
{
// handle error
}
HANDLE file = CreateFileW((LPCWSTR)path,
GENERIC_WRITE | GENERIC_READ,
FILE_SHARE_READ,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL
);
public class IdentifierMasking
{
private static byte[] _key;
public IdentifierMasking(byte[] key = null)
{
_key = key ?? Sodium.SecretBox.GenerateKey();
}
public string RevealIdentifier(string hidden)