Skip to content

Instantly share code, notes, and snippets.

View ayende's full-sized avatar

Ayende Rahien ayende

View GitHub Profile
var client = new CloudApiClient("RVDB-redacted_redacted_redacted_redacted_redact");
await client.Products.ChangeInstanceTypeAsync(new ChangeInstanceTypeRequest
{
ProductId = "products/1-A",
InstanceType = "P30",
});
var client = new CloudApiClient("RVDB-redacted_redacted_redacted_redacted_redact");
ProductCreatedResponse result = await client.Products.CreateAsync(new ProductCreateRequest
{
AllowedIps = {"88.22.12.0/32"},
CloudProvider = CloudProvider.Gcp,
DiskSize = 128,
DisplayName = "Hotels & Resorts",
InstanceTypeName = "P20",
Region = "europe-west3",
ReleaseChannel = "Beta5.0",
// map<string, set<string>>
public void MultiDeleteAll(Slice key)
{
State.IsModified = true;
var page = FindPageFor(key, out _);
if (page == null || page.LastMatch != 0)
{
return; //nothing to delete - key not found
}
// map
from p in docs.Payments
let fraud = p.isFraud != 0 || p.isFlaggedFraud != 0
select new {
Count = 1,
Customer = p.nameOrig,
Transactions = new []{
new {
Type = p.type,
declare timeseries by30min(){
from Temp
between '2020-01-01' and '2020-04-01'
group by 30m
select avg()
}
declare function fill_missing_range(d){
for(var i = 0; i< d.Results.length-1;i++ ){
if( new Date(d.Results[i].To).toISOString() >=
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
// Don't try to start right off the bat
await Task.Delay(_settings.FirstPollingTime, stoppingToken);
_connection = new NpgsqlConnection(_settings.ConnectionString);
await _connection.OpenAsync(stoppingToken);
while (!stoppingToken.IsCancellationRequested)
{
public DynamicQueryMatchResult Match(DynamicQueryMapping query, List<Explanation> explanations = null)
{
var definitions = _indexStore.GetIndexesForCollection(query.ForCollection)
.Where(x => x.Type.IsAuto() && (query.IsGroupBy ? x.Type.IsMapReduce() : x.Type.IsMap()))
.Select(x => x.Definition as AutoIndexDefinitionBase)
.ToList();
if (definitions.Count == 0)
return new DynamicQueryMatchResult(string.Empty, DynamicQueryMatchType.Failure);
using System;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using Raven.Client.Documents;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
namespace CqrsInRaven
{
public static async Task<Article[]> SearchByAuthor(string author)
{
var articles = await DbHelper.ExecuteQueryAsync<Article>(CollectionId,
new QueryDefinition("SELECT * FROM articles AS a WHERE lower(a.author) = @author")
.WithParameter("@author", author.ToLower())
, author);
return articles;
}