Skip to content

Instantly share code, notes, and snippets.

@qrkourier
qrkourier / krun
Last active April 15, 2023 21:33
run any command in any container image in any Kubernetes namespace
# krun busybox whoami
krun(){
local NAMESPACE=default
local PRIVILEGED=false
while getopts 'n:pu:' OPT; do
case $OPT in
n) NAMESPACE=$OPTARG
;;
p) PRIVILEGED=true
@codebykyle
codebykyle / connect.ps1
Last active May 8, 2024 04:07
Windows Terminal Split Pane Powershell Script - v2
using namespace System.Collections.Generic
# Encapsulate an arbitrary command
class PaneCommand {
[string]$Command
PaneCommand() {
$this.Command = "";
}
@yermulnik
yermulnik / tf_vars_sort.awk
Last active April 22, 2024 09:30
Sort Terraform (HCL) file by Resource Block Names using GNU `awk`
#!/usr/bin/env -S awk -f
# https://gist.github.com/yermulnik/7e0cf991962680d406692e1db1b551e6
# Tested with GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.2.0)
# Usage: /path/to/tf_vars_sort.awk < variables.tf | tee sorted_variables.tf
# Note: "chmod +x /path/to/tf_vars_sort.awk" before use
# No licensing; yermulnik@gmail.com, 2021-2023
{
# skip blank lines at the beginning of file
if (!resource_type && length($0) == 0) next
@bykvaadm
bykvaadm / README.md
Last active June 3, 2022 03:45
Postgres patron backup on Minio with prometheus monitoring

Скрипт не претендует на истину первой инстанции

Да, я знаю что есть способ ${the_best_pg_backup_method}

Это просто скрипт которым я поделился - хочешь пользуйся, не хочешь - иди мимо

@PatrLind
PatrLind / protect-kube-config.md
Created April 26, 2021 08:43
How to protect your ~/.kube/ configuration

How to protect your ~/.kube/ configuration

I had a need to protect my Kubernetes config file on my computer against accidental or malicious change or reading, so I came up with this way of protecting the config files.

How it works

The ~/.kube folder is mounted using encfs. By using the --ondemand flag it will automatically ask for the encryption key/password when accessed and keep

@m-radzikowski
m-radzikowski / script-template.sh
Last active May 4, 2024 04:13
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
$URI = [uri]'https://software-download.microsoft.com/download/sg/444969d5-f34g-4e03-ac9d-1f9786c69161/19044.1288.211006-0501.21h2_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-gb.iso'
$URI = [uri]'https://software-download.microsoft.com/db/Win10_21H2_English_x64.iso?t=f9f3df6c-feba-4bf8-ac99-0636e0aef143&e=1639004633&h=c846122b22c606dd744b83f9429955ab'
@spencerwooo
spencerwooo / termiWidget.js
Last active April 21, 2024 01:04
🍋 TermiWidget - Terminal-like Widget for iOS 14, made with Scriptable.
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: orange; icon-glyph: quote-right;
// Change these to your usernames!
const user = "spencer"
const jike = "4DDA0425-FB41-4188-89E4-952CA15E3C5E"
const telegram = "realSpencerWoo"
const github = "spencerwooo"
@srkiNZ84
srkiNZ84 / update_elb_certificate_letsencrypt_route53.sh
Last active August 17, 2021 15:21
Bash script to automate the renewal of LetsEncrypt certificates using DNS authentication with Route53 and then updating the load balancers
#!/usr/bin/bash
# pre-requisites:
# apt install python3-pip awscli
# pip3 install certbot certbot-dns-route53 awscli
# mkdir .certbot/{config,work,logs}
# IAM policy attached to EC2 instance with:
# - route53:ListHostedZones
# - route53:GetChange
# - route53:ChangeResourceRecordSets