Skip to content

Instantly share code, notes, and snippets.

@mcastelino
mcastelino / README.md
Created Dec 13, 2021 — forked from smoser/README.md
qemu to linux mapping of smbios / dmi information
View README.md

Mappings for DMI/SMBIOS to Linux and dmidecode

Information can be put into dmi tables via some qemu-system hosts (x86_64 and aarch64). That information is exposed in Linux under /sys/class/dmi/id and can be read with dmidecode. The names are very annoyingly inconsistent. The point of this doc is to map them.

Mappings

Example qemu cmdline:

qemu-system-x86_64 -smbios type=<type>,field=value[,...]

qemu-system-x86_64 -smbios type=0,vendor=superco,version=1.2.3
@mcastelino
mcastelino / .gitignore
Created May 21, 2021 — forked from smoser/.gitignore
cloud-init ubuntu nocloud example with network config
View .gitignore
*.img
*.raw
@mcastelino
mcastelino / acyclic_generic.go
Last active Mar 31, 2021
Golang Generics Acyclic Function Graph
View acyclic_generic.go
package main
import (
"fmt"
)
// Data that flows through the processing pipeline
type Data[T any] struct {
Type string
Path string
@mcastelino
mcastelino / acyclic.go
Last active Mar 30, 2021
Golang: Create a Acyclic function graph
View acyclic.go
package main
import (
"fmt"
)
// Data that flows through the processing pipeline
type Data struct {
Type string
Data string
@mcastelino
mcastelino / prom_relabel.md
Created Dec 14, 2020
Kubernetes Pod Monitors & Re-Labeling
View prom_relabel.md

Kubernetes Pod Monitors & Re-Labeling

The Prometheus operator offers a simple method to scrape metrics from any Pod. However in many cases the Pod itself is not what you are monitoring but the Pod is used to expose metrics that relate to the Node. In such cases what the user cares about is the Node on which the Pod runs and not the Pod itself.

By default when using PodMonitor all the time series data will have the instance set to the Pod's name. Also the Pod or the Daemon set that the Pod was part of may be deleted, redeployed multiple times over the lifetime of the node. This means that the user will need to perform the mapping between the Pod and the Node on which it run.

However Prometheus allows the instance name (among other labels) to be relabeled in a very simple manner as shown below.

apiVersion: monitoring.coreos.com/v1
@mcastelino
mcastelino / el.yml
Created Dec 5, 2020
Simple Elastic Search docker compose
View el.yml
version: '2.2'
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.1
container_name: es01
environment:
- node.name=es01
- cluster.name=es-docker-cluster
- cluster.initial_master_nodes=es01
- bootstrap.memory_lock=true
@mcastelino
mcastelino / prometheus_fluentd_pod_monitor.md
Created Feb 3, 2020
Prometheus - POD Monitor for Fluentd
View prometheus_fluentd_pod_monitor.md
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: fluentd-es
  labels:
    k8s-app: fluentd-es
spec:
 selector:
@mcastelino
mcastelino / pi-hole-unifi-cloud-key.md
Last active Sep 24, 2022
How to upgrade Unifi Cloud Key 2 Firmware with Pi Hole
View pi-hole-unifi-cloud-key.md

Last verified with

    Pi-hole v5.1.2 Web Interface v5.1.1 FTL v5.2
    Cloud Key firmware UCKG2.apq8053.v1.1.13.818cc5f.200430.0938

Instructions

  • Change all your networks to use 1.1.1.1 or some other upstream DNS so that you still have DNS resolution working once the firmware upgrade completes
    • Alternately, setup all your networks to have a secondary upstream DNS. While not ideal, will help with a seamless update process
  • Upgrade the firmware on the cloud-key
@mcastelino
mcastelino / fc_ci_kata.md
Last active Jul 10, 2019
Running firecracker CI
View fc_ci_kata.md
export KATA_DEV_MODE="false"
export KATA_HYPERVISOR="firecracker"
export CI="true"
export CI_JOB="FIRECRACKER"
export RUNTIME="kata-runtime"
export PATH=${GOPATH}/bin:${PATH}
DEBUG=true .ci/setup.sh
sudo -E PATH=$PATH make docker