Skip to content

Instantly share code, notes, and snippets.

View alexolinux's full-sized avatar
🤠
Working from home

Alex Mendes alexolinux

🤠
Working from home
View GitHub Profile
@alexolinux
alexolinux / install-nvm.sh
Last active July 27, 2025 11:28
Script to install Node Version Manager (NVM).
#!/bin/bash
#https://github.com/nvm-sh/nvm/releases
NVM_VER="v0.40.3"
# Check if NVM is already installed
if [ -z "$(command -v nvm)" ] && [ -z "$NVM_DIR" ]; then
echo "---- NVM Installation ----"
@alexolinux
alexolinux / install-trivy.sh
Created April 19, 2024 12:08
Installing Trivy using YUM Package Manager
#!/bin/bash
# https://aquasecurity.github.io/trivy/v0.50/getting-started/installation/#rhelcentos-official
RELEASE_VERSION=$(grep -Po '(?<=VERSION_ID=")[0-9]' /etc/os-release)
cat << EOF | sudo tee -a /etc/yum.repos.d/trivy.repo
[trivy]
name=Trivy repository
baseurl=https://aquasecurity.github.io/trivy-repo/rpm/releases/$RELEASE_VERSION/\$basearch/
gpgcheck=1
enabled=1
@alexolinux
alexolinux / zsh-install-compilation.sh
Last active May 6, 2024 18:05
Script to install ZSH specific version via compilation
#!/bin/bash
ZSH_VER="zsh-5.9"
ZSH_URL="https://www.zsh.org/pub/${ZSH_VER}.tar.xz"
TMP_DIR="/tmp"
# Check if the script is run as root
if [ "$EUID" -ne 0 ]; then
echo "Error: This script should not be run as root."
exit 1
@alexolinux
alexolinux / install-kubectl.sh
Last active August 27, 2025 21:55
Script to install kubectl binary.
#!/bin/bash
# Script to install kubectl binary with curl on Linux
# List of kubectl releases: https://kubernetes.io/releases/
# For kubectl latest stable version: $(curl -L -s https://dl.k8s.io/release/stable.txt)
KUBE_VERSION="1.32.0"
# Define installation directory
# Note: If you do not have root access on the target system, you can still install kubectl to the '~/.local/bin' directory.
@alexolinux
alexolinux / ssh-agent.sh
Created April 6, 2024 13:40
Shell Script for activating SSH Agents in ZSH Environment
#!/bin/zsh
SSH_HOME="${HOME}/.ssh"
keys=($SSH_HOME/*.pem)
# Check if SSH_AUTH_SOCK is not set or is not a socket file
if [ -z "$SSH_AUTH_SOCK" ] || [ ! -S "$SSH_AUTH_SOCK" ]; then
eval "$(ssh-agent -s)"
# Add SSH keys to agent
@alexolinux
alexolinux / locust.py
Created March 5, 2024 20:49
Example Run: locust -f locust.py -H http://localhost -P 8089
from locust import HttpUser, task, between
class MyUser(HttpUser):
wait_time = between(1, 5) # Time between requests in seconds
@task
def my_task(self):
# Replace api-endpoint
self.client.get("/api-endpoint")
@alexolinux
alexolinux / k82-namespace-stuck-terminating.md
Last active May 21, 2024 10:06
Removing a Namespace stuck in terminating state.

k82-namespace-stuck-terminating


  1. Defining Namespace Variable (namespace name)
NS="my-namespace"
  1. Retrieve the namespace api state specification
@alexolinux
alexolinux / k3d.md
Last active May 24, 2025 12:05
K3d CKAD Cluster Lab

K3d CKAD Cluster Lab


K3d Installation

Based on k3d.io

Requirements

@alexolinux
alexolinux / docker-ce-install.sh
Last active July 3, 2025 23:07
Docker community edition installation on Linux
#!/bin/bash
# Check if script is run as root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root. Please use sudo."
exit 1
fi
# Update package index
if command -v apt-get &> /dev/null; then
@alexolinux
alexolinux / docker-vscode.sh
Last active May 19, 2024 13:23
code-server Docker container
#https://hub.docker.com/r/linuxserver/code-server
docker run -d \
--name=code-server \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Etc/UTC \
-e PASSWORD="${PASSWORD}" \
-e SUDO_PASSWORD="${SUDO_PASSWORD}" \
-e DEFAULT_WORKSPACE=/config/workspace \