Skip to content

Instantly share code, notes, and snippets.

@usrbinkat
usrbinkat / README.md
Created June 13, 2024 18:53
Delete Stuck Namespace

Delete Stuck Namespace

Here be dragons. Use with extreme caution.

About

This script is designed to accept namespaces as a list of arguments and will perform a namespace child resource delete loop before terminating the namespace and any finalizers.

Motivation

@AlexBaranowski
AlexBaranowski / centos-stream-8-vault-repos.sh
Last active October 11, 2025 15:56
Replace CentOS Stream 8 repos with CentOS Stream 8 VAULT repos
cat > /etc/yum.repos.d/CentOS-Stream-AppStream.repo << EOF
# CentOS-Stream-AppStream.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
@yorickdowne
yorickdowne / yawn.md
Last active April 29, 2026 10:35
Debian 12 bookworm upgrade

Debian 12 "Bookworm"

On systems with more than one EFI partition, such as systems set up for RAID with mdadm, grub-efi only upgrades one of the EFI partitions, the one mounted to /boot/efi. Because Debian 12 does not change the grub version from Debian 11, this does not cause boot failures. Discussion here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1135137
See the Debian 13 gist for a way to verify EFI before rebooting, and upgrading the second copy, if having only one EFI copy upgraded offends your sensibilities

To start, read the official release notes.

@sergsoares
sergsoares / Makefile
Created April 11, 2023 00:12
Makefile for select specific resource inside a main.tf
target:
SELECTED=`cat main.tf | grep resource | tr -d '"' | awk '{ print $$2 "." $$3 }' | fzf` ; \
terraform apply -target=$$SELECTED
@Ocramius
Ocramius / handling-optional-input-fields-with-type-safe-abstractions.md
Last active January 22, 2025 09:32
Handling optional input parameters in PHP with `vimeo/psalm` and `azjezz/psl`

Handling optional input parameters in PHP with vimeo/psalm and azjezz/psl

I had an interesting use-case with a customer for which I provide consulting services: they needed multiple fields to be marked as "optional".

Example: updating a user

We will take a CRUD-ish example, for the sake of simplicity.

For example, in the following scenario, does a null $description mean "remove the description",

using OpenTelemetry;
using OpenTelemetry.Logs;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
var appResourceBuilder = ResourceBuilder.CreateDefault()
.AddService(serviceName: Telemetry.ServiceName, serviceVersion: Telemetry.ServiceVersion);
@yodermk
yodermk / centos8-9.sh
Created February 13, 2022 19:08
Commands to live-upgrade CentOS Streams 8 -> 9
# The general procedure here is adapted from the 7->8 guide here. https://www.tecmint.com/upgrade-centos-7-to-centos-8/
#
# It is a curated list of my bash history. I entered other commands so hopefully I got the right ones here.
yum upgrade
reboot
dnf install epel-release
dnf install rpmconf
dnf install yum-utils
rpmconf -a # answer "n" to both things
@thomasdarimont
thomasdarimont / app.py
Last active May 6, 2025 12:40
Example for a simple Python flask webapp that uses Authlib to act as an OpenID Connect client for Keycloak
import json
import os
import certifi
import requests
from authlib.oauth2.rfc6749 import OAuth2Token
from flask import Flask, url_for, session
from flask import render_template, redirect
from authlib.integrations.flask_client import OAuth, token_update
@degitgitagitya
degitgitagitya / .env
Last active February 8, 2026 13:01
Next JS + Next Auth + Keycloak + AutoRefreshToken
# KEYCLOAK BASE URL
KEYCLOAK_BASE_URL=
# KEYCLOAK CLIENT SECRET
KEYCLOAK_CLIENT_SECRET=
# KEYCLOAK CLIENT ID
KEYCLOAK_CLIENT_ID=
# BASE URL FOR NEXT AUTH
@frankdejonge
frankdejonge / paginated-generator.php
Created May 25, 2021 18:12
Generate use-case: paginated API call example
<?php
/**
* Imagine this is an API call
*/
function listPage(int $i): array
{
$next = $i >= 9 ? null : $i + 1;
return ['cursor' => $next, 'items' => array_fill(0, 5, $i)];
}