Skip to content

Instantly share code, notes, and snippets.

View azdle's full-sized avatar

Patrick Barrett azdle

View GitHub Profile
@azdle
azdle / wakeup-controller.groovy
Last active March 7, 2021 05:38
Wakeup SmartApp w/ ColorTemp Mod
/**
* Copyright 2016 SmartThings
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
/// This is a marker type that allows us to mark a Vec<u8> as one that should be converted into
/// a Lua string type.
#[derive(Clone, Debug)]
pub struct ByteString(Vec<u8>);
impl From<Vec<u8>> for ByteString {
fn from(vec: Vec<u8>) -> Self {
ByteString(vec)
}
}
@azdle
azdle / Mark Twain The Complete Novels.ffmeta
Last active November 11, 2020 21:29
Split Mark Twain The Complete Novels Audio Book
;FFMETADATA
#
# Apply this file with: ffmpeg -i Mark_twain_The_Complete_Novels.m4a -i Mark_twain_The_Complete_Novels.ffmeta -map_metadata 1 -codec copy Mark_twain_The_Complete_Novels_With_Metadata.m4a
#
title=Mark Twain: The Complete Novels
author=Mark Twain
narrator=Lee Howard
[CHAPTER]
TIMEBASE=1/1000
START=0
@azdle
azdle / upnp_disco.lua
Created January 13, 2021 15:34
Find all (?) Belkin Wemo Devices on LAN and Query API Description
local socket = require "socket"
local http = require "socket.http"
local ltn12 = require "ltn12"
--[[
local log = require "log"
local xml2lua = require "xml2lua"
local xml_handler = require "xmlhandler.tree"
--]]
-- find element of nested tables, returns nil if any part of the path can't be resolved
@azdle
azdle / packunpackit.lua
Created November 2, 2022 02:40
Testing Packing and Unpacking in Lua
--
-- Note: run with `busted packunpackit.lua`
--
local havecosock, cosock = pcall(require, "cosock")
local socket = require "socket"
local pack = table and table.pack or pack
local unpack = table and table.unpack or unpack