Skip to content

Instantly share code, notes, and snippets.

@roens
roens / RPiOS-on-HA-Yellow.md
Last active June 5, 2023 01:39
Raspberry Pi OS on Home Assistant Yellow

So far, this is a WIP

I'll drop WIP status when I've worked out:

  • ✅ Yellow boots Raspberry Pi OS
  • Running in Docker (compose):
    • ✅ Home Assistant
    • Zigbee2MQTT (Z2M): Can add & communicate with Zigbee devices
    • Z-Wave JS UI: Can add & communicate with Aeotec Z-Pi 7 radio (I don't yet have any Z-Wave devices)
      • Sticking point so far is working out how to connect it to the proper UART port, which may be conflicting with the built-in Bluetooth radio in the CM4
  • ✅ Mosquitto (MQTT)
@roens
roens / shell.sh
Last active June 25, 2020 22:50
CLI tools for working with AWS ECS Service Discovery. In the absense of any useful Console view of thw whole Service Discovery scene in an account, I've found it necessary to come up with all this.
# A "1-liner" for listing all services.
aws servicediscovery list-services --query 'Services[].{Id:Id,Name:Name}' --output text | sort -bk 2
# A "1-liner" for deleting cruft services, and any associated insttance registrations.
# The `$id` at the start is one from the first column of the above command to list services.
id=''; \
instances=$( \
aws servicediscovery list-instances --service-id $id --query 'Instances[*].Id' --output text \
); \
for x in $instances; do
@roens
roens / docker-compose-install.sh
Last active April 11, 2022 00:18
A bash function for installing/updating docker-compose
# Add to your ~/.bash_aliases or preferred spot for such functions:
docker-compose-install (){
if [ ! "$(type -p jq)" ]; then
echo -e "** Fail! This needs jq. Please do one of:\n apt install jq\n port install jq"
return 99
fi
[ $(type -p docker-compose) ] && \
current_version=$(docker-compose -v | awk '{print $4}')
current_version="${current_version:-v0.0.0}"
@roens
roens / supervisor-log-compress.sh
Last active March 1, 2021 07:49
Since `supervisord` [lacks an option for compression of rotated log files](https://github.com/Supervisor/supervisor/issues/322), I wrote this script. It works well to live in `/etc/cron.daily`.
#!/usr/bin/env bash
# supervisor-log-compress.sh
#
# supervisord writes logs, and rotates them, but does not compress old log
# files. This script is meant to help with that cleanup, reclaiming storage.
#
# A nice place for this script is in: /etc/cron.daily/
for f in /var/log/supervisor/*.log.*; do
@roens
roens / confluence-cloud-backup
Last active June 6, 2019 00:33
Automated backup of Atlassian Confluence Cloud is a relatively sad scene. API calls are undocumented, with only anecdotal references to be found as to which endpoints are for what. After much research, I ended up with this script for automating backups. The resulting zip file is ends up being stored in an S3 bucket, using AWS's [SSE-C](http://do…
#!/usr/bin/env ruby
# This is for triggering & capturing backups of Atlassian's Confluence cloud
# service.
#
# https://docs.atlassian.com/jira/REST/cloud/
# https://bitbucket.org/atlassianlabs/automatic-cloud-backup/src/
# https://github.com/ghuntley/atlassian-cloud-backup/issues/5
# https://github.com/den-crane/my-stupid-scripts/blob/master/jira_backup.sh

Keybase proof

I hereby claim:

  • I am roens on github.
  • I am roens (https://keybase.io/roens) on keybase.
  • I have a public key whose fingerprint is DBB5 EB73 2D9E B1AB D101 A98A 5811 66FB A46E 29EB

To claim this, I am signing this object:

char pinBrakeLight = 6; // brake output pin
char pinRunLight = 5; // running light output pin
char pinBrakeSense = 8; // brake sense pin
boolean didBlink = false;
boolean brakeState; // brakes activated or not?
boolean runLightState = true; // running lights on?
unsigned long remindTimer; // tracking when to blinky remind
boolean dbg = false; // debug or not debug?
void setup()