Skip to content

Instantly share code, notes, and snippets.

View eramax's full-sized avatar
🎯
Focusing

Ahmed Morsi eramax

🎯
Focusing
View GitHub Profile
@eramax
eramax / values.yml
Created December 20, 2020 16:17
Traefik on Kubernetes
additionalArguments:
- --serverstransport.insecureskipverify
- --providers.file.filename=/data/traefik-config.yaml
- --entrypoints.web.http.redirections.entrypoint.to=:443
- --entrypoints.web.http.redirections.entrypoint.permanent=true
- --entrypoints.websecure.http.tls.certresolver=cloudflare
- --entrypoints.websecure.http.middlewares=headers-default@file
- --certificatesresolvers.cloudflare.acme.dnschallenge.provider=cloudflare
- --certificatesresolvers.cloudflare.acme.email=YOUREMAIL
- --certificatesresolvers.cloudflare.acme.dnschallenge.resolvers=1.1.1.1
@eramax
eramax / compiled_delegate.cs
Created June 15, 2021 18:45
Reflection in C#
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Attributes;
using System.Reflection;
using System;
using Sigil;
BenchmarkRunner.Run<MyTests>();
[MemoryDiagnoser]
public class MyTests
@eramax
eramax / Program.cs
Last active July 6, 2021 20:26 — forked from davidfowl/Program.cs
A minimal fully asynchronous C# ASP.NET Core 3.0 application with routing (learn more about ASP.NET Core here https://docs.microsoft.com/en-us/aspnet/core/?view=aspnetcore-3.0)
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Hosting;
public class Program
{
public static void Main(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
@eramax
eramax / README.MD
Created August 7, 2021 21:28 — forked from nzec/README.MD
DeezLoader Offical Page

Thanks to /u/zpoo32 for reporting several issues in this list!

Deemix

  • deemix: just the cli and the library
  • deemix-pyweb: the app with a GUI
  • deemix-server: just the server part of deemix-pyweb
@eramax
eramax / extend-trial-jetbrains-windows.bat
Created September 25, 2021 11:50
JetBrains IDE trial reset windows
REM Delete eval folder with licence key and options.xml which contains a reference to it
for %%I in ("WebStorm", "IntelliJ", "CLion", "Rider", "GoLand", "PhpStorm", "Resharper", "PyCharm") do (
for /d %%a in ("%USERPROFILE%\.%%I*") do (
rd /s /q "%%a/config/eval"
del /q "%%a\config\options\other.xml"
)
)
REM Delete registry key and jetbrains folder (not sure if needet but however)
rmdir /s /q "%APPDATA%\JetBrains"
@eramax
eramax / functional.cs
Last active September 26, 2021 05:49
Functional Programming with C# - Simon Painter
/// <summary>
/// Functional Programming with C# - Simon Painter - NDC Oslo 2020
/// https://www.youtube.com/watch?v=gvyTB4aMI4o
/// </summary>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
@eramax
eramax / Mapster.cs
Created September 26, 2021 10:50
Mapster mapper
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using Mapster;
using System;
/// <summary>
/// Mapster, the best .NET mapper that you are (probably) not using
/// https://www.youtube.com/watch?v=UIslFVEHkzA
/// </summary>
public class Program
@eramax
eramax / TestCoverage.cs
Created September 26, 2021 16:40
Code coverage of your tests in .NET
using App1;
using Xunit;
/// <summary>
/// How to collect the code coverage of your tests in .NET
/// https://www.youtube.com/watch?v=xwMWGYD8rgk
/// Calculate code coverage by cli command
/// dotnet tool install -g coverlet.console
/// coverlet .\bin\Debug\net5.0\App1.dll --target "dotnet" --targetargs "test --no-build"
/// dotnet test --collect:"XPlat Code Coverage"
@eramax
eramax / NSubstitute.cs
Created October 11, 2021 17:57
Clean mocking for unit tests using NSubstitute in .NET
using DataLib;
using NSubstitute;
using NSubstitute.ReturnsExtensions;
using WebApi2.Models;
using WebApi2.Services;
using Xunit;
/// <summary>
/// Clean mocking for unit tests using NSubstitute in .NET (Core, Framework, Standard)
/// https://www.youtube.com/watch?v=LcQYv0cBWk0&
@eramax
eramax / FluentAssertions.cs
Created October 11, 2021 19:19
How to write cleaner unit tests with Fluent Assertions in .NET Core
using DataLib;
using FluentAssertions;
using NSubstitute;
using NSubstitute.ReturnsExtensions;
using System;
using WebApi2.Models;
using WebApi2.Services;
using Xunit;
/// <summary>