Skip to content

Instantly share code, notes, and snippets.

View XREvo's full-sized avatar
🏠
Working from home

Emilien GUILMINEAU XREvo

🏠
Working from home
View GitHub Profile
@XREvo
XREvo / probe.cs
Created July 19, 2023 21:21
Probe Health check mapping
using Microsoft.AspNetCore.Diagnostics;
// Redacted after reading : https://andrewlock.net/deploying-asp-net-core-applications-to-kubernetes-part-6-adding-health-checks-with-liveness-readiness-and-startup-probes/#the-three-kinds-of-probe-liveness-readiness-and-startup-probes
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddHealthChecks()
.AddCheck("Startup", () => HealthCheckResult.Healthy("Startup is done!"), tags: new[] { "startup" })
@XREvo
XREvo / Program.cs
Created January 15, 2023 14:07
[emilien-guilmineau.fr] PHP et la cryptographie
using System.Security.Cryptography;
using System.Text;
// Clé de chiffrement
string secretKey = "S4a5Qy@pPv2Di2jz^*WMrxZM6@X5za/.ss24x";
// Vecteur d'initialisation du chiffrement
string secretIv = "i6qwQgZS&Q@CfPfb/.P2E";
// Transformation des secrets en tableau d'octets en vu de la signé numériquement via le mécanisme SHA256
byte[] hashKey = SHA256.HashData(Encoding.ASCII.GetBytes(secretKey));
@XREvo
XREvo / Babylon.FunctionMiddleware.Startup.cs
Created May 10, 2020 19:27
This is how you add a HTTP Middleware to a function app (see https://gist.github.com/XREvo/c5b0123991fa86f3989570af55b16c05 for more informations)
using Babylon.FunctionMiddleware;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
[assembly: WebJobsStartup(typeof(Startup))]
namespace Babylon.FunctionMiddleware
{
public class Startup
@XREvo
XREvo / Babylon.FunctionMiddleware.FunctionHttpMiddlewareExtensions.cs
Created May 10, 2020 19:19
Extension method to add a HTTP middleware to a Http triggered function app
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Threading.Tasks;
namespace Babylon.FunctionMiddleware