Skip to content

Instantly share code, notes, and snippets.

View hasmukhlalpatel's full-sized avatar

Hasmukh Patel hasmukhlalpatel

View GitHub Profile
@hasmukhlalpatel
hasmukhlalpatel / 1_readme.md
Last active October 22, 2025 22:27
Run k3s-server and local container registry with PowerShell (Working with Podman)

Run k3s-server with powershell (Workig with podman)

See full details at setup K3S on Docker

Set Alias

Set-Alias docker podman

Start K3s server with network policy fixes - host network

@hasmukhlalpatel
hasmukhlalpatel / 1readme.md
Last active September 24, 2025 21:59
WSL manage in powershell

Setup devbox on wsl using PowerShell script

Setup script

Function Wrapper (Best for parameters):

function wslsetup { & "C:\Path\To\Your\manage-devbox.ps1" @args }

Temporary for current session:

function wslsetup { & "C:\Path\To\Your\manage-devbox.ps1" @args }
@hasmukhlalpatel
hasmukhlalpatel / a-readme.md
Last active October 22, 2025 22:31
K3S setup on Docker container

Setup K3S on Docker

Found at: Dev.to

Prerequisites

  • Docker installed on your machine
  • Basic knowledge of Docker and Kubernetes
  • A terminal or command prompt
  • Internet connection
  • Sufficient system resources (CPU, RAM, Disk Space)
  • Optional: Docker Compose installed for easier management of multi-container applications

Steps to Set Up K3S on Docker

@hasmukhlalpatel
hasmukhlalpatel / Microsoft.PowerShell_profile.ps1
Last active October 22, 2025 22:35
Start-up PowerShell scrips - Windows Terminal profile file - Goto commands
$dockerExists = Test-Path "c:\temp\docker"
$podmanExists = Test-Path "c:\temp\podman"
$gotoFolderPath = "$env:USERPROFILE\OneDrive\Goto\"
$gotoFolderExists = Test-Path $gotoFolderPath
$manageDevboxFilePath = "D:\Repos\Github\hasmukhlalpatel\dev-container-on-lxd-or-wsl\setup-devbox-on-wsl\manage-devbox.ps1"
$manageDevboxExists = Test-Path $manageDevboxFilePath
function get-file {
param(
@hasmukhlalpatel
hasmukhlalpatel / cert_common.sh
Last active September 7, 2025 22:50
Generate self sign certificates for local development
#!/bin/bash
# Certificate Common Library
# Shared functions for certificate management scripts
# Usage: source ./cert_common.sh
# Default configuration - can be overridden by environment variables
GLOBAL_CERT_PATH="${GLOBAL_CERT_PATH:-$HOME/ssl/certs}"
CA_FOLDER="${CA_FOLDER:-CA}"
SERVER_FOLDER="${SERVER_FOLDER:-Server}"
@hasmukhlalpatel
hasmukhlalpatel / readme.md
Last active May 12, 2025 16:26
CorrelationId Middleware in dotnet

CorrelationIdMiddleware

public class CorrelationIdMiddleware
{
    private readonly RequestDelegate _next;

    public CorrelationIdMiddleware(RequestDelegate next)
    {
        _next = next;
    }
using System.Diagnostics;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;
public class TimingMiddleware
{
private readonly RequestDelegate _next;
public TimingMiddleware(RequestDelegate next)
{
@hasmukhlalpatel
hasmukhlalpatel / readme.md
Created February 10, 2025 10:41
How to add more configuration files to a web application? how to override default configuration files?
@hasmukhlalpatel
hasmukhlalpatel / config.txt
Created February 2, 2025 18:44
Reducing power of the Raspberry Pi
#/boot/config.txt
dtoverlay=pi3-disable-wifi
dtoverlay=pi3-disable-bt
arm_freq=900
arm_freq_max=900
arm_freq_min=150
gpu_freq=250
@hasmukhlalpatel
hasmukhlalpatel / readme.md
Last active January 19, 2025 22:13
Custom Endpoint Selector Middleware for yarp or override route/ endpoint- yarp revers proxy

In Yarp reversproxy, If there is missing endpoint or not selected or if you wanna override

app.UseMiddleware<CustomEndpointSelectorMiddleware>();
public class CustomEndpointSelectorMiddleware
{
    private readonly RequestDelegate _next;
    private readonly EndpointDataSource _endpointDataSource;