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 / thats-me.txt
Created June 18, 2018 18:34
Do not look here
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:
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 April 30, 2018 18:57
Creates a Docker container to locally host an AWS XRay daemon.
# 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
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 April 10, 2018 22:08
A C# function that fetches all the items returned by a service across several pages
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 March 25, 2018 15:51
AutoValueAttribute for AutoFixture/NUnit
[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())
{
}
@Kralizek
Kralizek / Contact.cs
Last active February 27, 2018 16:44
Customization with timed Do
public class Contact : IHubSpotEntity
{
[DefaultProperty("vid")]
public long Id { get; set; }
[DefaultProperty("portal-id")]
public long PortalId { get; set; }
[DefaultProperty("is-contact")]
public bool IsContact { get; set; }
@Kralizek
Kralizek / AutoFakeItEasy.csproj
Last active February 19, 2018 11:55
AutoFakeItEasy live testing
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoFixture.AutoFakeItEasy" Version="4.1.0" />