Skip to content

Instantly share code, notes, and snippets.

View mox1's full-sized avatar

James Tyra mox1

  • Minneapolis, MN, USA
View GitHub Profile
@mox1
mox1 / low-battery-level-detection-notification-for-all-battery-sensors.yaml Home Assistant Blueprint: Low battery level detection & notification for all battery sensors
blueprint:
name: Low battery level detection & notification for all battery sensors
description: Regularly test all sensors with 'battery' device-class for crossing
a certain battery level threshold and if so execute an action.
domain: automation
input:
threshold:
name: Battery warning level threshold
description: Battery sensors below threshold are assumed to be low-battery (as
well as binary battery sensors with value 'on').
@mox1
mox1 / keybase.md
Created January 19, 2021 20:48
keybase.md

Keybase proof

I hereby claim:

  • I am mox1 on github.
  • I am jttyra (https://keybase.io/jttyra) on keybase.
  • I have a public key ASAGgNmpgMyrmEG53dl-cECDdiTgaTfTrbPluI3jbtdsego

To claim this, I am signing this object:

@mox1
mox1 / opensles_android.cpp
Last active August 29, 2015 14:19
How to use Opensl ES (aka low level audio) on Android - Part of a Spotify mobile App I wrote
/* Code Written by mox1
* http://moxone.me/
* The code contained within is part of a larger Android Application. Portions of this code
* also rely on the "Poco" C++ library.
*
* Copyright (c) 2015, [email protected]
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@mox1
mox1 / AudioBuffer.h
Last active August 29, 2015 13:57
Audio Ring Buffer - used within SSRadio. Supports atomic reads and writes.
/*
* AudioBuffer2.h
*
* Created on: Jul 30, 2013
* Author: mox1
*/
#ifndef AUDIOBUFFER2_H_
#define AUDIOBUFFER2_H_
#this function allows us to do periodic things
#not perfect, but eh.
#for now this simply updates the statistics
#but could easily be used to do more "cron" like things
#this gets called for EVERY page, so don't do any heavy lifting
next_cron_run = 0
def my_processor(handler):
global next_cron_run
if (time.time() > next_cron_run):
logger.debug("DOING CRON RUN")