Skip to content

Instantly share code, notes, and snippets.

from kubernetes import client, config
import logging
import sys
import re
logger = logging.getLogger()
handler = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter('%(asctime)s [%(name)-12s] %(levelname)-8s %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)

how to sign 3th party binaries on MacOS with Gon

Gon is a tool to manage code signing without Apples Xcode app withing the Apple Developer portal. There are alreay a good explanation in the project repo. To verify here the step by step procedure

  1. Download and install the program with brew:
$ brew tap mitchellh/gon
$ brew install mitchellh/gon/gon
@alicek106
alicek106 / prometheus-simple.yaml
Last active May 1, 2021 02:21
prometheus-simple.yaml
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
labels:
owner: alicek106
name: prometheus
namespace: default
spec:
alerting:
alertmanagers:
@raghav4
raghav4 / Ansicolor.md
Created February 8, 2020 07:17
Color codes for console using Ansi
@superseb
superseb / restore-rkestate-file.md
Last active September 9, 2024 14:53
Recover cluster.rkestate file from controlplane node

Recover cluster.rkestate file from controlplane node

RKE

Run on controlplane node, uses any found hyperkube image

k8s 1.19 and higher

docker run --rm --net=host -v $(docker inspect kubelet --format '{{ range .Mounts }}{{ if eq .Destination "/etc/kubernetes" }}{{ .Source }}{{ end }}{{ end }}')/ssl:/etc/kubernetes/ssl:ro --entrypoint bash $(docker inspect $(docker images -q --filter=label=org.opencontainers.image.source=https://github.com/rancher/hyperkube.git) --format='{{index .RepoTags 0}}' | tail -1) -c 'kubectl --kubeconfig /etc/kubernetes/ssl/kubecfg-kube-node.yaml -n kube-system get configmap full-cluster-state -o json | jq -r .data.\"full-cluster-state\" | jq -r .' > cluster.rkestate
@Ryanb58
Ryanb58 / install.md
Last active October 4, 2024 11:11
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
@theMiddleBlue
theMiddleBlue / DNSBL.conf
Last active November 4, 2023 23:35
Nginx Lua DNSBL
# Configuration
# --------------
# Comment the following line if you are not behind a proxy_pass or load balancer
set $dnsbl_clientip $remote_addr;
# Uncomment if the client IP is on X-Forwarded-For
#set $dnsbl_clientip $http_x_forwarded_for;
# Uncomment if you are using CloudFlare
@kvudata
kvudata / label-ns.yaml
Created June 27, 2018 20:20
Use Helm hook to add labels to a namespace before chart installation
# This hook depends on helm creating the target namespace if it doesn't exist
# before the hook is called. This is the case on Helm v2.9.1
apiVersion: batch/v1
kind: Job
metadata:
name: label-ns
namespace: kube-system
labels:
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
@mholt
mholt / macapp.go
Last active November 8, 2024 20:51
Distribute your Go program (or any single binary) as a native macOS application
// Package main is a sample macOS-app-bundling program to demonstrate how to
// automate the process described in this tutorial:
//
// https://medium.com/@mattholt/packaging-a-go-application-for-macos-f7084b00f6b5
//
// Bundling the .app is the first thing it does, and creating the DMG is the
// second. Making the DMG is optional, and is only done if you provide
// the template DMG file, which you have to create beforehand.
//
// Example use:
@acobaugh
acobaugh / git-crypt-list-keys.sh
Created September 29, 2017 15:23
List git-crypt gpg keys
for key in .git-crypt/keys/default/0/* ; do gpg -k $(echo $(basename $key) | sed -e 's/.gpg//') ; done ;