Skip to content

Instantly share code, notes, and snippets.

View grantland's full-sized avatar

Grantland Chew grantland

View GitHub Profile
@grantland
grantland / low-battery-level-detection-notification-for-all-battery-sensors.yaml
Last active March 30, 2025 23:22 — forked from sbyx/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').
@grantland
grantland / last-seen-detection-notification-for-all-sensors.yaml
Created March 30, 2025 23:08
Home Assistant Blueprint: Last seen detection & notification for all sensors
# Modified from sbyx/low-battery-level-detection-notification-for-all-battery-sensors.yaml
# https://gist.github.com/sbyx/1f6f434f0903b872b84c4302637d0890
blueprint:
name: Last seen detection & notification for all sensors
description: Regularly test all sensors with 'last_seen' attribute for crossing
a certain last seen threshold and if so execute an action.
domain: automation
input:
threshold:
blueprint:
name: Zooz ZEN72 Paddle Scene Control (Z-Wave JS)
description: Zooz Dimmer/Switch Paddle Scene Control (ZEN72)
domain: automation
input:
switch:
name: Zooz Device
description: Paddle supporting up/down 1-5x presses. Note that scene control adds actions to run alongside default behavior (and does not replace defaults).
selector:
device:
@grantland
grantland / README.md
Last active December 21, 2024 05:53
Recovering from Frigate boot loop due to undetected Coral TPU

Recovering from Frigate boot loop due to undetected Coral TPU

Frigate seems to get stuck in a bootloop if the Coral TPU becomes undetected: blakeblackshear/frigate#2904

Sometimes a system reboot fixes the issue.

If that doesn't fix the issue, removing and rescaning the device seems to help: blakeblackshear/frigate#7323

$ lspci # find the Coral Edge TPU deviceid
@grantland
grantland / hexalter.cpp
Created October 2, 2015 07:07 — forked from Jakz/hexalter.cpp
Simple cmmand line byte modifier that replaces raw bytes inside a given file
#include <stdint.h>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
using namespace std;
struct Patch
{
@grantland
grantland / sleephack.cpp
Created October 2, 2015 07:07 — forked from Jakz/sleephack.cpp
GBA Sleep Hack
#include <cstdio>
#include <cassert>
#include <stdint.h>
#include <vector>
#include <string>
#include <iostream>
#include <iomanip>
using namespace std;
@grantland
grantland / AGB-001_Light_Mod.md
Last active April 1, 2025 17:45
AGB-001 Front/Backlight Mod Instructions

AGB-001 Front/Backlight Mod Instructions

AGB-001 Backlight Mod

Requirements

  • AGB-001
  • ASS101 screen
----- pid 1297 at 2015-03-11 19:47:34 -----
Cmd line: system_server
ABI: x86_64
Build type: optimized
Zygote loaded classes=3593 post zygote classes=2212
Intern table: 38395 strong; 1947 weak
JNI: CheckJNI is on; globals=826 (plus 15 weak)
Libraries: /system/lib64/libandroid.so /system/lib64/libandroid_servers.so /system/lib64/libaudioeffect_jni.so /system/lib64/libcompiler_rt.so /system/lib64/libjavacrypto.so /system/lib64/libjnigraphics.so /system/lib64/libmedia_jni.so /system/lib64/librs_jni.so /system/lib64/libsoundpool.so /system/lib64/libwebviewchromium_loader.so /system/lib64/libwifi-service.so libjavacore.so (12)
Heap: 1% free, 10MB/10MB; 148650 objects
@grantland
grantland / README.md
Last active April 12, 2025 02:09
NextBus API
@grantland
grantland / post.md
Last active February 9, 2023 05:09
RecyclerView item onClick

RecyclerView item onClick

RecyclerView does not have an OnItemClickListener like it's predecessor, ListView. However, detecting item clicks is pretty simple.

Set an OnClickListener in your ViewHolder creation:

private class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder>  {

    public static class ViewHolder extends RecyclerView.ViewHolder