Skip to content

Instantly share code, notes, and snippets.

View Kralizek's full-sized avatar
🎯
Focusing

Renato Golia Kralizek

🎯
Focusing
View GitHub Profile
@Kralizek
Kralizek / main.tf
Last active October 28, 2023 16:20
AWS Cognito user pool backed by Microsoft Entra with Terraform
locals {
region = "eu-north-1"
}
resource "random_pet" "user_pool_name" {
length = 2
prefix = "test"
}
resource "aws_cognito_user_pool" "cognito" {

Keybase proof

I hereby claim:

  • I am kralizek on github.
  • I am kralizek (https://keybase.io/kralizek) on keybase.
  • I have a public key ASBU7qj7MepYNyG_AyK8etVC11-Db72Px-yxzanJaGvQmgo

To claim this, I am signing this object:

@Kralizek
Kralizek / Program.cs
Created July 22, 2022 18:36
LocalStack and Tye
using Amazon.SQS;
var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddInMemoryCollection(new Dictionary<string, string> {
["AWS:Profile"] = "LocalStack",
["AWS:Region"] = "us-east-1"
});
var options = builder.Configuration.GetAWSOptions();
@Kralizek
Kralizek / Program.cs
Last active August 2, 2022 00:57
Console application created using `System.CommandLine`
using System.CommandLine;
using Amazon;
using Amazon.S3;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
var profileOption = new Option<string>("--profile", getDefaultValue: () => "default", description: "The name of the profile to use to access AWS services.");
var regionOption = new Option<string>("--region", getDefaultValue: () => RegionEndpoint.EUWest1.SystemName, description: "The region where AWS services are located.");
@Kralizek
Kralizek / unit-test-lifecycle.cs
Last active July 2, 2020 09:50
Unit Testing in C#
using System.Diagnostics;
using NUnit.Framework;
[SetUpFixture]
public class RootFixtureSetup
{
[OneTimeSetUp]
public void OneTimeSetUp() => Debug.WriteLine("RootFixtureSetup:OneTimeSetUp");
[OneTimeTearDown]
@Kralizek
Kralizek / FizBuz.cs
Last active November 26, 2019 19:54
FizBuz using pattern matching and LINQ
Enumerable.Range(1, 100)
.Select(CheckModulo)
.Select(FizBuz)
.ToList()
.ForEach(Console.WriteLine);
static (bool isFizz, bool isBuzz, int n) CheckModulo(int n)
{
return (n % 3 == 0, n % 5 == 0, n);
}
@Kralizek
Kralizek / rabbitmq-service-on-ecs.md
Last active March 17, 2019 16:38
RabbitMQ service on ECS

Empty file to get a better name for the gist

@Kralizek
Kralizek / SmartAutoDataAttribute.cs
Last active October 18, 2023 08:32
A C# attribute deriving from AutoDataAttribute in AutoFixture.NUnit3 that can be customized per test.
public class SmartAutoDataAttribute : AutoDataAttribute
{
public SmartAutoDataAttribute() : base(() => CreateFixture(null)) { }
public SmartAutoDataAttribute(Type type, string methodName) : base(CreateFixtureWithMethod(type, methodName)) { }
private static Func<IFixture> CreateFixtureWithMethod(Type type, string methodName)
{
if (type == null)
{
@Kralizek
Kralizek / QueueSubject.cs
Last active January 12, 2019 02:16
A Rx subject that stores all values until an observer subscribes.
public class QueueSubject<T> : ISubject<T>
{
private readonly Subject<T> _subject = new Subject<T>();
private readonly Queue<Action<IObserver<T>>> _actions = new Queue<Action<IObserver<T>>>();
private bool _isCompleted = false;
private Exception _error;
public bool IsRunning => !_isCompleted && _error == null;
public bool HasObservers => _refCount > 0;
@Kralizek
Kralizek / AutoMoqError.csproj
Created January 2, 2019 10:29
AutoMoq can't generate a mock for a delegate when in the signature of a test method
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoFixture" Version="4.6.0" />