Skip to content

Instantly share code, notes, and snippets.

View mattatcha's full-sized avatar

Matt Aitchison mattatcha

View GitHub Profile

Frankie Bagnardi aka GreenJello has passed away on Sept 13, 2021 at age 27

Many of you in this channel know of him because he spent much of his time helping others, his death is a great blow to the community

He lost his battle with depression

Rest In Peace Frankie, we will never forget you.

If you are in a dark place, please reach out to chanops or the ones closest to you

@kpine
kpine / ge_double_tap_auto_dimmer.yaml
Last active January 3, 2024 22:15
GE/Jasco Double Tap Auto-dimming Blueprint
blueprint:
name: GE Light Switch Double Taps with Auto Brightness
description: Auto-dim GE/Jasco/Honeywell light switches that support double taps.
domain: automation
input:
device:
name: Light Switch Device
description: A light switch that supports double taps.
selector:
@kpine
kpine / ge_double.yaml
Last active December 5, 2023 22:33
GE/Jasco Double Tap Generic Blueprint
blueprint:
name: GE Switch Double Taps
description: Create automations to react to double taps from supporting GE, Honeywell and Jasco switches.
domain: automation
input:
device:
name: Switch Device
description: A GE switch that supports double taps.
selector:
@petewill
petewill / BlindsMuliRemoteforMySensors.ino
Created December 6, 2020 13:41
MySensors Dooya Blind Control Code
/*
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
//
// DESCRIPTION
// This sketch provides a way to control blinds from www.blinds.com using a 433MHz RF
// signal. The motors in the blinds are Dooya DV24CE motors.
// See https://forum.mysensors.org/topic/7/controlling-blinds-com-rf-dooya-motors-with-arduino-and-vera
// for more info.
@maciej
maciej / redis-hll-size.md
Last active March 30, 2023 19:03
Redis HLL size

Redis HLL has a 16 bytes header:

  • 8 bytes are used to cache the set cardinality
  • 3 are not used
  • 4 are used to store the magic "HYLL"
  • 1 is used to represent the type of the set (sparse or dense)
struct hllhdr {
 char magic[4]; /* "HYLL" */
@GLMeece
GLMeece / latency_numbers.md
Last active May 22, 2024 15:57
Latency Numbers Every Programmer Should Know - MarkDown Fork

Latency Comparison Numbers

Note: "Forked" from Latency Numbers Every Programmer Should Know

Event Nanoseconds Microseconds Milliseconds Comparison
L1 cache reference 0.5 - - -
Branch mispredict 5.0 - - -
L2 cache reference 7.0 - - 14x L1 cache
Mutex lock/unlock 25.0 - - -
@terlar
terlar / kubectl.fish
Last active January 31, 2021 04:11
Kubernetes fish completions
# kubernetes - is an open source system for managing containerized
# applications across multiple hosts, providing basic mechanisms for
# deployment, maintenance, and scaling of applications.
# See: https://kubernetes.io
function __kubectl_no_command
set -l cmd (commandline -poc)
if not set -q cmd[2]
return 0
end
@marianogappa
marianogappa / ordered_parallel.go
Last active February 12, 2024 09:27
Parallel processing with ordered output in Go
/*
Parallel processing with ordered output in Go
(you can use this pattern by importing https://github.com/MarianoGappa/parseq)
This example implementation is useful when the following 3 conditions are true:
1) the rate of input is higher than the rate of output on the system (i.e. it queues up)
2) the processing of input can be parallelised, and overall throughput increases by doing so
3) the order of output of the system needs to respect order of input
- if 1 is false, KISS!

Notes

  • This code handles any JS runtime error during rendering React components. Without this handling, once an error occurs, whole component tree is damaged and can't be used at all. With this handling, nothing will be rendered in production environment (error span in dev env.) + in production the error is logged to Sentry (if you are not using it just delete related code)
  • This is basicaly a workaround for proposed feature in React core - described in Issue: facebook/react#2461
  • Works for all variants of Component creation - React.createClass, extending React.Component and also stateless functional components.
  • To get this work, just put this snippet into your entry js file. Then it will work in whole application.
  • Also supporting React Hot Reload!
  • If you find this useful, please retweet https://twitter.com/Aldredcz/status/744650159942995968 :)

Ideas

  • specify custom error renderer (global / per component, e.g. by implementing method renderOnError() in a comp