Skip to content

Instantly share code, notes, and snippets.

View Mezzle's full-sized avatar

Martin Meredith Mezzle

View GitHub Profile
title: Zigbee2MQTT
type: entities
show_header_toggle: false
entities:
- entity: sensor.zigbee2mqtt_bridge_state
- entity: sensor.zigbee2mqtt_version
- entity: sensor.coordinator_version
- entity: input_select.zigbee2mqtt_log_level
- type: divider
- entity: switch.zigbee2mqtt_main_join
let db;
const connect = () => {
db = Mongo.ConnectDbOrWhateverCommandIs();
};
module.exports = {
db,
connect
};
@Mezzle
Mezzle / Dockerfile
Last active November 6, 2018 15:41
Basic Docker setup for Magento
FROM php:7.1-apache
RUN apt-get update -y && apt-get install -y libmcrypt-dev libxslt-dev \
zlib1g-dev libjpeg-dev libpng-dev libfreetype6-dev \
&& docker-php-ext-install -j$(nproc) mcrypt \
&& docker-php-ext-install -j$(nproc) xsl \
&& docker-php-ext-install -j$(nproc) intl \
&& docker-php-ext-install -j$(nproc) pdo_mysql \
&& docker-php-ext-install -j$(nproc) soap \
&& docker-php-ext-install -j$(nproc) zip \
@Mezzle
Mezzle / Brewfile
Last active September 24, 2018 09:24
Brew machine
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-drivers"
tap "homebrew/cask-fonts"
tap "homebrew/cask-versions"
tap "homebrew/core"
tap "homebrew/services"
brew "antigen"
brew "awscli"
brew "composer"
@Mezzle
Mezzle / keybase.md
Created August 4, 2016 09:54
keybase.md

Keybase proof

I hereby claim:

  • I am mezzle on github.
  • I am mezzle (https://keybase.io/mezzle) on keybase.
  • I have a public key whose fingerprint is 065B FD16 E4BF B184 D73F 768C 2AFB D67F D133 AC6E

To claim this, I am signing this object:

{
"name": "hosted-hubot",
"version": "2.6.3",
"author": "GitHub Inc.",
"keywords": [
"github",
"hubot",
"campfire",
"bot"
],
@Mezzle
Mezzle / CatchFatal.php
Last active August 29, 2015 14:21
Catch Catchable Fatal errors and throw
<?php
set_error_handler(function($errno, $errstr, $errfile = null, $errline =0 , array $errcontext=[]) {
debug_backtrace();
die();
}, E_RECOVERABLE_ERROR);
/**
* getQueueFailures
*
* @return array[][]
*/
protected function getQueueFailures()
{
$resque = $this->getServiceLocator()->get('Resque');
/** @var \CRedis_Client $redis */
public function getServiceConfig()
{
return array(
'factories' => array(
'Zf2Resque\Service\ResqueWorker' => function ($sm)
{
$QUEUE = getenv('QUEUE');
$queues = explode(',', $QUEUE);
return new \Zf2Resque\Service\ResqueWorker($queues, $sm);
}
$valid = false;
$incoming = $this->getData('vat_number');
$clean = preg_replace('[^a-zA-Z0-9]', '', $incoming);
if (preg_match($clean, '/^(GB)?([0-9]{9}([0-9]{3})?|[A-Z]{2}[0-9]{3})$')) {
$valid = true;
}