Skip to content

Instantly share code, notes, and snippets.

View tbaron's full-sized avatar

Thomas Baron tbaron

View GitHub Profile
blueprint:
name: ZHA - Tuya TS0041 Switch
description: Automate your TS0041 Wireless Switch using ZHA events.
domain: automation
input:
ts0041_switch:
name: _TZ3000_axpdxqgu TS0041 Switch
description: _TZ3000_axpdxqgu TS0041 Switch to use
selector:
device:
@tbaron
tbaron / zha-moes-zigbee-rotary-smart-knob-remote-control.yaml
Created October 17, 2023 02:03 — forked from blizzrdof77/zha-moes-zigbee-rotary-smart-knob-remote-control.yaml
ZHA - Moes Tuya Smart Knob (TS004F) controller for remote control devices
blueprint:
name: ZHA - Moes Tuya Smart Knob (TS004F) controller for remote control devices
description: Control remotes (e.g. volume up/down) with a Moes Tuya smart knob (the spinny ones). You can set functions for single press, rotating left, and rotating right.
domain: automation
source_url: https://gist.github.com/blizzrdof77/c30c388ca5f4ce7ed72752296767417d
input:
remote:
name: Smart Knob Device
description: Moes Tuya Smart Knob Device to use
selector:
@tbaron
tbaron / devoxx-myagenda.js
Created March 13, 2017 20:53
Devoxx schedule as JSON
console.assert(/cfp\.devoxx\.us\/myagenda/.test(window.location), "This script only works for: cfp.devoxx.us/myagenda");
$ = jQuery;
var schedule = $('th.timeSlot').map(function(i, x) {
var $row = $(x);
var time = x.innerText.trim();
var day = $row.closest('div').prev('h2').text();
return $row.siblings('td.room').map(function(i, x) {
@tbaron
tbaron / BundleMatchers.java
Created October 13, 2016 20:47
Android Bundle Matchers class
package io.baron.android-hamcrest-matchers;
import android.os.Bundle;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import static org.hamcrest.Matchers.equalTo;
@tbaron
tbaron / gist:7225bc483087f7d74ba9
Created December 9, 2014 18:22
Automatically refresh a Tumblr blog when a new article is added.
(function () {
var feedPollInterval = 2000;
var feedUrl = "//" + window.location.host + "/api/read/json?num=1&callback=?";
var lastArticleTime = new Date();
function feedCallback(data) {
if (data.posts && data.posts.length) {
var rawArticleTime = data.posts[0]["unix-timestamp"];
public static class DateTimeParser
{
private readonly static Regex timeZoneMatch = new Regex(@"[a-z]{2,}$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly static IDictionary<string, string> timeZoneMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
{"ACDT", "+1030"},
{"ACST", "+0930"},
{"ADT", "-0300"},
{"AEDT", "+1100"},
@tbaron
tbaron / DistributedWebRequestCreator.cs
Created July 25, 2013 02:06
A generic, fail-safe web request factory based on the .NET WebRequest classes that will distribute a request load to all of the IP addresses in a DNS record. Distribution is based on a round-robin algorithm, with addresses refreshed in the background on a specified interval.
using System;
using System.Net;
public class DistributedWebRequestCreator : IWebRequestCreate
{
private readonly IDnsResolver resolver;
public DistributedWebRequestCreator()
: this(new DnsResolver())
{