Draw circle sector in Android

Today I had program a heading indicator for a Android map-view (osmdroid). My idea was to use a circle sector (similar to most map applications). After some experiments, I came up with the following code. It uses a Path and basic trigonometric functions: private fun Canvas.drawCircleSector( x: Float, y:…

Resize LVM Volume after changing disk size of VM

Today I realized that the root partition of one of my server-VMs was completely full which caused errors in various different services running on this VM. My Goal was to resize the root partition without rebooting the VM (because it was running some production code). The first step was to…

ESP8266 switch pin via MQTT

This is a simple code template to switch a pin of an ESP8266 microcontroller using MQTT. The example turns PIN D7 on if "1" was received at the "candle" MQTT topic. All other messages turn the pin off. #include <Arduino.h> #include <ESP8266WiFi.h> #include <…

Detect iPhone presence in Node-Red

Detecting the presence of an iOS device in the network can be challenging because iOS does not respond to ICMP ping messages. Fortunately, nmap can be used to check the host's availability. Command of the exec-node: nmap -sn 192.168.1.101 The function node is used to check if…