Skip to content

Instantly share code, notes, and snippets.

View NoxHarmonium's full-sized avatar

Sean Dawson NoxHarmonium

View GitHub Profile
@NoxHarmonium
NoxHarmonium / jwk-to-pem.go
Created December 7, 2019 07:09
Securing a Home Assistant/Hass.io installation with CloudFlare access.
package main
// Rough steps to securing Home Assistant/Hassio with Cloudflare Access
// Install Caddy addon in hass io
// Set up port forwarding on router to point port 443 at Caddy
// Set up Cloudflare Access to protect the domain pointing at your home IP
// Only allow port forwarding from CloudFlare IP addresses
// To only accept connections that have come from Cloud Flare access do the following:
// Setup
val regex = """(\w+)@(\w+\.\w+)\.(au|uk|de)""".r
val doARegexMatch = (str: String) => str match {
case regex(user, domain, tld) => s"user: $user, domain: $domain, tld: $tld"
}
// Good
@NoxHarmonium
NoxHarmonium / gist:d53d07bda7417d6d8004
Last active August 29, 2015 14:13
Directive to bind jQuery-UI slider to Angular js and ngChange support
// Modified from http://stackoverflow.com/a/25585402/1153203
// to support ngModel attributes that are getterSetter functions
// see "Binding to a getter/setter" in
// https://docs.angularjs.org/api/ng/directive/ngModel
(function (module, require) {
'use strict';
var Utils = require('../../shared/utils.js');
// Copyright Christian Neumüller 2012. Use, modification and distribution is
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// Hacked up due to compile errors
#ifndef LUABIND_STD_SHAREDPTR_CONVERTER_HPP_INCLUDED
#define LUABIND_STD_SHAREDPTR_CONVERTER_HPP_INCLUDED \
LUABIND_STD_SHAREDPTR_CONVERTER_HPP_INCLUDED
// Copyright Daniel Wallin 2009. Use, modification and distribution is
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// Modified by Sean Dawson for std::shared_ptr 10/may/2014
#ifndef LUABIND_STD_SHARED_PTR_CONVERTER_090211_HPP
# define LUABIND_STD_SHARED_PTR_CONVERTER_090211_HPP
# include <luabind/get_main_thread.hpp>