Skip to content

Instantly share code, notes, and snippets.

View richardjkendall's full-sized avatar
🌍
Working from home

Richard Kendall richardjkendall

🌍
Working from home
View GitHub Profile
@richardjkendall
richardjkendall / ellipse.html
Created February 25, 2024 09:59
Draw ellipse and triangle
<!DOCTYPE html>
<h1>Time/Cost/Complexity Relationship</h1>
<label for="rotation">Rotation</label><input type="range" min="0", max="360", step="1", value="1" id="rotation"/>
<div id="container"></div>
<table border="1">
<tr>
<td></td>
<td></td>
<td>Time</td>
@richardjkendall
richardjkendall / create_user.sh
Last active February 12, 2024 09:20
create user with ssh key
#!/bin/bash
# Author: Richard Kendall
# Written for Amazon Linux, with changes to the adduser command etc it will work for other distros
# Expects to be run as root, will exit otherwise
if [[ $# -eq 0 ]] ; then
echo "Please provide the username as a parameter"
exit 1
fi
@richardjkendall
richardjkendall / coordinates.js
Created April 7, 2021 22:38
Easting/northing to lat/long
function to_rad(deg) {
return deg * (Math.PI/180);
}
function to_deg(rad) {
return rad * (180/Math.PI);
}
function tanx(px, pa) {
var tres = Math.tan(pa);
@richardjkendall
richardjkendall / _redis
Created March 12, 2021 02:25
Create a simple redis kv store on K8s
To deploy this, put the files below in a directory and create a PV and PVC.
PVC should be called `redis-vol-claim`
Then in the directory containing the files run the following:
1. kubectl apply -k .
2. kubectl apply -f redis-service.yaml
@richardjkendall
richardjkendall / _mqtt_broker
Last active February 22, 2021 03:05
Simple passwordless MQTT broker on kube (pv/pvc for reader...)
Code to deploy eclipse mosquitto in a simple, open fashion on Kube.
You'll need to sort out the PV/PVC.
kubectl apply -f configmap.yml
kubectl apply -f deployment.yml
kubectl apply -f service.yml
@richardjkendall
richardjkendall / free-up-space.ps1
Created August 19, 2020 05:12
Freeing up space from your docker volume on windows
docker system prune -a -f
net stop com.docker.service
taskkill /F /IM "Docker Desktop.exe"
stop-vm DockerDesktopVM
Optimize-VHD -Path "C:\Users\Public\Documents\Hyper-V\Virtual hard disks\DockerDesktop.vhdx" -Mode Full
start-vm DockerDesktopVM
start "C:\Program Files\Docker\Docker\Docker Desktop.exe"
net start com.docker.service
@richardjkendall
richardjkendall / sketch.c
Created May 29, 2020 05:38
Rainbow effect on 8x8 RGB common anode LED matrix
#include <SPI.h>
// port register maniuplation macros
#define sbi(port, bit) (port) |= (1 << (bit))
#define cbi(port, bit) (port) &= ~(1 << (bit))
// pins
// note if you change the latchpin, you will need to change the code in the loop as this is hard
// coded to make use of faster port register manipulation
int latchPin = 8; // Pin connected to ST_CP of 74HC595
@richardjkendall
richardjkendall / sketch.c
Created May 29, 2020 04:21
Arduino sketch to drive an 8x8 RGB LED maxtrix with common row anodes
#include <SPI.h>
// port register maniuplation macros
#define sbi(port, bit) (port) |= (1 << (bit))
#define cbi(port, bit) (port) &= ~(1 << (bit))
// pins
// note if you change the latchpin, you will need to change the code in the loop as this is hard
// coded to make use of faster port register manipulation
int latchPin = 8; // Pin connected to ST_CP of 74HC595
@richardjkendall
richardjkendall / sketch.c
Created May 28, 2020 21:32
basic rgb 8x8 driver arduino
//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;
int bluesq[] = {
B00000000,
B01111110,
@richardjkendall
richardjkendall / terraform.tfvars
Created February 12, 2020 04:44
Terragrunt/terraform code for deploying ecs-haproxy service
aws_region = "AWS_REGION"
cluster_name = "ECS_CLUSTER_NAME"
service_name = "haproxy"
tag_name = "latest"
default_domain = "null.example.com"
service_registry_id = "ns-BLAH"
namespace_map = [
{