Skip to content

Instantly share code, notes, and snippets.

@moritzmhmk
moritzmhmk / lono-thermo-hygro-BLE.js
Created October 5, 2023 10:33
Read and parse data from the "Lono Thermo Hygro" sensor.
/**
* Copyright 2023 moritzmhmk.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the “Software”),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
@moritzmhmk
moritzmhmk / switchbot-th-outdoor.js
Last active September 2, 2023 12:26
Read SwitchBot Indoor/Outdoor Thermo-Hygrometer
const noble = require('@abandonware/noble');
noble.on('stateChange', async (state) => {
if (state === 'poweredOn') {
await noble.startScanningAsync([], false);
}
});
noble.on('discover', async (peripheral) => {
if (peripheral.address !== "d5:c4:31:13:41:98") return
@moritzmhmk
moritzmhmk / utils.elm
Created November 10, 2021 17:18
Elm Utils
-- source: https://thoughtbot.com/blog/debugging-dom-event-handlers-in-elm
loggingDecoder : Decoder a -> Decoder a
loggingDecoder realDecoder =
Decode.value
|> Decode.andThen
(\event ->
case Decode.decodeValue realDecoder event of
Ok decoded ->
Decode.succeed decoded
$ raspivid -t 0 -w 1280 -h 720 -fps 25 --codec H264 --intra 75 --inline --flush -o - | ffmpeg -i pipe:0 -codec copy -f v4l2 /dev/video1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@moritzmhmk
moritzmhmk / HifiBerryCaseCoverDigi.md
Last active October 30, 2020 13:54
HiFiBerry Case Cover for the HiFiBerry Digi+
@moritzmhmk
moritzmhmk / HLS.md
Last active April 23, 2020 08:19 — forked from mrbar42/README.md
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
 |- 360p.m3u8

run.sh

#!/bin/bash
xset s off &
xset -dpms &
xset s noblank &
unclutter &
chromium-browser\
 --window-position=0,0\
 --window-size=$(cat /sys/class/graphics/fb0/virtual_size)\
[Unit]
Description=Set up loopback cameras
[Service]
ExecStartPre=/sbin/modprobe v4l2loopback devices=3
ExecStart=/usr/bin/ffmpeg -f video4linux2 -input_format yuv420p -video_size 1280x720 -i /dev/video0 -codec copy -f v4l2 /dev/video1 -codec copy -f v4l2 /dev/video2 -codec copy -f v4l2 /dev/video3
Restart=always
RestartSec=2
[Install]
@moritzmhmk
moritzmhmk / NodeOnPiZero.md
Created June 10, 2019 13:37
Install Node On Raspberry Pi Zero (armv6)

Find the latest LTS release. Currently the LTS version is 10.x and the latest release can be found here (choose the file ending with -linux-armv6l.tar.xz).

Download that file: wget https://nodejs.org/dist/latest-v10.x/node-v10.16.0-linux-armv6l.tar.xz

Unpack the file: tar -xvf node-v10.16.0-linux-armv6l.tar.xz

Copy the content over to /usr/local: sudo cp -r node-v10.16.0-linux-armv6l/* /usr/local/