Skip to content

Instantly share code, notes, and snippets.

Renato Golia Kralizek

View GitHub Profile
@Kralizek
Kralizek / rabbitmq-service-on-ecs.md
Last active Mar 17, 2019
RabbitMQ service on ECS
View rabbitmq-service-on-ecs.md

Empty file to get a better name for the gist

@Kralizek
Kralizek / SmartAutoDataAttribute.cs
Last active Mar 1, 2019
A C# attribute deriving from AutoDataAttribute in AutoFixture.NUnit3 that can be customized per test.
View SmartAutoDataAttribute.cs
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 Jan 12, 2019
A Rx subject that stores all values until an observer subscribes.
View QueueSubject.cs
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 Jan 2, 2019
AutoMoq can't generate a mock for a delegate when in the signature of a test method
View AutoMoqError.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoFixture" Version="4.6.0" />
@Kralizek
Kralizek / thats-me.txt
Created Jun 18, 2018
Do not look here
View thats-me.txt
Bio:
Born in Napoli, Italy, living in Stockholm, Sweden. Passionate about distributed software architecture and .NET. Proud owner of a Windows 10 Mobile.
URL:
http://www.educationsmediagroup.com/
Company:
CTO at Educations Media Group ( @emgdev )
Location:
View docker-info.txt
C:\Users\Renato> docker info
Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 2
Server Version: 18.03.1-ce
Storage Driver: lcow (linux) windowsfilter (windows)
LCOW:
Windows:
@Kralizek
Kralizek / aws-xray-docker.ps1
Last active Apr 30, 2018
Creates a Docker container to locally host an AWS XRay daemon.
View aws-xray-docker.ps1
# Fetches credentials from default profile
# It uses the AWS Powershell cmdlet
$credentials = (Get-AWSCredentials -ProfileName default).GetCredentials()
$accessKey = $credentials.AccessKey
$secretKey = $credentials.SecretKey
# Creates a container for later reuse
docker create -p 2000:2000/udp -e AWS_ACCESS_KEY_ID=$accessKey -e AWS_SECRET_ACCESS_KEY=$secretKey -e AWS_REGION=eu-west-1 --name aws-xray namshi/aws-xray
# Starts the container
View developer-enterprise.txt
Disable-UAC
#--- Initial Windows Config ---
Update-ExecutionPolicy Unrestricted
Set-WindowsExplorerOptions -EnableShowFileExtensions -EnableShowFullPathInTitleBar -DisableOpenFileExplorerToQuickAccess
Enable-RemoteDesktop
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneExpandToCurrentFolder -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneShowAllFolders -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Value 1
@Kralizek
Kralizek / FetchAll.cs
Last active Apr 10, 2018
A C# function that fetches all the items returned by a service across several pages
View FetchAll.cs
async Task<IReadOnlyList<T>> FetchAll<T, TRequest, TResponse> (
Func<TRequest> requestFactory,
Func<TRequest, Task<TResponse>> requestor,
Func<TResponse, string> tokenGetter,
Action<TRequest, string> tokenSetter,
Func<TResponse, IEnumerable<T>> resultExtractor,
Func<TResponse, bool> hasMore
)
{
if (requestFactory == null) throw new ArgumentNullException(nameof(requestFactory));
@Kralizek
Kralizek / AutoValueAttribute.cs
Created Mar 25, 2018
AutoValueAttribute for AutoFixture/NUnit
View AutoValueAttribute.cs
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
public class AutoValueAttribute : DataAttribute, IParameterDataSource
{
private readonly Lazy<IFixture> _fixtureLazy;
private IFixture Fixture => _fixtureLazy.Value;
public AutoValueAttribute() : this (() => new Fixture())
{
}
You can’t perform that action at this time.