Skip to content

Instantly share code, notes, and snippets.

View mhzawadi's full-sized avatar
🏝️
windmilling about

Matthew Horwood mhzawadi

🏝️
windmilling about
View GitHub Profile
@mhzawadi
mhzawadi / steps.md
Last active January 11, 2021 11:32 — forked from tavalin/steps.md
UK Light Wiring with Shelly 1

Intro

This is a simple guide on how to automate UK lights with a Shelly 1 by installing the shelly 1 relay into the ceiling pendant which has both permanent live, neutral and a switched live back from the wall switch.

These steps are from my own experience making my lighting "smart" but also user friendly (it works via a wall switch!). This simple guide will go through replacing an a normal ceiling pendant with one with room for a Shelly 1. If you have a ceiling light with a bigger base it's even easier.

Warning Electrical regulations must be followed by law. If you are not a competent person under the regulations do not attempt electrical work. https://www.diydoctor.org.uk/projects/electrical_safety.htm

Wiring Diagram

This diagram has been taken from here and modified to include the Shelly 1. Wiring Diagram

echo "reset the dock"
defaults delete com.apple.dock persistent-apps
defaults delete com.apple.dock persistent-others
killall Dock
#!/bin/bash
#
# This script will get an SSH host certificate from our CA and add a weekly
# cron job to rotate the host certificate.
#
# See https://smallstep.com/blog/diy-single-sign-on-for-ssh/ for full instructions
CA_URL="[Your CA's URL]"
ALLOWED_DOMAIN="[the domain name of accounts your users will use to sign to Google]"
CA_NAME="[A name for your CA]"
#!/bin/bash
#
# This script will launch and configure a step-ca SSH Certificate Authority
# with OIDC and AWS provisioners
#
# See https://smallstep.com/blog/diy-single-sign-on-for-ssh/ for full instructions
OIDC_CLIENT_ID="[OAuth client ID]" # from Google
OIDC_CLIENT_SECRET="[OAuth client secret]" # from Google
ALLOWED_DOMAIN="[the domain name of accounts your users will use to sign to Google]"
@mhzawadi
mhzawadi / jukebox.sh
Created July 18, 2019 14:28
control Subsonic jukebox on the command line
#!/bin/sh
SubADDR=""
SubAPI="rest/jukeboxControl.view"
SubUSER=""
SubPASS=""
SubSALT=""
SubVER="1.16.1"
SubCLI="curl"
SubAction=$1
@mhzawadi
mhzawadi / pi_version.sh
Last active July 16, 2019 15:14
Get the Pi model
#!/bin/sh
# https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
cpuinfo=`cat /proc/cpuinfo | grep "Revision"|awk -F': ' '{printf $2}'`
model=`cat /sys/firmware/devicetree/base/model`
case ${cpuinfo} in
"0002" )
echo "Revision : 0002 (Model B Rev 1, 256MB)" ;;
"0003" )
@mhzawadi
mhzawadi / Slim-Raspbian.sh
Created November 23, 2015 13:54 — forked from samatjain/Slim-Raspbian.sh
Consistency…
# GUI-related packages
pkgs="
xserver-xorg-video-fbdev
xserver-xorg xinit
gstreamer1.0-x gstreamer1.0-omx gstreamer1.0-plugins-base
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-alsa
gstreamer1.0-libav
epiphany-browser
lxde lxtask menu-xdg gksu
xserver-xorg-video-fbturbo
@mhzawadi
mhzawadi / Sendmail Logs-1444915353316
Created October 15, 2015 13:25
Kibana - Sendmail Logs
{
"title": "springbokmta Mail",
"services": {
"query": {
"list": {
"0": {
"query": "*",
"alias": "",
"color": "#7EB26D",
"id": 0,
@mhzawadi
mhzawadi / install.sh
Last active September 17, 2015 13:02 — forked from vjm/install.sh
Raspberry Pi Logstash
wget https://download.elastic.co/logstash/logstash/packages/debian/logstash_1.5.4-1_all.deb
dpkg --install logstash_1.5.4-1_all.deb
vi /etc/logstash/conf.d/logstash.conf
# https://github.com/jruby/jruby/issues/1561
cd /tmp/
sudo git clone https://github.com/jnr/jffi.git
cd jffi/
apt-get install -y ant
ant jar
@mhzawadi
mhzawadi / Nginx Hits-1441974972415
Last active September 15, 2015 14:43
Kibana - Nginx hit locations
{
"title": "Nginx Hits",
"services": {
"query": {
"list": {
"1": {
"id": 1,
"color": "#890F02",
"alias": "",
"pin": false,