Skip to content

Instantly share code, notes, and snippets.

View r3xakead0's full-sized avatar

Afu Tse r3xakead0

View GitHub Profile
@r3xakead0
r3xakead0 / create-gke-standard-regional-cluster.sh
Last active November 25, 2025 16:26
Create a GKE Standard Regional Cluster (High Availability)
#!/bin/sh
set -e # Stop the script if any command fails
# Get the currently configured GCP Project ID
PROJECT_ID=$(gcloud config get-value project --quiet)
# Validate that a project is set
if [ -z "$PROJECT_ID" ]; then
echo "❌ ERROR: No project is configured in gcloud."
echo "Run: gcloud config set project <PROJECT_ID>"
@r3xakead0
r3xakead0 / create-gke-standard-cluster.sh
Last active November 25, 2025 19:47
Create a GKE Standard cluster
#!/bin/sh
set -e # Stop the script if any command fails
# Get the currently configured GCP Project ID
PROJECT_ID=$(gcloud config get-value project --quiet)
# Validate that a project is set
if [ -z "$PROJECT_ID" ]; then
echo "❌ ERROR: No project is configured in gcloud."
echo "Run: gcloud config set project <PROJECT_ID>"
@r3xakead0
r3xakead0 / deploy.sh
Last active November 25, 2025 20:09
Hello World deployed in GKE Cluster
#!/bin/sh
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
kubectl apply -f ingress.yaml
kubectl get deployment
kubectl autoscale deployment helloworld-deployment \
--cpu-percent=60 \
@r3xakead0
r3xakead0 / create-gke-autopilot.sh
Last active November 25, 2025 16:32
Create a GKE Autopilot cluster
#!/bin/sh
set -e # Stop the script if any command fails
# Get the currently configured GCP Project ID
PROJECT_ID=$(gcloud config get-value project --quiet)
# Validate that a project is set
if [ -z "$PROJECT_ID" ]; then
echo "❌ ERROR: No project is configured in gcloud."
echo "Run: gcloud config set project <PROJECT_ID>"
@r3xakead0
r3xakead0 / add-load-balancing.sh
Last active November 10, 2025 17:32
Create multiple web server instances with load balancing service in GCP
#!/bin/sh
# Set default region and zone
gcloud config set compute/region europe-west1
gcloud config set compute/zone europe-west1-b
# Create a static IP address
gcloud compute addresses create network-lb-ip-1 \
--region europe-west1
@r3xakead0
r3xakead0 / lb-backend.sh
Created November 10, 2025 17:15
Create a HTTP load balancer in GCP
# Set default region and zone
gcloud config set compute/region europe-west1
gcloud config set compute/zone europe-west1-b
# Create an instance template
gcloud compute instance-templates create lb-backend-template \
--region=europe-west1 \
--network=default \
--subnet=default \
--tags=allow-health-check \
@r3xakead0
r3xakead0 / index.html
Created October 19, 2025 21:51
Ejemplo de una página web sencilla con HTML, CSS y JS
<!doctype html>
<html lang="es">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Ejemplo: index.html con CSS y JS</title>
<style>
/* CSS embebido: estilos simples */
:root{
--bg: #f7f9fc;
@r3xakead0
r3xakead0 / spot-http-stress.sh
Created October 9, 2025 20:34
Create a low-cost EC2 Spot instance that runs your stress tests and is automatically deleted. This stress test involves generating multiple requests to a URL and monitoring the results of these tests and saving them to a file.
#!/usr/bin/env bash
set -euo pipefail
############# PARÁMETROS EDITABLES #############
REGION="${REGION:-us-east-1}" # cambia si quieres
INSTANCE_TYPE="${INSTANCE_TYPE:-t3.small}" # barato y suficiente p/HTTP
SPOT_MAX_PRICE="${SPOT_MAX_PRICE:-}" # vacío = precio spot on-demand cap (recomendado)
SECURITY_GROUP_NAME="${SECURITY_GROUP_NAME:-spot-http-stress-sg}"
IAM_ROLE_NAME="${IAM_ROLE_NAME:-EC2SpotStressS3Role}"
INSTANCE_PROFILE_NAME="${INSTANCE_PROFILE_NAME:-EC2SpotStressS3Profile}"
@r3xakead0
r3xakead0 / Install-azure-functions-core-tools.sh
Last active February 19, 2024 01:31
Install Azure Functions Core Tools on Linux Ubuntu
# Download and install the Microsoft signing key
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
# Add to software repository
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list'
# Update repository information and install package
sudo apt-get update
sudo apt-get install azure-functions-core-tools-4 -y
@r3xakead0
r3xakead0 / Install-azure-cli.sh
Created February 11, 2024 04:47
Install Azure Client on Linux Ubuntu
# Get packages needed for the installation process
sudo apt-get update
sudo apt-get install ca-certificates curl apt-transport-https lsb-release gnupg -y
# Download and install the Microsoft signing key
sudo mkdir -p /etc/apt/keyrings
curl -sLS https://packages.microsoft.com/keys/microsoft.asc |
gpg --dearmor |
sudo tee /etc/apt/keyrings/microsoft.gpg > /dev/null
sudo chmod go+r /etc/apt/keyrings/microsoft.gpg