Skip to content

Instantly share code, notes, and snippets.

@sayganov
sayganov / Program.cs
Last active December 22, 2023 00:27
Redis keyspace notifications
using StackExchange.Redis;
var configurationOptions = new ConfigurationOptions
{
EndPoints =
{
"localhost:6379"
}
};
@sayganov
sayganov / docker-compose.yml
Created July 27, 2021 10:24
Docker Compose for Redis
version: '2'
services:
redis:
image: docker.io/bitnami/redis:6.2
environment:
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_DISABLE_COMMANDS=FLUSHDB,FLUSHALL
ports:
- '6379:6379'
@sayganov
sayganov / docker-compose.yml
Created July 19, 2021 08:27
Docker Compose for RabbitMQ with UI
version: "3.2"
services:
rabbitmq:
image: rabbitmq:3-management-alpine
container_name: "rabbitmq"
ports:
- 5672:5672
- 15672:15672
volumes:
- ~/.docker-conf/rabbitmq/data/:/var/lib/rabbitmq/
@sayganov
sayganov / docker-compose.yml
Created July 15, 2021 10:52
Docker Compose for PostgreSQL with pgAdmin
version: "3.5"
services:
postgres:
container_name: postgres_container
image: postgres
environment:
POSTGRES_USER: ${POSTGRES_USER:-admin}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-admin}
PGDATA: /data/postgres
@sayganov
sayganov / script.ps1
Created June 8, 2021 06:09
Delete all local branches except master
git branch |`
%{ $_.Trim() } |`
?{ $_ -ne 'master' -and $_ -ne '* master' } |`
%{ git branch -D $_ }
@sayganov
sayganov / build.yml
Last active May 25, 2021 10:37
Build file for GitHub Actions
name: Build
on:
push:
paths:
- src/**
- .github/workflows/**
jobs:
job-ubuntu:
@sayganov
sayganov / GitVersion.yml
Last active May 25, 2021 10:38
GitVersion for NuGet packages
mode: MainLine
assembly-informational-format: "{NugetVersion}"
branches:
master:
tag: ""
feature:
tag: feature-{BranchName}
increment: Minor
hotfix:
tag: hotfix-{BranchName}
@sayganov
sayganov / ItemController.cs
Created January 16, 2020 19:02
EventBus.RabbitMQ.Standard (Publisher)
public class ItemController : ControllerBase
{
private readonly IEventBus _eventBus;
public ItemController(IEventBus eventBus)
{
_eventBus = eventBus;
}
[HttpPost]
@sayganov
sayganov / Startup.cs
Last active March 4, 2021 08:31
EventBus.RabbitMQ.Standard (Subscriber)
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
...
var rabbitMqOptions = Configuration.GetSection("RabbitMq").Get<RabbitMqOptions>();
services.AddRabbitMqConnection(rabbitMqOptions);
services.AddRabbitMqRegistration(rabbitMqOptions);
@sayganov
sayganov / EventBusExtension.cs
Created January 16, 2020 18:59
EventBus.RabbitMQ.Standard (Subscriber)
public static class EventBusExtension
{
public static IEnumerable<IIntegrationEventHandler> GetHandlers()
{
return new List<IIntegrationEventHandler>
{
new ItemCreatedIntegrationEventHandler()
};
}