Skip to content

Instantly share code, notes, and snippets.

View gsdevme's full-sized avatar

Gavin Staniforth gsdevme

View GitHub Profile
@gsdevme
gsdevme / shed.py
Created November 22, 2021 09:05
Solar Shed to MQTT
from solarshed.controllers.renogy_rover import RenogyRover
import paho.mqtt.client as mqtt
import time
from gpiozero import CPUTemperature
while True:
time.sleep(5)
rover = RenogyRover('/dev/ttyUSB0', 1)
@gsdevme
gsdevme / k3os.init
Last active October 22, 2021 10:28
ssh_authorized_keys:
- github:gsdevme
password: rancher
k3os:
k3s_args:
- server
- "--cluster-init"
- "--disable=traefik"
@gsdevme
gsdevme / quick-start-postgres-k3s.yaml
Last active February 4, 2021 10:24
quick-start-postgres for k3s (no docker)
# This is an auto-generated file. DO NOT EDIT
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: clusterworkflowtemplates.argoproj.io
spec:
group: argoproj.io
names:
kind: ClusterWorkflowTemplate
listKind: ClusterWorkflowTemplateList
@gsdevme
gsdevme / dnasmq-install.md
Last active December 9, 2020 11:14
MacOS dnsmasq

Install dnsmasq

brew install dnsmasq
cat << EOF > /usr/local/etc/dnsmasq.conf
#log-queries
standard/epel:
pkg.installed:
- pkgs:
- epel-release
standard/install:
pkg.installed:
- pkgs:
- yum-cron
- deltarpm
<?php
if(filter_var($_POST['uid'], FILTER_VALIDATE_INT)){//if integer
if((trim($_POST['search']) != '') && ($_POST['uid'] != '') && ($_POST['ip'] != '') && ($_POST['crpyt'] != '') && ($_POST['uid'] != '')){//if they dont equal ''
if(($_POST['crpyt'] == md5($_SERVER['REMOTE_ADDR'])) && ($_POST['ip'] == $_SERVER['REMOTE_ADDR'])){//if md5 hash on the users ip is ok still
include_once($_SERVER['DOCUMENT_ROOT'].'projects/GamePriceComparison/includes/config.php');//include configuration
include_once($root.'includes/preg.php');//includes function & data
include_once($root.'includes/sort.php');//includes function sort2d
//trim & set to vars
$search = trim($_POST['search']);//what the user typed in
@gsdevme
gsdevme / readme.md
Last active March 20, 2018 22:56
centos-mirror-on-raspberry-pi
sudo raspi-config --expand-rootfs && \
    sudo su - -c 'echo "CONF_SWAPSIZE=1000" > /etc/dphys-swapfile' && \
    sudo reboot

sudo apt-get update && \
    sudo apt-get upgrade -y

sudo apt-get install createrepo rsync avahi-daemon -y
variable "name" {}
variable "region" {
default = "eu-west-1"
}
variable "vpc_network" {
"default" = "10.0.0.0/16"
}
variable "public_subnets" {
// https://www.terraform.io/docs/providers/google/index.html
provider "google" {
region = "${var.region}"
project = "${var.project_name}"
}
// https://www.terraform.io/docs/providers/google/d/datasource_compute_network.html
resource "google_compute_network" "default" {
name = "ecom"
}
@gsdevme
gsdevme / controlller.php
Last active September 20, 2017 09:45
UUID at the controller level
<?php
class CreateOrderController extends Controller
{
public function createOrderWithCustomer(array $order)
{
// Create the reference here because then we know it for the order and can async everything
$customerReference = uuid::uuid4()->toString();
// Validate `$order`