Skip to content

Instantly share code, notes, and snippets.

View azdle's full-sized avatar

Patrick Barrett azdle

View GitHub Profile
@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
@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 / 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
/// 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 / 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
@azdle
azdle / configuration.nix
Last active February 8, 2018 23:55
QEMU Guest Base NixOS Config
{ config, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
];
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
@azdle
azdle / books_download_cmds.js
Last active March 18, 2022 19:34
Humble Bundle Easy Get All
//
// This scripts builds wget commands for you to paste into a terminal. It will download
// all formats of all books currently showing on the page.
//
cmds = "";
for (a of document.getElementsByTagName("a")) {
if (a.href.startsWith("https://dl.humble.com")) cmds += "wget --content-disposition '" + a.href + "'<br>";
};
### Keybase proof
I hereby claim:
* I am azdle on github.
* I am psbarrett_st (https://keybase.io/psbarrett_st) on keybase.
* I have a public key ASAOtRdhF-9oHcFeX3FrkhM5E3TKGl7B-BIGTjoeybR_4go
To claim this, I am signing this object:
@azdle
azdle / main.rs
Last active January 14, 2017 20:07
UDP Doubler
extern crate futures;
extern crate tokio_core;
extern crate env_logger;
use std::str;
use std::io::{Result, Error, ErrorKind, Write};
use std::net::SocketAddr;
use futures::{Stream, Sink};
use tokio_core::net::{UdpSocket, UdpCodec};
@azdle
azdle / campsites_sht.geojson
Created May 16, 2016 23:21
Superior Hiking Trail as GeoJSON
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.