Skip to content

Instantly share code, notes, and snippets.

@nosavvy33
nosavvy33 / gist:9adb00860ef3c9e4e4714a5bf427a141
Created September 7, 2023 02:56
AWS IAM Access Keys rotation
# Assuming AWS CLI is installed and you have sufficient permissions
param (
[Parameter(Mandatory=$true)]
[string]$IAMUserName
)
# Fetch the access keys for the user
$keys = aws iam list-access-keys --user-name $IAMUserName | ConvertFrom-Json
# If 2 keys exist, delete the oldest one
@nosavvy33
nosavvy33 / docker-compose.yml
Last active October 18, 2021 02:58
Jaeger + ES + Kibana + HotROD
version: "3"
# JAEGER CHART IS BETAAAAA
services:
elasticsearch:
container_name: elasticsearch_database
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.3
networks:
- elastic-jaeger
ports:
- "127.0.0.1:9200:9200" #HTTP request listening port (API calls)
public void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IPrinter, PrinterService>();
services.AddTransient<ICalculator, CalculatorService>();
services.AddControllers();
}
public void ConfigureServices(IServiceCollection services)
{
services.AddScoped<IPrinter, PrinterService>();
services.AddScoped<ICalculator, CalculatorService>();
services.AddControllers();
}
// in Services\Calculator\CalculatorService.cs
public class CalculatorService : ICalculator
{
// this was added
private readonly IPrinter _printer;
public CalculatorService( IPrinter printer)
{
this._printer = printer;
}
// this in Services\ConsolePrinter\IPrinter
public interface IPrinter
{
void PrintToConsole(int Result);
// this was added
void PingPong();
}
// this in Services\ConsolePrinter\PrinterService
// in Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IPrinter, PrinterService>();
services.AddSingleton<ICalculator, CalculatorService>();
services.AddControllers();
}
[ApiController]
[Route("calculator")]
public class CalculatorController : Controller
{
// interfaces and not implementations
private readonly IPrinter _printer;
private readonly ICalculator _calculator;
// "initialized" interfaces passed as controller's constructor parameters
public CalculatorController(IPrinter printer, ICalculator calculator)
// copy this in Services\Calculator\CalculatorService.cs
public class CalculatorService : ICalculator
{
public CalculatorService()
{
}
public int Substract(int a, int b)
{
return a - b;
// copy this in Services\Calculator\ICalculator.cs
public interface ICalculator
{
int Sum(int a, int b);
int Substract(int a, int b);
}
// copy this in Services\Printer\IPrinter.cs
public interface IPrinter