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 client = new CloudApiClient("RVDB-redacted_redacted_redacted_redacted_redact"); | |
await client.Products.ChangeInstanceTypeAsync(new ChangeInstanceTypeRequest | |
{ | |
ProductId = "products/1-A", | |
InstanceType = "P30", | |
}); |
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 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", |
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
// 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 | |
} |
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
// 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, |
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
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() >= |
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
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) | |
{ |
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 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); |
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
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace ConsoleApp2 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
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
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 | |
{ |
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 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; | |
} |