Skip to content

Instantly share code, notes, and snippets.

View alirezanet's full-sized avatar
🗽
Working from planet earth

AliReZa Sabouri alirezanet

🗽
Working from planet earth
View GitHub Profile
@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 March 17, 2024 14:41
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 May 16, 2024 17:38
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}
-----------------------------