Skip to content

Instantly share code, notes, and snippets.

View lsjostro's full-sized avatar
:shipit:

Lars Sjöström lsjostro

:shipit:
View GitHub Profile
apiVersion: v1
kind: Service
metadata:
labels:
app: kube-prometheus-stack-coredns
app.kubernetes.io/instance: kube-prometheus-stack
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/part-of: kube-prometheus-stack
app.kubernetes.io/version: 55.0.0
chart: kube-prometheus-stack-55.0.0
packer {
required_plugins {
proxmox-iso = {
version = ">= 1.1.5"
source = "github.com/hashicorp/proxmox"
}
}
}
variable "pve_node" {
doas docker run --privileged --rm tonistiigi/binfmt --install all
doas docker run --rm -it --platform linux/arm64 --privileged -v $PWD:/vyos --sysctl net.ipv6.conf.lo.disable_ipv6=0 -e GOSU_UID=$(id -u) -e GOSU_GID=$(id -g) vyos/vyos-build:current-arm64 bash
$ ./build-vyos-image iso --architecture arm64 --build-by "Shelman group" --custom-apt-entry "deb [arch=arm64] https://repos.influxdata.com/debian bullseye stable" --custom-apt-key $PWD/influxdata-archive_compat.key --custom-package "cloud-utils vyos-linux-firmware"
@lsjostro
lsjostro / talos-geniso-nocloud.sh
Last active May 6, 2023 17:22
talos iso convert to nocloud platform
docker run --rm -i -w /work -v "$PWD":/work --entrypoint sh ghcr.io/siderolabs/imager:v1.4.0 -c '
installer iso --arch amd64 --output . &&
xorriso -osirrox on -indev ./talos-amd64.iso -extract / /tmp &&
rm -f ./talos-amd64.iso &&
sed -i 's/talos.platform=metal/talos.platform=nocloud/g' /tmp/boot/grub/grub.cfg &&
grub-mkrescue --compress=xz --output=./talos-amd64-nocloud.iso /tmp'
@lsjostro
lsjostro / buf-protoc-plugin-local-exec.sh
Last active February 7, 2023 20:49
buf.build protoc local exec using container images from custom registry
#!/usr/bin/env bash
# Symlink this script as ./protoc-gen-<plugin-name>.
# container images should be built as protoc-gen-<plugin-name>
# make sure `buf` is installed and available in your PATH as well
# as this script and the symlinks. Works both with docker and podman.
# podman is preferred if both are available. (podman is preferred in CI environments)
#
# Example buf.gen.yaml:
# ---
# version: v1
#!/usr/bin/env bash
set -e -o pipefail
gdbus call --session --dest org.gnome.Shell.Screenshot --object-path /org/gnome/Shell/Screenshot --method org.gnome.Shell.Screenshot.PickColor |
sed 's#.*: <(\([0-9].[0-9]*\), \([0-9].[0-9]*\), \([0-9].[0-9]*\).*#{"r":\1, "g":\2, "b":\3 }#' |
jq -r '{r:(.r*255),g:(.g*255),b:(.b*255)}| join(" ")' |
xargs printf "#%x%x%x\n" | xclip -selection clipboard
#!/usr/bin/env bash
#
# Summary: Create pyright config file in current directory
#
set -e
[ -n "$PYENV_DEBUG" ] && set -x
PYRIGHT_FILENAME='pyrightconfig.json'
create_new_file() {
@lsjostro
lsjostro / gcb-slack-notifty-cloud-function.go
Created December 8, 2021 08:30
Cloud function listening on a pubsub cloud-build pubsub topic for GCB run events and notify on slack
package main
import (
"context"
"encoding/base64"
"encoding/json"
"fmt"
"net/http"
"strings"
#!/usr/bin/python
import sys
import time
import socket
import urllib2
def main(haproxy_host, statsd_host):
s = socket.socket(socket.AF_INET,
socket.SOCK_DGRAM)
@lsjostro
lsjostro / changesets.groovy
Created April 20, 2016 08:33
Jenkinsfile: build only changed files
#!groovy
@NonCPS
def getACIChangeSets() {
def aci = []
currentBuild.rawBuild.getChangeSets().each { cs ->
cs.getItems().each { item ->
item.getAffectedFiles().each { f ->
if (f.path.endsWith(".yml")) {
aci << f.path
}