Skip to content

Instantly share code, notes, and snippets.

View machinekoder's full-sized avatar
💻
view-source

Alexander (Rössler) Poss machinekoder

💻
view-source
View GitHub Profile
@machinekoder
machinekoder / gist:3ba0e8a7172c0804bc3e68e25ec49bed
Last active October 6, 2023 14:34
MQTT Retain Flag and Potential Problems

MQTT Retain Flag and potential Problems

This document summarizes my findings in potential problems using the MQTT retain flag as a default for every topic in an MQTT application. MQTT retain is a useful feature if used properly. However, the risks of using it (as developer and for users of the software) are rarely warned about in many guides. Only when working with IoT applications for some time and reading through user forums, the MQTT specs and with a bit experience using other middleware projects potential risks may surface. I write this document mainly for myself for future implementation of MQTT application so I can make better decision when to use and when not use the MQTT retain flag.

Note that I'm only considering the MQTT 5 specs here. This document is not a writeup in prosa (except for this section here maybe) and should be used more as a sheet of notes with links for making your own decisions. It's by no means complete and comments helping me improve this document are welcome.

Expected Beha

@machinekoder
machinekoder / Emacs.kms
Last active September 28, 2023 04:04
Emacs keys for Qt Creator
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE KeyboardMappingScheme>
<!-- Written by Qt Creator 4.2.1, 2017-03-27T21:24:06. -->
<mapping>
<shortcut id="CppTools.OpenHeaderSourceInNextSplit">
<key value="Ctrl+E, F4"/>
</shortcut>
<shortcut id="CppTools.SwitchHeaderSource">
<key value="F4"/>
</shortcut>
@machinekoder
machinekoder / description.md
Last active June 14, 2023 08:29
Valetudo MQTT Map Segment issue

Issue

According to https://valetudo.cloud/pages/integrations/mqtt.html#mapsegmentssegments map segment ids should be reported on the topic <TOPIC PREFIX>/<IDENTIFIER>/MapData/segments.

This works well if "Provide map data" is checked in the Valetudo settings and this in line with the description in the docs.

However, when "Provide map data" is unchecked an empty JSON object is published to that topic. This undefined or at least undocumented behavior. Citing from the documentation This handle groups access to map data. It is only enabled if provideMapData is enabled in the MQTT config.

Note that <TOPIC PREFIX>/<IDENTIFIER>/MapData/map-data is still retained in this case if it was previously published.

UPDATE: When pressing "Save Configuration" in the UI switching "Provide map data" to "On" there is a ~30s delay until the segments are published on the topic. When switching from "On" to "Off" state, the message is received almost instantly. This can lead to perception of an intermittend issue if th

@machinekoder
machinekoder / Google Play Api - Apk Upload.md
Last active April 3, 2023 14:03 — forked from martarodriguezm/Google Play Api - Apk Upload.md
This python script uploads an apk file into Google Play Store using Android Play Publisher API

In Google Developer Console inside your app project, on the Credentials section, you must create a new "Service Account" "Client ID", if you have not already. And download the p12 file. You need the service account key file, generated in the Google APIs Console into the same directory and rename it to key.p12.

On Google Play Developer Console you have to give permissions to "YOUR_SERVICE_ACCOUNT_EMAIL@developer.gserviceaccount.com" for uploading apks.

Installation

Download Google APIs Client Library for Python (google-api-python-client): https://code.google.com/p/google-api-python-client/ or use pip:

$ pip install google-api-python-client
@machinekoder
machinekoder / qtquickvcp_install.sh
Last active November 25, 2022 23:12
Install QtQuickVcp on fresh Debian Wheezy
#!/bin/bash
sudo sh -c \
"echo 'deb http://deb.dovetail-automata.com wheezy main' > \
/etc/apt/sources.list.d/machinekit.list; \
apt-get update ; \
apt-get install dovetail-automata-keyring"
sudo apt-get update
sudo apt-get install -y build-essential gdb subversion dh-autoreconf libgl1-mesa-dev lynx pkg-config dovetail-automata-keyring python-protobuf libprotobuf-dev protobuf-compiler libnotify-bin libczmq-dev python-zmq libzmq4-dev
mkdir -p ~/bin/Qt
@machinekoder
machinekoder / fix_rosinstall.py
Created February 7, 2019 09:34
Fix .rosinstall file for the time the GitHub is around (see https://github.com/vcstools/vcstools/issues/147)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import shutil
import sys
import tarfile
import tempfile
from sh import wget
import os
import yaml
@machinekoder
machinekoder / ros-bb-stretch.sh
Last active January 21, 2019 20:44 — forked from mhaberler/ros-bb-jessie.sh
installing ROS kinetic ROS-comm on beaglebone stretch
# derived from http://wiki.ros.org/ROSberryPi/Installing%20ROS%20Kinetic%20on%20Raspberry%20Pi
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu stretch main" > /etc/apt/sources.list.d/ros-latest.list'
wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade
@machinekoder
machinekoder / SimpleTweak.py
Created December 3, 2018 16:25
Cura PostProcessingPlugin for my 3D printer
from ..Script import Script
class SimpleTweak(Script):
def __init__(self):
super().__init__()
def getSettingDataString(self):
return """{
"name":"SimpleTweak (for Alex Uni-Print-3D)",
"key": "SimpleTweak",
"metadata":{},
@machinekoder
machinekoder / btrfs_cleanup.sh
Created November 8, 2018 11:29
Cleanup Docker Btrfs
sudo su
service docker stop
ls -d -1 /var/lib/docker/btrfs/subvolumes/* | xargs btrfs subvolume delete
rm -rf /var/lib/docker
@machinekoder
machinekoder / register.py
Created July 4, 2015 06:29
Registers a new systemd service
#!/usr/bin/python
import subprocess
import shlex
import sys
import argparse
if sys.version_info[0] > 2:
user_input = input
else:
user_input = raw_input