Skip to content

Instantly share code, notes, and snippets.

@cloudygreybeard
cloudygreybeard / gist:c963dec0667594d6b8ab2ceec2ae973b
Last active January 4, 2026 21:26
go-12-days-generator-🎄
package main
import (
"fmt"
"strings"
)
func capitalise(s string) string {
if s == "" {
return s

Selected Prometheus Queries for Kubernetes Health Checks

1. Memory usage (%) on master nodes

Tip

(1 - sum by (instance) (node_memory_MemFree_bytes + node_memory_Buffers_bytes + node_memory_Cached_bytes and on (instance) label_replace(kube_node_role{role="master"}, "instance", "$1", "node", "(.+)")) / sum by (instance) (node_memory_MemTotal_bytes and on (instance) label_replace(kube_node_role{role="master"}, "instance", "$1", "node", "(.+)"))) * 100

[!NOTE]

// ==UserScript==
// @name Adjust Advanced Search Textarea Height in issues.redhat.com
// @namespace https://github.com/cloudygreybeard
// @version 0.1
// @description Adjust the height of the advanced search textarea in https://issues.redhat.com/
// @author phijones@redhat.com
// @match https://issues.redhat.com/*
// @grant none
// ==/UserScript==
@cloudygreybeard
cloudygreybeard / .gitconfig
Created March 6, 2025 03:12
.gitconfig aliases for decorated git log with graphs, colourisation, and prettiness levels: `git lg{,{1..3}}`
# Thanks to [Slipp D. Thompson](https://stackoverflow.com/a/34467298)
[alias]
lg = !git lg1
lg1 = !git lg1-specific --all
lg2 = !git lg2-specific --all
lg3 = !git lg3-specific --all
lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'
@cloudygreybeard
cloudygreybeard / temporary-ruff-fix-w605.sh
Last active March 28, 2025 16:45
azure-cli: Temporary relief from "SyntaxWarning: invalid escape sequence" (for macOS/brew/Silicon/azure-cli 2.70.0)
# Pending resolution of https://github.com/Azure/azure-cli/issues/28829 or https://github.com/Azure/azure-cli/issues/30440...
# example:
az login
# ...
# /opt/homebrew/Cellar/azure-cli/2.70.0/libexec/lib/python3.12/site-packages/deviceid/deviceid.py:9: SyntaxWarning: invalid escape sequence '\S'
# /opt/homebrew/Cellar/azure-cli/2.70.0/libexec/lib/python3.12/site-packages/deviceid/_store.py:6: SyntaxWarning: invalid escape sequence '\M'
# ...
brew install ruff
@cloudygreybeard
cloudygreybeard / .vimrc
Created March 6, 2025 00:29
Adding vim ⌘-c and ⌘-v keystrokes for macOS system clipboard access
vmap <C-c> y:call system("pbcopy", getreg("\""))<CR>
nmap <C-v> :call setreg("\"",system("pbpaste"))<CR>p
@cloudygreybeard
cloudygreybeard / greybeard
Created January 15, 2025 06:05 — forked from lenards/greybeard
Greybeard Definition
Greybeard
An aging [unix hacker] type with an impressive [unix beard] that has now turned grey. Originally a young [neckbeard], these [Gandalf] resembling [curmudgeons] are renowned for their knowledge of theoretical computer science, arcane unix and complete inability to use a remotely contemporary computer.
Typically employed in academia, they are a dying breed from an antediluvian age of 8" [floppies], magnetic tape and timeshared computing. Despite having invented multiuser OSes and the internet, Greybeards prefer to live in the past, where they consider [Fortran] to be a high level programming language. Typical Greybeard computers are dated [Sun workstations] or old PCs running a command line only [BSD] variant, Greybeards shun GUIs, unless they're horrible and dated, like CDE or [Amiga] Workbench.
Some, like Edsger Dijkstra do most of their computer science as entirely theoretical exercises on paper and haven't programmed a computer since 1972.
Contacting a gr