Skip to content

Instantly share code, notes, and snippets.

View dario-l's full-sized avatar

Dariusz Lenartowicz dario-l

View GitHub Profile
@dario-l
dario-l / Program.cs
Created February 20, 2024 11:01
Slow MassTransit bus startup
using System.Diagnostics;
using MassTransit;
var busControl = Bus.Factory.CreateUsingRabbitMq(cfg =>
{
cfg.Host(new Uri($"amqps://rabbitmq:rabbitmq@localhost:5671/"));
foreach (int i in Enumerable.Range(0, 50))
{
cfg.ReceiveEndpoint($"mt-test-{i}", e => { });
@dario-l
dario-l / mumurhash.linq
Created February 18, 2024 18:22 — forked from Aaronontheweb/mumurhash.linq
LINQPad Query to Visualize MurmurHash Distributions
// requires the `Akka` NuGet package to be installed in the query
int entitiesPerNodeFactor = 100;
List<string> nodes = Enumerable.Range(0, 10).Select(c => $"hostname-{c}").ToList();
Dictionary<string, int> entityToNodeAllocations = nodes.ToDictionary(c => c, k => 0);
var entityIds = Enumerable.Range(0, nodes.Count * entitiesPerNodeFactor).Select(e => $"entity-{e}");
foreach(var e in entityIds){
var hashCode = MurmurHash.StringHash(e);
@dario-l
dario-l / MarkdownComponent.cs
Created November 1, 2023 10:40 — forked from flew2bits/MarkdownComponent.cs
Updated Markdown component for QuestPDF
using Markdig;
using Markdig.Syntax;
using Markdig.Syntax.Inlines;
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
namespace PdfExperiments;
public enum BlockType
@dario-l
dario-l / IISproxyToTeamCitySteps.txt
Created December 17, 2022 23:45 — forked from jrgcubano/IISproxyToTeamCitySteps.txt
Proxy using IIS to TeamCity site
Request:
Proxy to teamcity. Use a proxy in IIS and redirect "input" to "output".
Ideas:
http://jonalb.com/post/2010/10/23/TeamCity-On-Port-80-In-IIS.aspx
http://www.wrapcode.com/infrastructure/configure-reverse-proxy-with-url-rewrite-and-arr-for-iis/
Solution:
- Create an empty site in IIS
@dario-l
dario-l / ContinuousDeploymentWithGitVersionAndGitFlow.md
Created October 28, 2020 10:21 — forked from andrewabest/ContinuousDeploymentWithGitVersionAndGitFlow.md
How to use GitVersion for semantic versioning with TeamCity and Octopus Deploy

Setting up TeamCity and Octopus with GitVersion

Assumptions

  • You are using GitFlow
  • You want to deploy a new version of your software every time a commit is made to the develop branch
  • You are using Octopack to package your application for deployment

Instructions

public class MediatorPipeline<TRequest, TResponse>
: IRequestHandler<TRequest, TResponse>
where TRequest : IRequest<TResponse>
{
private readonly IRequestHandler<TRequest, TResponse> _inner;
private readonly IEnumearble<IMessageValidator<TRequest>> _validators;
private readonly IMessageAuthorizer _authorizer;
private readonly IEnumerable<IPreRequestProcessor<TRequest>> _preProcessors;
private readonly IEnumerable<IPostRequestProcessor<TRequest, TResponse>> _postProcessors;
private readonly IEnumerable<IResponseProcessor<TResponse>> _responseProcessors;
@dario-l
dario-l / ReadMe.md
Created March 15, 2018 12:20 — forked from edm00se/ReadMe.md
Sample nginx.conf settings to perform reverse proxy functionality to.

Read Me

In order to access a server hosted within a vm (guest), for development purposes from the host OS, which is restricted to same origin / localhost only requests, I set up a siple nginx reverse proxy to forward my requests.

Steps

  1. To install in a Windows VM, download and install nginx from the current, stable release; I installed to C:\nginx\
  2. Edit the <install path>/conf/nginx.conf file with the marked changes in the file of the same name in this gist.
  3. Start the nginx executable, located in your install path. There are service wrappers for Windows, or you can just kill the process to stop the nginx instance.

Commands for Windows

@dario-l
dario-l / README-Template.md
Created December 11, 2017 14:27 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@dario-l
dario-l / SqlClientSqlCommandSet.cs
Created August 31, 2017 10:51 — forked from Scooletz/SqlClientSqlCommandSet.cs
System.Data.SqlClient.SqlCommandSet extracted from Data internals, better than NHibernate, as no delegates creation is required beside the first static ctor
public class SqlClientSqlCommandSet : IDisposable
{
private static readonly Type SqlCmdSetType;
private readonly object _instance;
private int _countOfCommands;
private readonly static Action<object, SqlConnection> SetConnection;
private readonly static Func<object, SqlConnection> GetConnection;
private readonly static Action<object, SqlTransaction> SetTransaction;
private readonly static Func<object, SqlCommand> GetCommand;
@dario-l
dario-l / ExecutionResult.cs
Created August 30, 2017 20:30 — forked from vladikk/ExecutionResult.cs
Command execution result object for CQRS based systems
using System;
namespace Example
{
public abstract class ExecutionResult
{
protected ExecutionResult(Guid aggregateId, Guid commandId, DateTime executedOn)
{
AggregateId = aggregateId;
CommandId = commandId;