Skip to content

Instantly share code, notes, and snippets.

Ayende Rahien ayende

Block or report user

Report or block ayende

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View users.cs
public class UsersController : Controller
{
private readonly IAsyncDocumentSession _session;
public ExampleController(IAsyncDocumentSession session)
{
_session = session;
}
public async Task<IActionResult> Index()
View configure.cs
public void ConfigureServices(IServiceCollection services)
{
var settings = new Settings();
Configuration.Bind(settings);
var store = new DocumentStore
{
Urls = settings.Urls,
Database = settings.DatabaseName,
Certificate = new X509Certificate2( settings.CertPath, settings.CertPass)
View Settings.cs
public class Settings
{
public DatabaseSettings Database { get; set; }
public class DatabaseSettings
{
public string[] Urls { get; set; }
public string DatabaseName { get; set; }
public string CertPath { get;set; }
public string CertPass { get;set; }
View appsettings.json
{
"Database": {
"Urls": [
"https://a.rock-n.roll.ravendb.cloud",
"https://b.rock-n.roll.ravendb.cloud",
"https://c.rock-n.roll.ravendb.cloud",
],
"DatabaseName": "Jazz",
"CertPath": "/mnt/config/jazz.pfx",
"CertPass": null
View spawn.cs
var priorityOrder = new [] {
DinosaurSelection.Triceratops,
DinosaurSelection.Centrosaurus,
DinosaurSelection.Styracosaurus
};
IDinosaur dino = null;
var errors = new List<Exception>();
foreach(var dinoToGet in priorityOrder)
{
View separate-journals.sh
$ mkdir /journals/bulk
$ ln -s /journals/bulk /data/bulk/Journals
View journals.sh
$ sudo mkfs -t ext4 /dev/nvme2n1
$ sudo mkdir /journals
$ sudo mount /dev/nvme2n1 /journals
$ sudo chown -R $USER /journals
View setup-cilent.sh
# install .net core
$ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
$ sudo dpkg -i packages-microsoft-prod.deb
$ sudo add-apt-repository universe
$ sudo apt-get install apt-transport-https
$ sudo apt-get update
$ sudo apt-get install dotnet-sdk-2.2
# clone repos
View bulk-1.cs
// install-package ravendb.client
// install-package bogus
using Raven.Client.Documents;
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace Bench.BulkInsert
{
View setup-raven.sh
# setup the /data drive (512 GB)
$ sudo mkfs -t ext4 /dev/nvme1n1
$ sudo mkdir /data
$ sudo mount /dev/nvme1n1 /data
$ sudo chown -R $USER /data
# setup RavenDB (on home drive)
$ wget https://daily-builds.s3.amazonaws.com/RavenDB-4.2.0-linux-x64.tar.bz2
You can’t perform that action at this time.