Skip to content

Instantly share code, notes, and snippets.

View kevinjonesevans's full-sized avatar

Kevin Jones-Evans kevinjonesevans

View GitHub Profile
# Watch Yamaha AV receivers for events
#
# This script watches a Yamaha AV receiver for changes in state.
# It also implements two functions for changing the volume which is a fun
# way to "help" unsuspecting users.
#
# Protocol is here: https://www.sdu.se/pub/yamaha/yamaha-ynca-receivers-protocol.pdf
require "socket"
require "io/wait"
@mbinna
mbinna / effective_modern_cmake.md
Last active May 3, 2024 15:44
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

cons = fn (a, b) -> fn x -> x.(a, b) end end
car = fn (p) -> p.(fn (q, _) -> q end) end
cdr = fn (p) -> p.(fn (_, q) -> q end) end
each = fn (list, func) ->
iter = fn (list, func, next) ->
(fn (a, nil) -> func.(a)
(a, b) -> func.(a); next.(b, func, next)
end).(car.(list), cdr.(list))
end
iter.(list, func, iter)
@jdalegonzalez
jdalegonzalez / jwt_validator.py
Last active January 31, 2023 13:03
Uses the the python-jose package to decode and validate an amazon identity or access token.
#!/usr/bin/env python3
"""
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,