Skip to content

Instantly share code, notes, and snippets.

View taxilian's full-sized avatar

Richard Bateman taxilian

View GitHub Profile
@taxilian
taxilian / extractCert.sh
Last active January 9, 2024 19:41
Helper to extract TLS certificates from a kubernetes TLS secret and write them to files, handy for client authentication certs
#!/bin/bash
TMPFILE=$(mktemp)
function cleanup {
echo "Deleting $TMPFILE..."
rm -rv "$TMPFILE"
}
trap cleanup EXIT
function usage {
@taxilian
taxilian / README.md
Last active March 21, 2023 16:19
This is my working kubernetes sentry configuration using the helm chart

Example configuration for a working sentry config on kubernetes bare metal

Special thanks to Kanadaj from the #self-hosted channel on the sentry discord who helped me with a lot of the servers I hadn't used before

Caveats

This is customized in a number of ways, so you'll probably want/need to change things, but it's working for me and I just set it up from scratch again, so I thought I'd share.

@taxilian
taxilian / README.md
Last active August 23, 2023 20:20
kubernetes: Brute-force changing the podCIDR directly in etcd / update cluster CIDR

Disclaimer

This seems to have worked for me, but might not work for you!

Before you try this make sure you've updated everything so that the only things referencing your old CIDR range are the node objects. I did this using calico by creating new ippools. I don't know what issues you may hit -- I avoided most of them by BGP peering with my router and doing all interesting stuff there.

Source

@taxilian
taxilian / emailvalidation.ts
Last active February 27, 2023 23:30
Tool that I use to verify email addresses
import emailaddr from 'email-addresses';
import disposable_domains from 'disposable-email-domains';
import dns from 'dns';
import { promisify } from 'util';
let resolveMx = promisify(dns.resolveMx);
let resolve4 = promisify(dns.resolve4);
let resolve6 = promisify(dns.resolve6);
function reverseLookup(ip: string) {
return new Promise<string[]>((resolve, reject) => {
<template>
<v-card>
<v-card-title>
<slot name="title">
<span class="headline" v-text="dialogTitle"></span>
</slot>
</v-card-title>
<v-card-subtitle>
<slot name="subtitle">
@taxilian
taxilian / check_k8s_certs.sh
Last active February 10, 2023 17:30
Check kubernetes certificate expiration
#!/bin/bash
CONTEXT=$1
ALLCERTS=$(kubectl --context $CONTEXT get secret --field-selector type=kubernetes.io/tls -A | tail +2 | awk '{print $1 ":" $2}')
TODAY=$(date +%s)
COL1=30
COL2=10
COL3=15
@taxilian
taxilian / emailService-EmailService.ts
Last active November 1, 2022 22:17
Example service using the abstraction I'm working on, - in filename shows directories
import { sendEmailTemplate, EmailDomains as ValidDomains } from '@/lib/email/mailer';
import { remoteMethod } from '@/lib/nats/types';
// NATS-capable email service
class EmailService {
@remoteMethod({
timeout: 10000,
})
async sendEmail(domain: string, tplName: string, data: any, options: any) {
@taxilian
taxilian / README.md
Last active January 18, 2024 17:42
OPNSense: Scripts to run as a cron job to enable or disable wireguard based on the CARP status

DEPRECATED

This is no longer needed; OPNSense now has full CARP support in the wireguard plugin which works much better than these hacks ever did =] I'll leave it here as an example of a thing you can do and 'cause why delete it?

Installation

  • Install checkWireguard as /usr/local/opnsense/scripts/OPNsense/Wireguard/checkWireguard
  • Install actions_wireguardCarp.conf as /usr/local/opnsense/service/conf/actions.d/actions_wireguardCarp.conf
  • run service configd restart
@taxilian
taxilian / mongo-mirror.ts
Created September 4, 2022 04:21
Simple node.js typescript script to use change streams to mirror all CRUD operations from one mongodb connection to another
import {MongoClient, ResumeToken, Timestamp, Logger} from 'mongodb';
import path from 'path';
import fs from 'fs';
import {serialize as bsonSerialize, deserialize as bsonDeserialize} from 'bson';
const MONGO_URL_SRC = process.env.MONGO_URL_SRC || 'mongodb://localhost:27017';
const MONGO_DB_SRC = process.env.MONGO_DB_SRC || void 0;
const MONGO_URL_DEST = process.env.MONGO_URL_DEST || 'mongodb://localhost:27018';
const MONGO_DB_DEST = process.env.MONGO_DB_DEST || void 0;
@taxilian
taxilian / FireWyrm.md
Last active August 18, 2022 23:02
FireWyrm documentation

FireWyrm message protocol

FireWyrm messages are structured as Arrays. Note that the colonyId will usually just be 0.

cmdId should be unique for any currently outstanding command; the response will be sent with a matching cmdId to allow it to be mapped back to the original command.

Supported argument types

These types are permitted as arguments or return values for any property or function

  • int