Skip to content

Instantly share code, notes, and snippets.

@dnschneid
dnschneid / uname.c
Last active February 21, 2023 00:06
LD_PRELOAD for capping the revision number reported by the uname syscall
/*
* LD_PRELOAD that caps the revision reported by uname to 255.
*
* Compile:
* gcc -shared -fpic uname.c -ldl -o uname.so
* Usage example:
* LD_PRELOAD='/path/to/uname.so' uname -r
*/
#define _GNU_SOURCE
#include <dlfcn.h>
@dnschneid
dnschneid / homeseer.md
Last active April 21, 2021 11:55
HomeSeer Z-Wave Switches, Central Scene Class, and HomeAssistant

HomeSeer Z-Wave Switches, Central Scene Class, and HomeAssistant

Applies to: HS-WS100+ and HS-WD100+ with both old and new firmware, and HS-WS200+ and HS-WD200+ since they seem to share the same firmware.

With the introduction of the 200 series, HomeSeer seems to also have upgraded their 100-series switches with new firmware. The new firmware changes the behavior of the Central Scene Class, which reports button events.

@dnschneid
dnschneid / getopts_hack
Last active August 29, 2015 14:12
getopts positional parameter reordering hack
#!/bin/sh -e
set -e
# Works mostly like built-in getopts but silently coalesces positional arguments.
# Does not take parameters. Set getopts_string prior to calling.
# Sets getopts_var and getopts_arg.
# $@ will be left with the positional arguments, so you should NOT shift at all.
# In bash, enables alias expansion until arguments are done being processed.
shopt -q -s expand_aliases 2>/dev/null || true
getopts_npos=0