Skip to content

Instantly share code, notes, and snippets.

View awstanley's full-sized avatar

A.W. Stanley awstanley

  • Sydney, Australia
View GitHub Profile
@awstanley
awstanley / esphome-sphinx.py
Created August 9, 2022 09:16
Sphinx extension for ESPHome documentation.
"""
ESPHome Sphinx Extension.
This extension provides ESPHome documentation specific. While it may be a good starting
point for other projects, the esoteric nature of the included code is designed to assist
in automating the linking and indexing of components, devices, and blueprints.
Because Sphinx internals are foreign to most people looking through this, the documentation
in this file will verbose. (Future me thanks you for leaving them here too.)
@awstanley
awstanley / zappi.txt
Last active April 26, 2022 23:18
Zappi integration tied Markdown display for your phone or dashboard. Designed for phone display or as part of a grid/horizontal grouping.
{# This Markdown will not execute anything on your Zappi, it just displays information.
Largely untested in different states due to the generally green nature of charging done here.
Pause state renders correctly against two inputs, and the Charging state works too.
* Required power/CT information is in watts (should be correct now);
* Session is in kWh (should be correct now);
* 'EV Connected' is clobbered by 'Charging', so state information is used from the integration.
Fixed an else/if issue and removed the untested Boost section.
@awstanley
awstanley / svg_inject_test.html
Created September 26, 2020 12:29
Demonstration of SVG creation in JavaScript.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SVG Inject Test</title>
</head>
<body>
<script>
// Simple pathPath which is just a box with a point injected and raised. Nothing fancy!
let path = "M 3.9115288,12.97346 15.805024,2.3901266 27.698518,12.97346 V 33.152308 H 3.9115288 Z";
@awstanley
awstanley / bits.py
Last active November 13, 2019 05:40
DJA0230TLS Dump Status
# Goes in the same directory as the output;
# create `rendered` (folder) and put index.html in it
from json import JSONEncoder, JSONDecoder
JE = JSONEncoder()
JD = JSONDecoder()
store = []
@awstanley
awstanley / constexpr crc32 proof of concept.cpp
Last active November 28, 2018 06:54
CRC32 at compile time proof of concept. This can be expanded to virtually any other hash, and probably adapted to be cleaner in design (using the hash function as a template argument).
#include <cstdint>
namespace {
/// IEEE CRC32 table.
static constexpr std::uint32_t crc32_table[] = {
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
@awstanley
awstanley / CMakeLists.txt
Last active August 11, 2019 17:23
CMake helper file. I've kept many copies of this semi-private for years, this one just contains a little more code to help people along. (Updated to include some missing defines, all of the ones in the current test project, so as to be sure they're all there.)
# Copyright 2014-2017 A.W. 'aws' Stanley.
#
# Licensed under the Apache Licence, Version 2.0 [1] or
# MIT licence [2], at your option. This file may not be
# copied, modified, or distributed except according to
# those terms.
#
# [1] <http://www.apache.org/licenses/LICENSE-2.0>
# [2] <http://opensource.org/licenses/MIT>
0eNqlnetuXEeuhd9Fv62g7pe8ysHgwHY0GQGOZEjtgwkCv/uRM2q7J6ndWuurX0HieBWbxeKuIhfJP24+fPpy9/np/uF08/MfN/cfHx+eb37+nz9unu9/fXj/6dt/O/3++e7m55v7091vN+9uHt7/9u3f7v79+enu+fn29PT+4fnz49Pp9sPdp9PN13c39w+/3P375uf49d3bIJ/uPp6e7j/e/vPL08P7j3cXfz19/ce7m7uH0/3p/u4/Av35L7//78OX3z7cPb3gvyXKu5vPj88vf/3x4dv6L5C3ub67+f3ln7G/rPPL/dPL4n/+afkm6l/gE4BvOnz24VPU4QuATzp89eG7jt589KGjdxvdEH3Y4IbNTBvcMZkYfPhgwPvn1Tmu0T+vuRjw4LyW/Irf/hs/rfDBgS3FwK8b+PXrCrFtaKQKEneAHw2NDICfDPy5Ib+gnxQ25Ffwyfd16vpJ4ANbgoGfN+RX9FM25FfwwYnNw9APOL+5r/GX96e+IX8V8P9+fp8/f7o/nV7+cHU1+6ka2HPjbinoJoeNy6WCHy3dFEc3OW3cXBXZd27Givw7V2NF/rqBr8jf+N1bge8cXtHO4Hd7BX5yeEE5JeC3g4IeMbqgmpLw00RBzxhd0UzhLx8FvnJ4RTeNP6wU+M7hFeUM/m5TpJ8cXpC+Bv4sFKSvkcMr0qeNV1tZvdpq3kDMS8Sy8Q5cy1g3ENcy7tx1s7BPO3fd/PZdvXp33f79PlcE2efGXVTQTQuW7NWRvdF7riI3CQAXQ/ade66Cv3PPVfB37rmK/puztylYe7txyVVUs3HJVeAnl15QTg9cegXeOrPV2dae8AVaUHvnV1wFvWB0RTPVUHq3dN743VlRy8blVoEfHF5RzjTUnqKj9xH4vVlQzNjI1ijSb2RrFPjM4RXl7CRr0uqCOnbSM3GJuJOeWcvYNxDXMo6Na3kS9mnCEHEUcrE7IVxB9rlDb1DkTxv4ivwk/ZLX+Ksn0Swb13MFn6RfooFPnqTJwP9xWp8
package main
import (
_ "github.com/awstanley/go.sga"
"image"
"image/png"
"os"
)
func main() {
@awstanley
awstanley / dl.go
Created July 17, 2016 09:26
Elusive Target Tracker (downloads current manifest; will throw an error an m will be nil if it's down). Obviously it needs work, but it was developed rapidly during ET #6 as a proof of concept.
package main
import (
"github.com/awstanley/Hitman/Go/misc/elusivetracker"
"net/http"
)
func main() {
client := &http.Client{}
@awstanley
awstanley / hitman.txt
Created May 15, 2016 23:16
Hitman Benchmark (2016-05-15 11:34pm UTC)
System Info:
CPU Vendor: GenuineIntel
CPU Brand: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
CPU Cores: 8
CPU Speed: 3.40GHz
System Memory: 10.17GB / 15.90GB
GPU: AMD Radeon R9 200 / HD 7900 Series
GPU Memory: 2.98GB
Graphics Settings: