Skip to content

Instantly share code, notes, and snippets.

View Paraphraser's full-sized avatar

Phill Paraphraser

  • Cootamundra NSW Australia
View GitHub Profile
@Paraphraser
Paraphraser / ZeroTier-macOS-menu-bar.md
Created June 16, 2023 06:12
ZeroTier GUI controls in the macOS (Ventura) menu bar

On ZeroTier, macOS and the menu bar

Over at the ZeroTier forum is a thread:

The thread covers two distinct problems:

  1. The ZeroTier One.pkg package downloaded from ZeroTier.com won't install on macOS Ventura.
  2. The package installs but the associated app won't start and the menu bar item is not present.
@Paraphraser
Paraphraser / NodeRED_MidnightredTheme.md
Last active July 14, 2023 03:35
Recipe for installing Node-RED Midnight-red theme under IOTstack
@Paraphraser
Paraphraser / CalculatingBarometricPressureTrend.md
Last active July 14, 2023 03:37
Calculating barometric pressure trend

Calculating barometric pressure trend

This gist is a response to a Discord question. It explains my approach to deciding whether barometric pressure is rising, falling or remaining steady.

I do the trend calculation in Arduino (ESP8266) code. I tried to mimic the idea of setting the reference needle on a real barometer, waiting an hour, then seeing which way the pressure needle had moved with respect to the reference. The wrinkle is that "the last hour" is a moving window that updates every 10 minutes.

The BMP085 sensor is polled every 10 minutes. Until there are six observations (eg after a reboot) the code returns "training".

After that, the code does a least-squares regression on the last six observations (ie the last hour of data) to find the linear equation of best fit. In effect, the algorithm assumes that knowing the time (independent variable on the X axis) at some point in the past hour would permit the pressure at that time (dependent variable on the Y axis) to be estimated with some degree of

@Paraphraser
Paraphraser / IOTstack tutorial - two instances of Node-RED.md
Created July 24, 2023 11:32
IOTstack tutorial: running two instances of Node-RED on the same host

IOTstack tutorial: running two instances of Node-RED on the same host

Suppose you have a Node-RED container running but you want to create a test version where you can experiment safely without disturbing the original.

Running multiple instances of a container is something Docker excels at! This tutorial explains how to set it up. It will also help you to understand the differences between containers running in host mode and non-host mode.

Assumptions

  1. Your existing Node-RED service definition looks similar to this:
@Paraphraser
Paraphraser / IOTstackOverrideFiles.md
Last active September 9, 2023 19:15
IOTstack and "override" files

IOTstack and "override" files

As a general principle, I'm not in favour of override files. I think they muddy the waters. I think you're much better off editing docker-compose.yml directly.

That said…

When you use IOTstack to manage Docker containers, you have access to two override mechanisms:

  1. A compose-override.yml file. This mechanism is peculiar to IOTstack and is implemented by the so-called "new" menu on the master branch.
  2. A docker-compose.override.yml file. This mechanism is part of docker-compose.
@Paraphraser
Paraphraser / custom-os-builds.md
Created December 21, 2023 01:51
Installing IOTstack on custom OS builds

Installing IOTstack on custom OS builds

The following question appeared on the IOTstack Discord channel. It's the second part of a thread but I'll come back to the first part later:

I'm still struggling with this error. So the instruction says don't assign a password for root during the Debian installation. HOWEVER, the OS image that I'm using already comes with a default root password and I have to enter the default password to continue at the first step. Is there any way to remove this default password? Otherwise, it seems there is no way to continue the installations on this OS...

I don't want to over-sell this but the general thrust of the Unix industry over the last 20-odd years has been to avoid enabling the root account. In more recent times, security gurus, legislatures and best practice have been leading us to a world where there are no default accounts for anything.

Thus, while the general principle mu

@Paraphraser
Paraphraser / Removing bad data from InfluxDB.md
Last active February 16, 2024 22:30
IOTstack tutorial: removing bad data from InfluxDB

IOTstack tutorial: removing bad data from InfluxDB

A fairly common question from IOTstack users running InfluxDB is how to remove "bad data" from a database?

This gist focuses on InfluxDB 1.8 and the InfluxQL commands needed to operate upon an InfluxDB 1.8 database. You are entirely on your own if you are using InfluxDB 2.x.

prevention is better than cure

The best advice I can give you is to avoid the problem by ensuring that "bad data" never gets into your database in the first place. For example:

@Paraphraser
Paraphraser / Checking your Raspberry Pi's view of its power supply.md
Created June 13, 2022 06:53
Checking your Raspberry Pi's view of its power supply (sometimes it's not the wall-wart)

Checking your Raspberry Pi's view of its power supply

Sometimes it seems like the first (and sometimes only) advice you get offered for almost any problem with a Raspberry Pi is "check your power supply". You think something like:

"hey, I'm using an official power supply sold as being matched with my Pi so how can there be any problem?"

You look up the specs then stick a controlled load across your supply and confirm that it can deliver the required number of Watts.

Yet your problems persist…

@Paraphraser
Paraphraser / RPiWiFiFreeze.md
Last active March 27, 2024 03:41
Do your Raspberry Pi's Network Interfaces freeze? This may solve it.

Do your Raspberry Pi's Network Interfaces freeze?

My Raspberry Pi 4 kept losing its wlan0 interface. I could usually reconnect via Ethernet but, from time to time, I noticed that the eth0 interface would also go walkabout.

I tried a lot of things but the one described here seems to have cured the problem. I have no idea why it works. It just does.

Step 0 - are you a Windows user?

The script shown in the next step should be created on your Raspberry Pi. Please do not make the mistake of selecting the text, copying it into a text editor on your Windows machine, saving the file, and then moving the file to your Raspberry Pi. Unless you take precautions, Windows will add its 0x0d 0x0a (CR+LF) line endings and those will stop the script from working properly on your Raspberry Pi.

@Paraphraser
Paraphraser / IOTstack tutorial - adding a container.md
Last active April 1, 2024 23:06
IOTstack tutorial - adding a container

IOTstack tutorial - adding a container

This gist is a response to a Discord question asking:

is it possible to add my own container to IOTStack? for example: couchdb

The answer is "yes" and CouchDB is quite a good example to use for a tutorial.

contents