Skip to content

Instantly share code, notes, and snippets.

View thepirat000's full-sized avatar
💗
In love with code

Federico Daniel Colombo thepirat000

💗
In love with code
View GitHub Profile
@thepirat000
thepirat000 / web.config
Created June 29, 2024 20:01
IIS Reverse Proxy - avoid CORS
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="Reverse Proxy Rewrite URL">
<match url="proxy/(.+)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="https://{R:1}" logRewrittenUrl="true" />
</rule>
@thepirat000
thepirat000 / InMemoryProducerDataProvider.cs
Created February 25, 2024 20:58
InMemoryProducerDataProvider for Audit.NET
public class InMemoryProducerDataProvider : AuditDataProvider
{
private readonly BlockingCollection<AuditEvent> _events;
public int Count => _events.Count;
public InMemoryProducerDataProvider()
{
_events = new BlockingCollection<AuditEvent>();
}
@thepirat000
thepirat000 / Initial design Audit.Polly for Audit.NET
Created February 11, 2024 20:47
An initial design for an Audit.Polly extension for Audit.NET. Data Providers with resilience
using Audit.Core;
using Polly;
using Polly.Fallback;
namespace test
{
public static class FallbackActionArgumentsExtensions
{
public static async ValueTask<Outcome<object>> FallbackToDataProvider(this FallbackActionArguments<object> args, AuditDataProvider fallbackDataProvider)
{
@thepirat000
thepirat000 / ProcessJpgImageFilesInPlace
Last active May 9, 2022 05:29
PowerShell script to Compress JPEG images using ffmpeg and exiftool
# Will JPEG compress (quality ~80%) and replace in-place all the images on the current folder and subfolders
# Keeping the same image dimension, dates and metadata.
# Will process only image files > 1MB
$savedSpace = 0
$counter = 0
$tmpDir = "D:\tmp\img-proc\"
if (-not(Test-Path $tmpDir)) {
New-Item $tmpDir -ItemType Directory
@thepirat000
thepirat000 / Terminator.ps1
Last active April 20, 2022 03:01
A powershell script to immediately terminate all the non-critical processes running
# Kill all non-essential processes
Add-Type -TypeDefinition @"
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
public static class WinProcess
# Install sber-swap pre-requisites for Windows 10 on an Azure VM of type NC (GPU)
# NVIDIA TeslaK80 / Radeon
Set-ExecutionPolicy Bypass -Scope Process -Force;
# Install chocolatey
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));
refreshenv
@thepirat000
thepirat000 / keybase.md
Last active September 15, 2021 22:09
keybase proof

Keybase proof

I hereby claim:

  • I am thepirat000 on github.
  • I am thepirat000 (https://keybase.io/thepirat000) on keybase.
  • I have a public key ASCP0JH2OxXK17p1mvdjeoSk0WvpF9dg5H5p_yk-kSbEvAo

To claim this, I am signing this object: