Skip to content

Instantly share code, notes, and snippets.

View xanderificnl's full-sized avatar
💭
Rest In Piece Xander 13-09-2023

Xander xanderificnl

💭
Rest In Piece Xander 13-09-2023
View GitHub Profile
@xanderificnl
xanderificnl / mqtt cheatsheet.md
Created March 29, 2023 04:44
MQTT cheat sheet

Quickly verify MQTT is up & listening via mosquitto_sub:

# mosquitto_sub -t '$SYS/broker/uptime'
242 seconds
253 seconds
264 seconds
275 seconds
286 seconds
297 seconds

Adjust these values to your environment

OS Container Engine Network Plugin Container IPv6 pool NIC
Fedora Server 37 podman netavark 2000:10:200:30fc::/64 enp2s0f0

NetworkManager

I assigned an IPv6-prefix from another pool to enp2s0f0 with my default gateway (fe80::1%enp2s0f0).

@xanderificnl
xanderificnl / readme.md
Last active February 18, 2023 05:25
HAOS @ OVH

Please be sure you want this. I assume no liability for you doing this.

  1. Boot a rescue system
  2. Download haos_generic-<arch>-<version>.img.xz
  3. Replace /dev/sdX and run xzcat haos_generic-*.img.xz | dd of=/dev/sdX bs=4M conv=fsync
  4. Verify via parted -l /dev/sdX (choose to Ignore the warning) - you should see a list of hassos-* partitions
  5. Restart from harddisk reboot

At this point, you'll need to wait for the server to reboot and for homeassistant to become available. A simple ping will let you know when the server is up. After awhile, you should be able to access homeassistant via http://:8123/

@xanderificnl
xanderificnl / readme.md
Created January 28, 2023 03:01
asdf elixir

Elixir sources not found (checking in /home/build/elixir). Code navigation to Elixir modules disabled.

Get the commit hash belonging to an Elixir release (i.e. 1.14.3 = 6730d669fb319411f8e411d4126f1f4067ef9231)

Install:

$ asdf install elixir ref:6730d669fb319411f8e411d4126f1f4067ef9231
$ asdf local elixir ref:6730d669fb319411f8e411d4126f1f4067ef9231
@xanderificnl
xanderificnl / transparent-ontop-titlebar.ahk
Created January 19, 2023 01:34
Keep a transparent window on top and remove titlebar
#SingleInstance Force
;;;
; Toggle on top + titlebar + transparency of window under mouse.
#j:: {
; WS_THICKFRAME (WS_BORDER + WS_DLGFRAME + WS_SIZEBOX)
WS_THICKFRAME := "0xC40000"
; Active mouse window
MouseGetPos(,, &ActiveWindow)
@xanderificnl
xanderificnl / switchbot-nimble-scanner.ino
Last active October 26, 2022 16:40
Scan for switchbot
/** Example of continuous scanning for BLE advertisements.
* This example will scan forever while consuming as few resources as possible
* and report all advertisments on the serial monitor.
*
* Created: on January 31 2021
* Author: H2zero
*
*/
#include "NimBLEDevice.h"
Preferences > Extra board URLs:
https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls
(S+ -> Wemos D1_Mini)
@xanderificnl
xanderificnl / docker_clean.sh
Created September 26, 2022 05:19 — forked from dantheman213/docker_clean.sh
Reset Docker to a clean vanilla state
#!/usr/bin/env bash
# Reset Docker to a clean vanilla state. Will destroy all containers, images, networks, volumes, and cache.
[ $(docker ps | wc -l) -ne 1 ] && echo "Stopping all containers..." && docker stop $(docker ps | sed -n '1d;p' | awk -F" " '{print $1}')
[ $(docker ps -a | wc -l) -ne 1 ] && echo "Deleting all containers..." && docker rm $(docker ps -a | sed -n '1d;p' | awk -F" " '{print $1}')
[ $(docker images | wc -l) -ne 1 ] && echo "Deleting all images..." && docker image rm $(docker images | sed -n '1d;p' | awk -F" " '{print $3}')
echo "Pruning networks, volumes, and cache..." && docker system prune -a -f --volumes
echo "Docker is back to Vanilla... COMPLETE!"
@xanderificnl
xanderificnl / random-ipv6-addr.py
Last active September 26, 2022 04:17 — forked from wido/random-ipv6-addr.py
Generate a random IPv6 address
#!/usr/bin/env python3
"""
Generate a random IPv6 address for a specified subnet
"""
from random import seed, getrandbits
from ipaddress import IPv6Network, IPv6Address
subnet = u'2a02:58:143:e00::/56'
@xanderificnl
xanderificnl / readme.md
Last active February 5, 2023 22:05
alpine + k3s

/etc/update-extlinux.conf

default_kernel_opts="nomodeset quiet rootfstype=ext4 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory consoleblank=120"

update-extlinux && reboot

Install k3s

curl -sfL https://get.k3s.io | INSTALL_k3S_EXEC='--disable servicelb --no-deploy traefik --flannel-backend=none --disable-network-policy' sh -