Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# Source: http://kubernetes.io/docs/getting-started-guides/kubeadm
set -e
source /etc/lsb-release
if [ "$DISTRIB_RELEASE" != "20.04" ]; then
echo "################################# "
echo "############ WARNING ############ "
@mohatb
mohatb / nc-proxy-readme.md
Created September 26, 2022 09:49 — forked from m1tk4/nc-proxy-readme.md
netcat tcp proxy, for mapping ports on a remote machine to a local machine

Helper script to map ports to other servers.

Use Case

had a database that was only accesible in the VPC on aws, so i created an dev intance and did a ssh tunnel to that dev instance with netcat mapping the port to the database

Sample Usage

Forward all request from local 5432 to remote host google.com port 80

./nc-proxy.sh 5432 google.com 80
#!/bin/bash
# Backup WSL
#./script.sh backup ~/wsl-backup
# Restore WSL
#./script.sh restore ~/wsl-backup
# Backup WSL
backup_wsl() {
@mohatb
mohatb / script.ps1
Last active January 31, 2023 08:31
Backup-restore WSL Powershell
# Backup WSL
# Backup WSL
#.\script.ps1 backup 'C:\wsl-backup'
# Restore WSL
#.\script.ps1 restore 'C:\wsl-backup'
function Backup-WSL {
[CmdletBinding()]
param (
#!/bin/bash
# Variables for the Azure AKS cluster and Log Analytics workspace
clusterrg="akscilium"
clustername="akscilium"
workspaceRG="ammanrg"
workspacename="ammaninternal"
# Get the variables with CLI.
# if you are running on a node, replace the variables with static entries.
@mohatb
mohatb / collectlabelsfromcontainerd1.go
Created April 29, 2023 11:32
script that calls containerd api and prints the labels
package main
import (
"context"
"fmt"
"strings"
"github.com/containerd/containerd"
"github.com/containerd/containerd/namespaces"
)
package main
import (
"context"
"fmt"
"github.com/containerd/containerd"
"github.com/containerd/containerd/namespaces"
)
@mohatb
mohatb / collectLabels.go
Created April 30, 2023 13:32
collect containerd k8s labels
package main
import (
"context"
"fmt"
"log"
"github.com/containerd/containerd"
"github.com/containerd/containerd/namespaces"
cadvisorapi "github.com/google/cadvisor/info/v1"
@mohatb
mohatb / getContainerInfoOmitEmpty.go
Last active April 30, 2023 15:27
get container info (omit empty) sample to compare with the map
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"github.com/containerd/containerd"
"github.com/containerd/containerd/namespaces"
@mohatb
mohatb / download_kubeproxy.sh
Created May 30, 2023 10:43
download kube-proxy from all aks nodes
#!/bin/bash
# Start kubectl proxy in the background
kubectl proxy &
# Save the process ID of kubectl proxy
kubectl_proxy_pid=$!
# Base URL to the logs directory on the node
base_url="http://localhost:8001/api/v1/nodes"