Better thumb thingy for short movie clips

(Improvement of previous posted script)

Place below bash script in a subdir with media.

Animated GIFs are generated from the video files.
You can set the number of frames per length

#!/bin/bash
#set -x
mkdir -p tmp prev
: > list
: > index.html
find ../ -type f -print | egrep -i "mp4$|wmv$|avi$|mpg$|mpeg$|flv$|mov$|divx$"  > list

cat list | while read movie; do 
	rm -f tmp/*
	newname=$( echo $movie | tr -d ' /.[]{}()' ) 
	if [ ! -f prev/${newname}.gif ] ; then

		echo "Filename : $movie"

		kseconds=$( mediainfo --Inform="Video;%Duration%"  "$movie" )
		minutes=$(( $kseconds / 60000 ))
		echo "Minutes : $minutes"
		if [ $minutes -gt 10 ] ; then 
			rate=0.032
		else
			rate=0.128
		fi
echo "ffmpeg -hide_banner -loglevel error -i $movie -r $rate  -vf scale=640:-1 tmp/output_%04d.png"
		ffmpeg -hide_banner -loglevel error -i "$movie" -r $rate  -vf scale=640:-1 tmp/output_%04d.png < /dev/null
		# remove first (most of the time just black or logo)
		rm tmp/output_0001.png
		echo -n "Frames : "
		ls tmp/out* | wc -l
		convert -delay 50 -loop 0  tmp/output*.png prev/${newname}.gif
	else
		echo "$movie exists ... skipping"
	fi
	echo "<h1>${movie}</h1><br>" >> index.html
	echo "<img src=\"prev/${newname}.gif\"><br>" >> index.html
done
exit 0

run and get something like below (output is still running as I made this post)

First tests with 360 Lidar

In the past, I’ve played with a standard lidar device.

Now it is time to check out a 360 version.

This one is very small (40mm x 40mm x 35mm)

Provided examples didn’t work. (People with same error on the Github issues tracker page had the same)

I changed the python script so it worked also with this YDLidar T-mini Plus version.

Next to-do, put this on my robot car.

Code:

import os
import ydlidar
import time
import sys
from matplotlib.patches import Arc
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np

RMAX = 32.0

fig = plt.figure()
lidar_polar = plt.subplot(polar=True)
lidar_polar.autoscale_view(True,True,True)
lidar_polar.set_rmax(RMAX)
lidar_polar.grid(True)
ports = ydlidar.lidarPortList();
port = "/dev/ttyUSB0";
for key, value in ports.items():
    port = value;
    
laser = ydlidar.CYdLidar();

laser.setlidaropt(ydlidar.LidarPropSerialPort, port);
laser.setlidaropt(ydlidar.LidarPropSerialBaudrate, 230400);
laser.setlidaropt(ydlidar.LidarPropLidarType, ydlidar.TYPE_TRIANGLE);
laser.setlidaropt(ydlidar.LidarPropDeviceType, ydlidar.YDLIDAR_TYPE_SERIAL);
laser.setlidaropt(ydlidar.LidarPropScanFrequency, 10.0);
laser.setlidaropt(ydlidar.LidarPropSampleRate, 4);
laser.setlidaropt(ydlidar.LidarPropSingleChannel, False);
laser.setlidaropt(ydlidar.LidarPropMaxAngle, 180.0);
laser.setlidaropt(ydlidar.LidarPropMinAngle, -180.0);
laser.setlidaropt(ydlidar.LidarPropMaxRange, 16.0);
laser.setlidaropt(ydlidar.LidarPropMinRange, 0.02);
laser.setlidaropt(ydlidar.LidarPropIntenstiy, True);

scan = ydlidar.LaserScan()

def animate(num):
    
    r = laser.doProcessSimple(scan);
    if r:
        angle = []
        ran = []
        intensity = []
        for point in scan.points:
            angle.append(point.angle);
            ran.append(point.range);
            intensity.append(point.intensity);
        lidar_polar.clear()
        lidar_polar.scatter(angle, ran, c=intensity, cmap='hsv', alpha=0.95, marker=".")

ret = laser.initialize();
if ret:
    ret = laser.turnOn();
    if ret:
        ani = animation.FuncAnimation(fig, animate, interval=50)
        plt.show()
    laser.turnOff();
laser.disconnecting();
plt.close();

Mattermost notification thingy

3D printed a little light case for a wemos and a piece of WS2812 led strip I had lying around.

Schematic:
NOTE: The resistor is 100-500 ohm (I forgot, just try)
You can only use this trick for a few leds (I used 4), else you better can use the sacrifice a led to make a level shifter trick.
(Wemos logic is 3.3V and the led strip is 5V)

I flashed ESPHome on the wemos using the flasher in Home Assistant.

Code:

esphome:
  name: matternotification
  friendly_name: matternotification

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "ogFxZUXerNxxxxxxxxxxxxxxxxxWaWyJVxCM="

ota:
  - platform: esphome
    password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Matternotification"
    password: "rxxxxxxxxxxxxxxx"

captive_portal:

light:
  - platform: neopixelbus
    type: GRB
    variant: WS2812
    pin: D4
    num_leds: 4
    name: "NeoPixelMattermost"        

To get the status of messages and controlling the HA entity, I made a bash script.

First curl command to get a token from Mattermost using the API.
Second curl command to get messages states from Mattermost.

Bottom two curl command turn a light entity on or off in your Home Assistant server using a API

#!/bin/bash
#set -x
# change : mattermost username and password (and server)
# change : mattermost userid and teamid
# change : home assistant long time token (and HA server) 
# change : light entity
#
while true; do
# Get token using login
#token=$(curl -s -i -X POST -H 'Content-Type: application/json' -d '{"login_id":"username","password":"password"}' https://mattermostinstance.com/api/v4/users/login | grep ^Token | awk '{ print $2 }' | tr -d '\r' )
#using a MM auth token (see below)
token=xxxxxxxxxxxxxxxxxxxx

# Get messages 
# Gives you something like
# {"team_id":"j3fd7gksxxxxxxxxxxxxxjr","channel_id":"rroxxxxxxxxxxxxxxtueer","msg_count":0,"mention_count":0,"mention_count_root":0,"urgent_mention_count":0,"msg_count_root":0}
# We need to count ":0" 

messages=$(curl -s  -i -H "Authorization: Bearer ${token}"  https://mattermostinstance.com/api/v4/users/ou5nz5--USER-UUID--rbuw4xy/channels/rropejn--TEAM-ID--tueer/unread | grep channel 
| grep -o ":0" | wc -l)

# If 5 times ":0" then no messages
if [ $messages == 5 ] ; then
# Turn off
curl -s -X POST -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cC--HOME-ASSISTANT-LONG-TIME-TOKEN-CBusTgTUueWpPNdH5WAWOE" \
       -H "Content-Type: application/json" \
       -d '{"entity_id": "light.matternotification_neopixelmattermost_2"}' \
       http://192.168.1.2:8123/api/services/light/turn_off > /dev/null
else
# Turn on
curl -s -X POST -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cC--HOME-ASSISTANT-LONG-TIME-TOKEn--CBusTgTUueWpPNdH5WAWOE" \
       -H "Content-Type: application/json" \
       -d '{"entity_id": "light.matternotification_neopixelmattermost_2"}' \
       https://192.168.1.2:8123/api/services/light/turn_on > /dev/null
fi
sleep 5
done

Get a Long-lived access token from HA:

Profile > Security and Create Token

Create a token in Mattermost:

Whisky Festival 2025

Going with my friend Vincent to the Whisky Festival, with some of his friends.
Missing the train, buying whisky coins every half hours, some beers afterwards. Fun times.
Bought some cigars accompanying the whiskies.
Seen Wullie Macmorland walking around.
I’ve played pipes in his restaurant several times in the 90’s
Last time I’ve seen him is 10+ years ago, with a great story.

When I walked into his restaurant, he remembered me. And my love for whisky.
Before I could sit down, he called me to his bar.
“I have a whisky you have to try!” He said.
Sneaky with the bottle below the counter, he poured me a “whisky”.
It was disgusting !
I said, “THAT’s not whisky!”
“Yes it is!” he smiled. Safari whisky!
He was laughing at my disgusted face.
“Someone gave it to me, it’s everything but whisky.”
It’s even bad for lamp oil! LOL

Jup, I am a fan of smoky whiskies.

UPDATE:
20250312 – Liquid BBQ smoke whisky delivered ..

Some 3D printing

Made a cap for a mushroom button, with editable text.

It’s on makersworld:
https://makerworld.com/en/models/1093945

Also made some chair thingies. We have wooden floors and her new chair has pointy feet.

Made using Openscad

difference(){
union(){
cylinder(h=5,d=30);

translate([0,0,1.5]){
difference(){
rotate([20,0,0])
cylinder(h=30,d=25);

rotate([20,0,0])
cylinder(h=30,d=17);
}
}
}
translate([0,0,-5])
cylinder(h=5,d=30);
}

Some tests with SDR (Software Defined Radio)

I’ve got a little SDR stick a while ago with some antenna’s.

I’ve got some extra antenna’s

So I was playing around with P2000 and Airplane Radio (tracking overhead planes)

Airplane info in terminal
P2000 info
Local webserver on my laptop tracking overhead planes.

For debugging I used SigDigger

dump1090-mutability --aggressive --interactive --net --net-http-port 8080 --net-sbs-port 30003 

git clone https://github.com/Zanoroy/multimon-ng.git
 cd multimon-ng/
 mkdir build
 cd build
 cmake ..
 make
rtl_fm -f 169.65M -M fm -s 22050 -p 83 -g 30 | ./multimon-ng -a FLEX -t raw /dev/stdin

dump1090-fa --interactive

"If something is worth doing, it's worth overdoing."