Skip to content

Instantly share code, notes, and snippets.

View Tirael's full-sized avatar
🏠
Working from home

Georgiy Zhuykov Tirael

🏠
Working from home
  • Moscow, Moscow City, Russian Federation
View GitHub Profile
@Tirael
Tirael / EfUtility.cs
Created July 28, 2021 08:29
ef to sql
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Storage;
namespace MyNamespace
{
public static class EfUtility
@Tirael
Tirael / IQueryableExtensions
Created July 28, 2021 08:28 — forked from rionmonster/IQueryableExtensions
Resolve the SQL being executed behind the scenes in Entity Framework Core
public static class IQueryableExtensions
{
private static readonly TypeInfo QueryCompilerTypeInfo = typeof(QueryCompiler).GetTypeInfo();
private static readonly FieldInfo QueryCompilerField = typeof(EntityQueryProvider).GetTypeInfo().DeclaredFields.First(x => x.Name == "_queryCompiler");
private static readonly PropertyInfo NodeTypeProviderField = QueryCompilerTypeInfo.DeclaredProperties.Single(x => x.Name == "NodeTypeProvider");
private static readonly MethodInfo CreateQueryParserMethod = QueryCompilerTypeInfo.DeclaredMethods.First(x => x.Name == "CreateQueryParser");
namespace Sagas
{
using System;
using System.Collections.Generic;
class Program
{
static ActivityHost[] processes;
@Tirael
Tirael / default-gelf-tcp-udp-inputs.json
Created October 14, 2020 23:30
Graylog3 - default GELF TCP/UDP inputs
{
"v": 1,
"id": "65fc58bb-1758-4f3e-b9a3-e89b24d04443",
"rev": 1,
"name": "Default GELF TCP/UDP inputs",
"summary": "A Content Pack for Graylog3 with two GELF TCP/UDP inputs",
"description": "",
"vendor": "noname",
"url": "",
"parameters": [],
@Tirael
Tirael / gist:6fce2f75ac01e4a84da31fdd59220f76
Last active August 30, 2020 20:22
Kafka + strimzi (Windows)
choco install sed
kubectl create ns kafka
# curl -L http://strimzi.io/install/latest | sed "s/namespace: .*/namespace: kafka/" | kubectl apply -f - -n kafka
using Jaeger.Reporters;
using Jaeger.Samplers;
using Jaeger.Senders;
using Jaeger.Senders.Thrift;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using OpenTracing;
@Tirael
Tirael / ForEachAsync.cs
Created June 5, 2020 11:41 — forked from 0xced/ForEachAsync.cs
Parallel foreach async enumeration with maximum degree of parallelism
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Parallel
{
public static class EnumerableExtensions
{
@Tirael
Tirael / LetsEncrypt_HTTPS_plex.MD
Created June 3, 2020 18:13 — forked from churro-s/LetsEncrypt_HTTPS_plex.MD
Setup Let's Encrypt certificate for use with Plex Media Server on Ubuntu
@Tirael
Tirael / RestSharpExecuteAsyncMoq.cs
Created May 12, 2020 21:36 — forked from mrstebo/RestSharpExecuteAsyncMoq.cs
Example for mocking RestSharps IRestClient ExecuteAsync method using Moq
using Moq;
using NUnit.Framework;
using RestSharp;
using System;
using System.Net;
namespace RestsharpTests
{
[TestFixture]
public class RestsharpExecuteAsyncMoq
Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Restore:
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres