Skip to content

Instantly share code, notes, and snippets.

View KamranBiglari's full-sized avatar
:octocat:

Kamran Biglari KamranBiglari

:octocat:
View GitHub Profile
@KamranBiglari
KamranBiglari / Automating AWS ECR Credential Refresh in Kubernetes with Terraform.md
Created November 26, 2025 16:15
Automating AWS ECR Credential Refresh in Kubernetes with Terraform

Automating AWS ECR Credential Refresh in Kubernetes with Terraform

The Problem: ECR Tokens That Expire Every 12 Hours

If you're running a Kubernetes cluster and pulling Docker images from AWS Elastic Container Registry (ECR), you've likely encountered this frustrating problem: ECR authentication tokens expire every 12 hours.

This means your pods can't pull images after the token expires, leading to failed deployments and restarts. While this is a security feature by design, it creates an operational headache for teams running production Kubernetes clusters.

Common Solutions and Their Limitations

🛠 MikroTik CHR: Private Network Setup on Hetzner Cloud

This guide explains how to configure MikroTik RouterOS (CHR) to connect to a Hetzner Cloud Private Network using a /32 IP address — the default setup in Hetzner.

📋 Prerequisites

  • You’ve created a Hetzner Cloud Network (e.g., 172.16.64.0/21)

  • A subnet (e.g., 172.16.64.0/28) is attached to your CHR instance

  • You can access the MikroTik terminal (serial, SSH, or Winbox)

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@KamranBiglari
KamranBiglari / websocket_script.md
Last active November 7, 2024 11:50
WebSocket Client Script with Dynamic User Prompts and Auto Installation of websocat

This Bash script establishes a WebSocket connection to a server, allowing users to send a sequence of messages interactively. It is particularly useful for testing WebSocket APIs or automating WebSocket-based data subscriptions.

The script leverages websocat for WebSocket communication. If websocat is not installed, the script will prompt the user to install it automatically.

Features

  • Interactive Setup: The script prompts the user for essential parameters, including:
  • WebSocket URL: Defaults to wss://example.com if left blank.
  • Username and Password: For authentication in the WebSocket server.
  • Currency (CCY): Used to specify the currency in the subscription message.
@KamranBiglari
KamranBiglari / athena-query.tmpl.sql
Created March 7, 2024 13:29
AWSCli: start athena query execution from file
SELECT * FROM "${Table}" WHERE id='${Id}'