Skip to content

Instantly share code, notes, and snippets.

View initialed85's full-sized avatar
🤦‍♂️

Edward Beech initialed85

🤦‍♂️
View GitHub Profile
@initialed85
initialed85 / generate-ssl-key-and-csr-and-pem.md
Last active May 8, 2023 01:59
A helper for generating a self-signed .key and .pem / a .key and .csr for external signing

generate-ssl-key-and-csr-and-pem.sh

A script to take some of the toil out of generating a self-signed .key and .pem / a .key and a .csr for external signing.

Limitations

  • Richer detail (country, organisation, etc) not exposed

Usage

@initialed85
initialed85 / iso.nix
Created February 9, 2023 12:53
Use Packer to build a NixOS ISO
{ config, pkgs, ... }:
{
imports = [
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix>
<nixpkgs/nixos/modules/installer/cd-dvd/channel.nix>
];
systemd.services.sshd.wantedBy = pkgs.lib.mkForce [ "multi-user.target" ];
@initialed85
initialed85 / kube-registry.yaml
Created October 17, 2022 16:21
Modified kube-registry.yaml from rook/deploy/examples/csi/cephfs
# this modification adds a service w/ a LoadBalancer presence on port 5000
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: cephfs-pvc
namespace: kube-system
spec:
accessModes:
- ReadWriteMany
@initialed85
initialed85 / nvidia-device-plugin.yml
Created October 17, 2022 13:28
Modified nvidia-device-plugin.yml that works for k3s (at least for me)
# tweaked from https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v0.12.2/nvidia-device-plugin.yml
# credit to https://github.com/hansaya for the comment at https://github.com/k3s-io/k3s/issues/4391#issuecomment-1194627754
# note: you need to label your GPU nodes with gpu=yes for this to work (I had some non-GPU nodes and the discovery pods kept crashlooping
# on those nodes without the system working out they had no GPUs)
#
# prerequisites
#
apiVersion: node.k8s.io/v1
@initialed85
initialed85 / smbus_read_byte_protocol_with_synapse_wireless_snappy.py
Last active June 30, 2020 03:52
SMBus Read Byte protocol w/ Synapse Wireless Snappy
"""
Synapse Wireless RF200 devices use some terribly hobbled version of Python2 coupled with a terribly limited library.
They are in general terrible devices.
Anyway- to read SMBus (a protocol layer on top of i2c- see Page 41 of 85 of http://smbus.org/specs/SMBus_3_0_20141220.pdf) the process is as follows:
- write 2 bytes to i2c
- byte 0 = slave address shifted left by 1 bit, write bit of 0
- byte 1 = command
@initialed85
initialed85 / README.md
Last active March 31, 2022 01:20
Flashing Kogan (AU) smart devices w/ Tasmota using tuya-convert

Flashing Kogan smart devices w/ Tasmota using tuya-convert

I bought the following devices from Kogan (AU):

  • KASB10WRGBCCTB22A Kogan SmarterHome 10W RGB+CCT Color & Warm/Cool White Smart Bulb (B22)
  • KALEPDLRGBCCTA Kogan SmarterHome Smart LED Downlight
  • KASB10WRGBCCTE27A Kogan SmarterHome 10W RGB+CCT Color & Warm/Cool White Smart Bulb (E27)
  • KASPEMHUSBA Kogan Smart Plug With Energy Meter (and 2 x USB)
    • NOTE: Same device as MS6104 Jaycar Smart Plug WiFi Controlled Main Switch and Energy Monitor with 2 x USB Sockets
@initialed85
initialed85 / gnss_test.py
Created January 22, 2020 13:21
Carla GNSS sensor oddities
import glob
import os
import sys
import time
from math import sqrt
from pyproj import Geod, Transformer
try:
sys.path.append(glob.glob('../carla/dist/carla-*%d.%d-%s.egg' % (
@initialed85
initialed85 / pktgen.py
Created January 15, 2020 11:58
Python packet generator
# to simulate DGPS generation
# python pktgen.py tb 3784 1 305
# to receive
# python pktgen.py rb 3784 1 305
# to simulate AMP generation
# python pktgen.py tm 13000 2.77 372
# to receive
# python pktgen.py rm 13000 2.77 372
@initialed85
initialed85 / something.py
Last active July 8, 2019 10:53
Example of custom Python3 pickling behaviour (should work with Python 2)
from threading import RLock
class Something(object):
def __init__(self, a, b):
self.a = a
self.b = b
self._lock = RLock() # this is not pickleable
@initialed85
initialed85 / private_to_public.sh
Last active July 8, 2019 04:04
Create a public key for an AWS private key
#!/bin/bash
# props to original at https://gist.github.com/zircote/1243501
if [[ "${1}" == "" ]]; then
echo "usage: ${0} some_private_key.pem"
echo ""
echo "The result will be a public key at $(pwd)/some_private_key.pub"
exit 1