Skip to content

Instantly share code, notes, and snippets.

View alirezanet's full-sized avatar
:octocat:
Working from Home

AliReZa Sabouri alirezanet

:octocat:
Working from Home
View GitHub Profile
@alirezanet
alirezanet / CsvBatchProcessor.cs
Last active April 8, 2025 18:25
CSV Batch Processor Template with Checkpointing and Concurrency Control This reusable template enables efficient processing of huge CSV files in batches. It leverages configurable concurrency limits and checkpointing to resume processing, while logging errors for any records that fail to process.
// USAGE EXAMPLE
var processor = new CsvBatchProcessor<Record>(
csvFile: @"PATH TO THE MAIN CSV FILE.csv",
errorFile: @"PATH TO THE LOCATION OF ERROR TRACKER.csv",
checkpointFile: @"CHECKPOINT FILE PATH",
batchSize: 100,
maxDegreeOfParallelism: 50,
processRecordAsync: async record =>
{
// THE PROCESSING LOGIC
@alirezanet
alirezanet / GoogleAdWhitelistForPiHole.list
Created March 30, 2025 23:22
This list will allow google ads with Pihole, Just add it to your allowlist
googleadservices.com
www.googleadservices.com
ad.doubleclick.net
clickserve.dartsearch.net
dartsearch.net
www..dartsearch.net
www.googleadservices.com
@alirezanet
alirezanet / aws.ps1
Last active April 8, 2024 13:32
This PowerShell script automates the retrieval of AWS credentials via SSO login and saves them to the .aws/credentials file. Supports fetching credentials for all profiles, specific profiles, and listing available profiles.
param(
[string] $Session = "my-session",
[string] $Region = "eu-west-1",
[string] $Profile = "default",
[Parameter(Mandatory = $false, Position = 0)]
[string]$Mode = "help"
)
function Login {
@alirezanet
alirezanet / SortBenchmark.cs
Last active July 17, 2023 09:37
Sorting Algorithms example in C#
// BenchmarkDotNet=v0.13.2, OS=Windows 11 (10.0.22000.1098/21H2)
// 11th Gen Intel Core i5-11400F 2.60GHz, 1 CPU, 12 logical and 6 physical cores
// .NET SDK=6.0.402
// [Host] : .NET 6.0.10 (6.0.1022.47605), X64 RyuJIT AVX2
// DefaultJob : .NET 6.0.10 (6.0.1022.47605), X64 RyuJIT AVX2
//
//
// | Method | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio |
// |-------------- |-----------:|---------:|---------:|------:|--------:|-------:|----------:|------------:|
// | InsertionSort | 131.3 ns | 0.43 ns | 0.36 ns | 0.29 | 0.00 | - | - | 0.00 |
@alirezanet
alirezanet / Enable_vt100_csharp.cs
Created January 1, 2022 01:12 — forked from tomzorz/Enable_vt100_csharp.cs
Enable VT100 for the current console window from .NET Core
using System;
using System.Runtime.InteropServices;
namespace Vt100Test
{
public class Program
{
// ReSharper disable InconsistentNaming
@alirezanet
alirezanet / Iran96-97.json
Last active February 5, 2025 21:43
List of provinces, states and cities of Iran with geographical coordinates (96-97 update)
[
{
"latitude": "34° 31' 24.924",
"longitude": "50° 0' 20.866",
"province": "مرکزی",
"state": "آشتیان",
"city": "آشتیان"
},
{
"latitude": "33° 40' 29.197",
@alirezanet
alirezanet / netsh.txt
Last active March 5, 2025 16:21
netsh ip/port forwarding sample
add forwarding interface:
netsh interface portproxy add v4tov4 listenport={srcPort} listenaddress={srcIp} connectport={DesPort} connectaddress={DesIp}
show interface:
netsh interface portproxy show v4tov4
delete interface:
netsh interface portproxy delete v4tov4 listenport={srcPort} listenaddress={srcIp}
-----------------------------