Skip to content

Instantly share code, notes, and snippets.

@dazzag24
dazzag24 / k9s.txt
Created November 15, 2022 11:44 — forked from BigNerd/k9s.txt
K9s column descriptions
View: Pods(<namespace>)[number of pods listed]
NAME pod name
READY number of pods in ready state / number of pods to be in ready state
RESTARTS number of times the pod has been restarted so far
STATUS state of the pod life cycle, such as Running | ... | Completed
CPU current CPU usage, unit is milli-vCPU
MEM current main memory usage, unit is MiB
%CPU/R current CPU usage as a percentage of what has been requested by the pod
%MEM/R current main memory usage as a percentage of what has been requested by the pod
@dazzag24
dazzag24 / infra-secret-management-overview.md
Created January 28, 2022 16:48 — forked from maxvt/infra-secret-management-overview.md
Infrastructure Secret Management Software Overview

Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.

This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.

There is a companion feature matrix of various tools. Comments are welcome in the same manner.

# ~/.config/rclone/rclone.conf
# secret keys: https://docs.oracle.com/en-us/iaas/Content/Identity/Tasks/managingcredentials.htm#To4
[oracle_s3]
type = s3
provider = Other
access_key_id = <access_key_id - obtained from customer secret keys in oracle cloud web console>
secret_access_key = <secret_access_key - obtained from customer secret keys in oracle cloud web console>
endpoint = https://<namespace>.compat.objectstorage.<region>.oraclecloud.com
region = <region>
@dazzag24
dazzag24 / get_iplayer_series_download.sh
Created October 22, 2020 13:13
get_iplayer recursive download from iplayer URL
get_iplayer --tvmode=tvbetter --pid-recursive --get https://www.bbc.co.uk/iplayer/episodes/b006q2x0/doctor-who\?seriesId\=b00rs69w
@dazzag24
dazzag24 / rename.sh
Last active October 20, 2020 14:58
Rename TV episode files containing _1_-_3 pattern to S01E03 style
# Using the rename tool - note that this is unable to pad the series and episode to two digits
rename -n 's/^Blah_([0-9])_-_([0-9])\.([a-zA-Z_])/Blah_S$1E$2\.$3/' *.mp4
#rename(Blah_1_-_3._Foo_Bar_p01fmqt1_default.mp4, Blah_S1E3._Foo_Bar_p01fmqt1_default.mp4)
rename -n 's/^Orphan_Black_Series_([0-9])_-_([0-9])\.([a-zA-Z_])/Orphan_Black_Series_S$1E$2\.$3/' *.mp4
#rename(Orphan_Black_Series_1_-_1._Natural_Selection_p01fmqt1_default.mp4, Orphan_Black_Series_S1E1._Natural_Selection_p01fmqt1_default.mp4)
# Or using awk
ls Orphan_Black_Series_1_-_10._Endless_Forms_Most_Beautiful_b03fvlhc_default.mp4 | awk '{a=gensub( /^([^0-9]+)_Series_.*/, "\\1","1"); b=gensub( /^[^0-9]+_Series_([0-9]+).*/, "\\1","1"); c=gensub( /^[^0-9]+_Series_[0-9]+_-_([0-9]+).*/, "\\1","1");d=gensub( /^[^0-9]+_Series_[0-9]+_-_[0-9]+\.(.*)$/, "\\1","1")
;printf "a=%s\nb=%s\nc=%s\nd=%s\n", a,b,c,d}'
@dazzag24
dazzag24 / update-portainer.sh
Created October 14, 2020 17:41
Update portainer docker image
#!/bin/bash
set -euo pipefail
docker stop portainer
docker rm portainer
docker pull portainer/portainer-ce
docker run -d -p 8000:8000 -p 9000:9000 --name="Portainer" -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
@dazzag24
dazzag24 / proxy.rs
Created June 11, 2020 21:06 — forked from Plecra/proxy.rs
A smol proxy server
use anyhow::*;
use futures::io::{copy, AsyncReadExt, AsyncWriteExt};
use futures::stream::StreamExt;
use log::*;
use smol::Async;
use std::net;
const PORT: u16 = 5000;
@dazzag24
dazzag24 / multiprocess_restart_test.py
Created May 28, 2020 14:27
Maintain a pool of multiprocessing workers if any of them die or are killed
import time
import signal
import multiprocessing as mp
def worker(id):
while True:
print("Inside worker {}".format(id))
time.sleep(10)
def proc_stop(p_to_stop):
@dazzag24
dazzag24 / rename_with_file_date.sh
Created May 12, 2020 20:48
Rename files based on creation date of file
convert () {
local f=$1
echo "Processing ${f}"
local filedate=$( stat -c '%y' ${f} | awk -F"." '{print $1}' | awk -F" " '{printf "%s %s", $1, $2}' | sed 's/:/./g' - )
echo "${filedate}-${f}"
cp ${f} "../101MEDIA/${filedate}-${f}"
}
wget -r -p -U "Mozilla/5.0 (iPhone; CPU iPhone OS 12_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Mobile/15E148 Safari/604.1" https://www.example.com