My Elasticsearch cheatsheet with example usage via rest api (still a work-in-progress)
This file contains hidden or 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 Microsoft.AspNetCore.Builder; | |
| using Microsoft.AspNetCore.Hosting; | |
| using Microsoft.AspNetCore.Http; | |
| using Microsoft.Extensions.Logging; | |
| namespace WebApplication1 | |
| { | |
| public class Program | |
| { | |
| public static void Main(string[] args) |
This file contains hidden or 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.Linq; | |
| using System.Net; | |
| using System.Threading.Tasks; | |
| using Docker.DotNet; | |
| using Docker.DotNet.Models; | |
| using Raven.Client.Documents; | |
| using Raven.Client.Documents.Session; | |
| using Raven.Client.Exceptions; |
This file contains hidden or 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.Linq; | |
| using System.Reflection; | |
| using System.Threading.Tasks; | |
| using Microsoft.AspNetCore.Hosting; | |
| using Microsoft.Extensions.DependencyInjection; | |
| using Microsoft.Extensions.DependencyModel; | |
| using WebApplication40; |
This file contains hidden or 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
| type IBuilder<T> = { | |
| [k in keyof T]: (arg: T[k]) => IBuilder<T> | |
| } & { build(): T } | |
| function proxyBuilder<T>(): IBuilder<T> { | |
| var built: any = {}; | |
| var builder = new Proxy({}, { | |
| get: function(target, prop, receiver) { | |
| if (prop === 'build') return () => built; | |
| return (x: any): any => { |
This file contains hidden or 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.Linq; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| using Microsoft.Extensions.Hosting; | |
| namespace WebApplication24 | |
| { | |
| public abstract class HostedService : IHostedService |
This file contains hidden or 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
| package main | |
| // A simple demo implementation of a Redis job queue in Go inspired on http://stackoverflow.com/a/34754632 | |
| // You'll need to get redis driver package in terminal with: go get -u gopkg.in/redis.v5 | |
| // Once it is running, Redis should look like: http://i.imgur.com/P4XlwlP.png | |
| // Terminal should look like: http://i.imgur.com/AS2IIbP.png | |
| // I have 4 days of Go programming experience, have mercy. | |
| import ( | |
| "fmt" |
This file contains hidden or 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 void Execute(ChargeCommand command) | |
| { | |
| var pipeline = new PipelineBuilder<ChargeContext>() | |
| .Register(new TimingHandler()) | |
| .Register(new LoggingHandler()) | |
| .Register(new ValidationHandler( | |
| validationPipeline => | |
| { | |
| validationPipeline.Register(new AmountValidator(maxAmount: 500)); | |
| } |
This file contains hidden or 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
| { | |
| "variables": { | |
| "client_id": "", | |
| "client_secret": "", | |
| "subscription_id": "", | |
| "tenant_id": "", | |
| "object_id": "", | |
| "resource_group": "", | |
| "storage_account": "", |
This file contains hidden or 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
| <Query Kind="Program"> | |
| <NuGetReference Prerelease="true">Microsoft.Diagnostics.Runtime</NuGetReference> | |
| <Namespace>Microsoft.Diagnostics.Runtime</Namespace> | |
| <Namespace>System</Namespace> | |
| <Namespace>System.IO</Namespace> | |
| <Namespace>System.Linq</Namespace> | |
| <Namespace>System.Text</Namespace> | |
| <Namespace>Microsoft.Diagnostics.Runtime.Utilities</Namespace> | |
| </Query> |