num2words is available on Ubuntu and friends:
sudo apt install python3-num2words
Else:
pip install --user num2words
num2words is available on Ubuntu and friends:
sudo apt install python3-num2words
Else:
pip install --user num2words
We have two machines: master and agent. The goal is for agent to ssh into master, allocating a local port on master which forwards to a port on agent.
In this example, we'll use ssh - but that's arbitrary. The "master" is lightning
and the "agent" is fabulinus
.
First: open the ssh connection:
sauer@fabulinus:~$ ssh -Nf -R 10022:localhost:22 lightning
This will fork ssh into the background (-f
) and not run a program (-N
). Thus, it's just forwarding the port and nothing else.
#!/bin/bash | |
ORG=Kong | |
declare -A externals | |
printf "repo,user,external?\n" | |
for REPO in $(gh api --paginate "/orgs/$org/repos?type=public&sort=full_name&per_page=100" \ | |
| jq -r '.[] | select( .fork == false ) | .name') | |
do | |
echo "processing $REPO" >&2 |
autoscaler logs
kubectl -n kube-system logs --selector="app.kubernetes.io/name=aws-cluster-autoscaler"
#!/usr/bin/perl | |
use warnings; | |
use strict; | |
use Carp; | |
use DateTime; | |
use Date::Parse qw( str2time ); | |
use JSON qw( decode_json ); | |
# legacy ingress log examples: |
One-liner to accept incoming http POST data and then relay it to some number of POST endpoints.
while true; do printf 'HTTP/1.0 200 OK\r\nContent-Length: 0\r\n' | { nc -q1 -l 8080; echo; } | sed '0,/^[[:space:]]*$/d' | tee >(http POST http://localhost:8081/path1) >(http POST http://localhost:8081/path2); done
With some linebreaks so it's readable:
while true
do
# put this in your ~/.bashrc | |
function kubectlgetall { | |
kubectl -n ${1:?usage: ${FUNCNAME[0]} <namespace>} get --ignore-not-found $( \ | |
kubectl api-resources --verbs=list --namespaced -o name \ | |
| grep -v --line-regexp -e "events.events.k8s.io" -e "events" \ | |
| sort -u \ | |
| paste -sd, \ | |
) | |
} |
Upgrade Hassbian installation to Debian Bullseye in order to get python 3.9
Update OS. Follow another guide, except also remember to update all of the other /etc/apt/sources.list.d/ files too. :) Note that there is no hassbian-scripts repo for bullseye, so just leave that one at buster. https://www.tomshardware.com/how-to/upgrade-raspberry-pi-os-to-bullseye-from-buster
Update hassbian-scripts, which likely got removed at the automremove step - removing your systemd unit and all sorts of other things. The scripts package available on gitlab is broken, but there's a fork with a few fixes (primarily python package deps).
git clone https://github.com/dannysauer/hassbian-scripts.git
cd hassbian-scripts
✔ /tmp/testrepo [main L|✔] | |
10:04 $ sed -n '/alias/,$p' .git/config | |
[alias] | |
show-tag-date = tag --list --format "%(taggerdate:unix)" | |
flux-latest-stage-tag = describe --abbrev=0 --tags --match 'stage/*' main | |
flux-latest-prod-tag = describe --abbrev=0 --tags --match 'prod/*' main | |
flux-state = show --oneline --no-patch main stage prod | |
# git flux-rollback [stage|prod] | |
flux-rollback = "!git branch -f $1 $( git describe --abbrev=0 --tags --match="$1/*" ${1}^ ) && git tag -m \"rollback $1\" ${1}/$(date +'%F-%H-%M-%S')/rollback $1 #" | |
flux-stage = !git tag -m 'promote to stage' stage/$(date +'%F-%H-%M-%S') refs/heads/main && git branch -f stage $( git flux-latest-stage-tag ) |
#!/usr/bin/env python3 | |
import random | |
from base64 import b64encode | |
from kubernetes import client, config | |
from string import ascii_letters | |
from timeit import timeit | |
config.load_kube_config() | |
v1 = client.CoreV1Api() |