Skip to content

Instantly share code, notes, and snippets.

View liamkinne's full-sized avatar

Liam Kinne liamkinne

View GitHub Profile
@liamkinne
liamkinne / settings.json
Created January 29, 2023 16:22
My Visual Studio Code settings
{
"telemetry.telemetryLevel": "off",
"editor.rulers": [80],
}
@liamkinne
liamkinne / kubeadmin.tf
Created December 11, 2022 17:34
Generate kubeadmin credentials secret with Terraform
resource "random_password" "password" {
count = 4
length = 5
special = false
}
locals {
password = "${random_password.password[0].result}-${random_password.password[1].result}-${random_password.password[2].result}-${random_password.password[3].result}"
password_hash = bcrypt(local.password)
}
@liamkinne
liamkinne / openshift-best-practices.md
Last active December 10, 2022 20:16
A collection of OpenShift and Kubernetes best practices.

OpenShift Best Practices

A sort-of style guide and operational handbook for OpenShfit and k8s.

Inspired by the Uber Go Style Guide.

Semantics

Prefer generic resource names

@liamkinne
liamkinne / Opsgenie.ps1
Created June 2, 2022 01:42
Send alerts to Opsgenie using PowerShell
function New-OpsgenieAlert {
param (
[parameter(Mandatory=$true)][string]$ApiKey,
[parameter(Mandatory=$true)][string]$Message,
[parameter(Mandatory=$false)][string]$Alias,
[parameter(Mandatory=$false)][string]$Description,
[parameter(Mandatory=$false)][PSCustomObject[]]$Responders,
[parameter(Mandatory=$false)][PSCustomObject[]]$VisibleTo,
[parameter(Mandatory=$false)][string[]]$Actions,
@liamkinne
liamkinne / alertmanager-opsgenie-priority-mapping.yaml
Last active April 21, 2022 19:46
Map Alertmanager priorities to Opsgenie
receiver:
- name: OpsgenieTeam
opsgenie_configs:
- api_url: 'https://api.opsgenie.com/'
api_key: '<api-key-here>'
priority: |
{{ if eq .GroupLabels.severity "critical" }}P2{{ else if eq .GroupLabels.severity "warning" }}P3{{ else if eq .GroupLabels.severity "info" }}P4{{ else }}P5{{ end }}
@liamkinne
liamkinne / csv-to-squid-config.sh
Created February 1, 2022 02:06
Convert CSV of Uptime.com probe servers to Squid proxy config format
{
read # ignore first line
while IFS=, read -r name location address address_ipv6
do
printf "%-18s %-15s %-20s\n" "acl whitelist src" "$address" "# $name"
done
} < probe-servers.csv # default file name
@liamkinne
liamkinne / main.cpp
Last active February 24, 2020 20:49
AVR port manipulation using bit-fields
#include <avr/io.h>
#include <util/delay.h>
typedef struct {
bool BIT0 : 1;
bool BIT1 : 1;
bool BIT2 : 1;
bool BIT3 : 1;
bool BIT4 : 1;
bool BIT5 : 1;
@liamkinne
liamkinne / fanuc-a-T14iA.cps
Created August 8, 2019 22:50
Customised Post Processor Script for FANUC a-T14iA ROBODRILL
/**
Copyright (C) 2012-2018 by Autodesk, Inc.
All rights reserved.
FANUC post processor configuration.
$Revision: 41862 7fce30c1baca03654655586a08a94540efb2c6fb $
$Date: 2018-02-22 13:45:13 $
FORKID {04622D27-72F0-45d4-85FB-DB346FD1AE22}
@liamkinne
liamkinne / Tekcel M Series Router.cps
Created January 22, 2019 03:44
Post processor config for the Tekcel M Series Router. Has some changes to work with the old controller.
/**
Copyright (C) 2012-2016 by Autodesk, Inc.
All rights reserved.
TekMOV Router post processor configuration.
$Revision$
$Date$
FORKID {21E9AB8B-76BE-4e51-9D5B-CA4A2631FC5F}
from microbit import *
def speed_to_output(i):
return abs(i)*255
def motor(speed, pin_a, pin_b):
pin_a.write_analog(speed_to_output(speed) if speed > 0 else 0)
pin_b.write_analog(speed_to_output(speed) if speed < 0 else 0)
def drive_tank(left, right):