Skip to content

Instantly share code, notes, and snippets.

View ayende's full-sized avatar

Ayende Rahien ayende

View GitHub Profile
@ayende
ayende / LetsEncryptClient.cs
Created January 11, 2018 22:26
ACME v2 client for Let's Encrypt
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <uv.h>
#define DEFAULT_PORT 7000
#define DEFAULT_BACKLOG 128
using System;
using System.Globalization;
using System.Text;
namespace HibernatingRhinos.Encoding
{
public class EmojiEncoder
{
public static byte[] Decode(string text)
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using Newtonsoft.Json;
namespace ConsoleApp6
{
public class Program
@ayende
ayende / ravendb.php
Last active November 27, 2021 21:15
<?php
class RavenDB {
var $server;
var $database;
var $pem;
function __construct($server, $database, $pem = NULL) {
$this->server = $server;
$this->database = $database;
@ayende
ayende / gist:1669767
Created January 24, 2012 11:46
RavenDB NGram Search
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;
using Lucene.Net.Analysis.Tokenattributes;
using Lucene.Net.Util;
using Raven.Abstractions.Indexing;
using Raven.Client.Linq;
using Raven.Database.Indexing;
public class IdentifierMasking
{
private static byte[] _key;
public IdentifierMasking(byte[] key = null)
{
_key = key ?? Sodium.SecretBox.GenerateKey();
}
public string RevealIdentifier(string hidden)
public class User
{
public string Name { get; set; }
[JsonIgnore]
public UserId Id { get; set; }
}
public class UserId
{

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