Skip to content

Instantly share code, notes, and snippets.

View gbrayut's full-sized avatar
👨‍💻
Living life one byte at a time

Greg Bray gbrayut

👨‍💻
Living life one byte at a time
View GitHub Profile
@gbrayut
gbrayut / kcc-gke-kms-cmek.yaml
Created December 12, 2022 20:18
KCC GKE KMS KMSCryptoKey bootDiskKMSCryptoKeyRef
# config-connector export //cloudkms.googleapis.com/projects/gregbray-kms/locations/us-central1/keyRings/my-key-ring
apiVersion: kms.cnrm.cloud.google.com/v1beta1
kind: KMSKeyRing
metadata:
annotations:
cnrm.cloud.google.com/project-id: gregbray-kms
cnrm.cloud.google.com/deletion-policy: abandon
name: my-key-ring
spec:
location: us-central1
@gbrayut
gbrayut / testing.sh
Last active July 8, 2022 18:58
systemd-nspawn latency
$ uname -a;systemctl --version
Linux gbmint02 5.4.0-113-generic #127-Ubuntu SMP Wed May 18 14:30:56 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
systemd 245 (245.4-4ubuntu3.17)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid
$ sudo machinectl pull-tar http://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64-root.tar.xz
$ time /bin/sh -c 'ls /sys/fs/cgroup >/dev/null'
real 0m0.006s
user 0m0.003s
# The manifest below setups up a simple upload server behind gke ingress. Easiest to test from Cloud Shell or another GCE VM
# But there does seem to be a timeout/slowloris mitigation so testing with real world upload speeds is also recommended
# Also, the "right" way to do this is chunked uploads and/or direct to GCS signed URLs.
# But so far I don't see a reason why GCLB HTTPS LBs wouldn't work
# Download test files from http://xcal1.vodafone.co.uk/
curl -vsF file=@5MB.zip http://34.111.109.144:80/upload?token=1234
curl -vsF file=@50MB.zip http://34.111.109.144:80/upload?token=1234
curl -vsF file=@200MB.zip http://34.111.109.144:80/upload?token=1234
@gbrayut
gbrayut / 00-test-istio.yaml
Created June 17, 2022 21:24
istio testing
# https://istio.io/latest/docs/reference/config/networking/service-entry/
apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
name: test-service-entry
namespace: testing
spec:
hosts:
- test.service # for host header matching
addresses:
@gbrayut
gbrayut / Reddit-Desktop.user.css
Last active March 4, 2022 19:55
Fix various issues with the Reddit Redesign
/*
TODO: add header like from https://raw.githubusercontent.com/pyxelr/Dark_Google_Calendar/master/Google-DarkCalendar.user.css
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors
https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors
#\32 x-container > div:nth-child(1) > div:nth-child(2)
#SHORTCUT_FOCUSABLE_DIV > div.subredditvars-r-sofistock
#SHORTCUT_FOCUSABLE_DIV div.ListingLayout-outerContainer
@gbrayut
gbrayut / signal_handle.sh
Last active August 17, 2021 18:11
Checking signal handling in containers
# Dockerfile run and has two formats... see https://docs.docker.com/engine/reference/builder/#run
RUN <command> # (shell form which by default is /bin/sh -c ...)
RUN ["executable", "param1", "param2"] # (exec form... not wrapped in a shell)
# Same for entrypoint https://docs.docker.com/engine/reference/builder/#entrypoint
ENTRYPOINT command param1 param2 # (shell form https://docs.docker.com/engine/reference/builder/#shell-form-entrypoint-example )
ENTRYPOINT ["executable", "param1", "param2"] # (exec form https://docs.docker.com/engine/reference/builder/#exec-form-entrypoint-example )
# and cmd https://docs.docker.com/engine/reference/builder/#cmd
CMD command param1 param2 # (shell form)
@gbrayut
gbrayut / darkmode-github-docs.usercss.js
Created May 12, 2021 03:32
Github Docs Force Dark Mode
// ==UserScript==
// @name Github Docs Force Dark Mode
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Force Dark Mode
// @author GBrayUT
// @match https://docs.github.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// @run-at document-start
@gbrayut
gbrayut / 01-setup-LXD.sh
Last active August 16, 2019 16:53
Docker in LXD
exit #Not that kind of script, these sections should be run manually
# First get lxd working
# Install lxc/lxd. On ubuntu 18.04 I'm using snap to install lxd https://docs.snapcraft.io/installing-snapd/6735
sudo apt install snapd
sudo snap install lxd # https://mangolassi.it/topic/18073/installing-lxd-on-ubuntu-18-04-the-right-way
# Using ZFS for container storage makes it easy to move things around
sudo apt-get install zfsutils-linux
@gbrayut
gbrayut / backup.sh
Last active April 14, 2019 01:22
Quick Backup Scripts
cd /data/Backups/gbmint02/
sudo tar -zcvf "etc_$(date +"%F").tar.gz" /etc
sudo tar -zcvf "run_$(date +"%F").tar.gz" /run
sudo tar -zcvf "root_$(date +"%F").tar.gz" /root
sudo tar -zcvf "var_$(date +"%F").tar.gz" /var
sudo tar --exclude="$HOME/.cache" --exclude="$HOME/.config.old" --exclude="$HOME/Dropbox" --exclude="$HOME/code/go/pkg" -zcvf "${SUDO_USER}_$(date +"%F").tar.gz" $HOME
$ snap list
@gbrayut
gbrayut / Corefile
Last active March 19, 2021 15:06
Coredns using Docker
home.arpa {
file config/home.arpa
prometheus # enable metrics
errors # show errors
log # enable query logs
}