Skip to content

Instantly share code, notes, and snippets.

@tom1299
tom1299 / README.md
Created March 15, 2026 06:40
Claude code wrong answer on script instructions

Should have given me correct answer directly:

claude-playground$ cat ignreod-claude-md.txt 
╭─── Claude Code v2.1.74 ──────────────────────────────────────────────────────╮
│                                                    │ Tips for getting        │
│                Welcome back Thomas!                │ started                 │
│                                                    │ Run /init to create a … │
│                       ▐▛███▜▌                      │ ─────────────────────── │
│                      ▝▜█████▛▘                     │ Recent activity         │
│                        ▘▘ ▝▝                       │ No recent activity      │
@tom1299
tom1299 / README.md
Created February 23, 2026 07:53
Deployment needs scale to 0 in order to secret update to be reflected

Rollout restart not enough for secret being updated

When changing the secret (delete and apply since immutable) in the above example, the changes are only reflected when the deployment is being scaled to 0. A rollout restart is not sufficient.

kubectl delete secrets db-con   # Delete the secret then change it in file
kubectl apply -f deployment.yaml   # Apply changes => Secret should be changed
kubectl exec app-green-sky-6d4f7f898c-h4d88 -- env  # Displays old values (expected)
kubectl rollout restart deployment app-green-sky
kubectl exec app-green-sky-696fb875f-2n8nn -- env # Still displays old values (unexpected)
@tom1299
tom1299 / commands.txt
Created January 1, 2025 09:34
Install reloader with delayed upgarde for testing with echo-values helm chart
kind create cluster
export ARCH=amd64
make build-image
podman tag ghcr.io/stakater/reloader:v0.0.1-amd64 localhost/stakater/reloader:v0.0.23-amd64
podman save -o image.tar localhost/stakater/reloader:v0.0.23-amd64
@tom1299
tom1299 / python_collections.py
Last active November 21, 2022 10:29
A short explanation of python collections and numpy arrays
import numpy as np
# A List is a collection which is ordered and changeable.
# In Python lists are written with square brackets: [1,2,3,4,5]
numbers_as_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# A NumPy array is a collection which is ordered and changeable.
# Numpy arrays must contain elements of the same type.
numbers_as_numpy_array = np.array(numbers_as_list)
@tom1299
tom1299 / query.txt
Created October 21, 2022 10:12
A query for calculating the average running time of a job in a GitLab pipeline.
db.pipelines.aggregate([
{
$unwind: "$jobs"
},
{
$group: {
_id: {
"project": "$project_id",
"jobName": "$jobs.name"
},
@tom1299
tom1299 / .gitlab-ci.yml
Created April 28, 2022 06:26
Setup Kind in a GitLab CI/CD pipeline
stages:
- test
test:
image: tom1299/docker:20.10.14-dind
services:
- name: tom1299/docker:20.10.14-dind
stage: test
before_script:
- kind create cluster --wait 5m --config=./config.yaml
import re
import yaml
def find(element, dictionary):
"""
Find a value given a path like a.b.c
"""
keys = element.split('.')
rv = dictionary
for key in keys:
@tom1299
tom1299 / Add methods to a class programmatically in python
Last active March 4, 2022 13:47
How to add a method to a class in code using python
class Greeter:
pass
def create_greeting(name: str):
def greeting_method(self):
return print(f"Greetings {name}")
greeting_method.__name__ = f"greetings{name}"
return greeting_method
@tom1299
tom1299 / export_yaml_definition_k8s_deyploment.md
Last active December 23, 2019 13:41
Export yaml definition of k8s deployment

Export yaml definition of k8s deployment

The motiviation for this gist was the deprecation of the --export flag. Having the yaml definition of a running deployment has the advantage that it can be saved and edited. For example when updating the version of an image.

Obtaining the current definition

For this example we will just use a deployment of the Kubernetes Deployment documentation. This can be deployed using the command

kubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml

To get the yaml definition the get command can be used:

@tom1299
tom1299 / openUrlWithProxy.groovy
Created May 3, 2018 13:18
Open url in groovy using a http proxy
setProxies("http");
setProxies("https");
println 'http://www.google.com'.toURL().text
def setProxies(String protocol) {
String port = new URI(System.getenv("${protocol}_proxy")).port
String host = new URI(System.getenv("${protocol}_proxy")).host
System.setProperty("http.proxyHost", host);