Skip to content

Instantly share code, notes, and snippets.

View korutx's full-sized avatar
💻
PMF

Michel David korutx

💻
PMF
View GitHub Profile
@korutx
korutx / count-node-gke-autopilot.mql
Created December 14, 2024 17:48
Count Total Nodes GKE Autopilot
fetch k8s_node
| ${project_id_var}
| ${cluster_name_var}
| metric kubernetes.io/node/cpu/allocatable_cores
| align next_older(2m)
| group_by [resource.location], .count()
@korutx
korutx / kgpwc.sh
Created December 14, 2024 17:03
Kubectl get pods sorted and colored by node
#!/bin/bash
# Script to display Kubernetes pods grouped and color-coded by node
kubectl get pods -o wide | sort -k7 | awk '
BEGIN {
# Define ANSI color codes for groups
colors[1] = "\033[1;31m"; # Red
colors[2] = "\033[1;32m"; # Green
colors[3] = "\033[1;33m"; # Yellow
colors[4] = "\033[1;34m"; # Blue
@korutx
korutx / yt-get-transcription.js
Created September 30, 2024 19:39
Obtener transcripción de youtube via browser console
a = document.querySelectorAll('.segment-text')
b = [...a]
c = b.map(e => e.innerText).join('\n')
console.log(c)

Change Persistent Volume Reclaim Policy to Retain

This gist demonstrates how to change the reclaim policy of a Persistent Volume (PV) in Kubernetes from "Delete" to "Retain".

Prerequisites

  • kubectl configured to your cluster
  • Proper permissions to modify PV resources

Commands

@korutx
korutx / Upgrading kube-prometheus-stack.md
Last active September 10, 2024 14:48
Upgrading prometheus-community/kube-prometheus-stack

Upgrading prometheus-community/kube-prometheus-stack

This guide outlines the steps to upgrade the Prometheus stack in a Kubernetes cluster.

Prerequisites

  • Helm 3 installed
  • kubectl configured to your cluster
  • Proper permissions to modify resources in the monitoring namespace

Steps

@korutx
korutx / disconnected-gh-pages-branch.sh
Created September 9, 2024 14:55
Create a disconnected git branch
#!/bin/bash
# Create a disconnected git branch for GitHub Pages
# Clone the repository without checking out files
git clone --no-checkout https://github.com/yourusername/yourrepo.git
cd yourrepo
# Create a new orphan branch
git checkout --orphan gh-pages
@korutx
korutx / pyzen.py
Created July 22, 2020 13:31
fun pyzen code!
#!/usr/bin/python3
import string
import codecs
import random
s = """Ornhgvshy vf orggre guna htyl.
Rkcyvpvg vf orggre guna vzcyvpvg.
Fvzcyr vf orggre guna pbzcyrk.
Pbzcyrk vf orggre guna pbzcyvpngrq.
@korutx
korutx / patch-configure-devserver.sh
Last active May 29, 2020 03:38
Patch Create Elm App. Allows to configure devserver from elmapp.config.
#!/bin/bash
# die () {
# echo >&2 "$@"
# exit 1
# }
# v=4.2.24
# [ "$v" = "4.2.24" ] ||
# die "Patch solo puede aplicarse a [email protected], se encontro $v"
# usage: curl 'https://gist.githubusercontent.com/korutx/27f9b7d8fd2f141002c6922456d73ab9/raw/a1c05d17069acb64893066c725202c79e9c6a4db/patch-configure-devserver.sh' | bash /dev/stdin ~/.nvm/versions/node/v13.9.0/lib/node_modules
nmpath="$1"
@korutx
korutx / flatten.js
Last active October 25, 2018 14:11
/**
* Hight-Order Funcion
* Returns a single item by iterating through the list, successively calling the iterator function and passing it an accumulator value and
* the current value from the array, and then passing the result to the next call.
* @param {Array} list Array of element
* @param {Function} fn Functor. The iterator function. Receives two values, the accumulator and the current element from the array.
* @param {*} acc The accumulator value.
* @return {*} The final, accumulated value.
*/
const reduce = (list, fn, acc) => {
@korutx
korutx / custom-bash-prompt-git-kubectl.sh
Last active June 1, 2018 20:21
Custom Prompt for git and kubectl useful info. fast and pragmatic version.
#!/bin/sh
# @Author: @korutx
# @Date: 2018-05-31 12:18:34
# @Last Modified time: 2018-05-31 12:18:34
#
# Using: Add the following lines to .bashrc
#
# if [ -f ~/bin/my_prompt.sh ]; then
# . ~/bin/my_prompt.sh
# fi