Skip to content

Instantly share code, notes, and snippets.

Using pdftk

Create file pdf_info.txt:

PageLabelBegin
PageLabelNewIndex: 1
PageLabelStart: 1
PageLabelPrefix: Cover
PageLabelNumStyle: NoNumber
PageLabelBegin
[Unit]
Description=Node.js HomeKit Server
After=syslog.target network-online.target
[Service]
Type=simple
User=homebridge
ExecStart=/usr/bin/homebridge -U /etc/homebridge
Restart=on-failure
RestartSec=10
@moritzmhmk
moritzmhmk / rcswitch.js
Created January 3, 2017 12:29
control a 433Mhz switch with nodejs using rpio
const rpio = require('rpio')
rpio.init({mapping: 'gpio'})
rpio.open(17, rpio.OUTPUT)
const defaultProtocol = {
tristate: true,
pulseLength: 350,
zero: {high: 1, low: 3},
one: {high: 3, low: 1},
sync: {high: 1, low: 31}
@moritzmhmk
moritzmhmk / BluetoothLETemperatureSensor.md
Last active February 22, 2017 19:01
Bluetooth LE Temperature Sensor Setup
hciconfig hci0 up
btmgmt -i hci0 le on
hcitool -i hci0 lescan
gatttool -i hci0 -b XX:XX:XX:XX:XX:XX --characteristics
const noble = require('noble')
@moritzmhmk
moritzmhmk / openwrt.md
Last active February 18, 2017 14:48
OpenWRT on TL-WR841N

Installation via WebUI is not possible anymore (Error 18005).

Use TFTP method instead

Currently there is no official Image for v11 that includes luci - use this found here

Guide for macOS

tftp is preinstalled - GUI is available.

@moritzmhmk
moritzmhmk / miniDV.md
Created April 14, 2017 18:12
miniDV conversion

read and print recorded date

for i in "$@"
do
	echo $i `mediainfo "$PWD/$i" | grep "Recorded date"`
done

concat multiple files

#include <Wire.h>
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
#include <LiquidCrystal_I2C.h>
// addr, En, Rw, Rs, d4, d5, d6, d7, backlight, backlighPolarity
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, 0); // Set the LCD I2C address
void setup()
{
pinMode(A2, OUTPUT);
@moritzmhmk
moritzmhmk / rpi_camera_v4l2_ffmpeg.md
Last active December 17, 2024 12:05
using raspberry pi camera with ffmpeg (hardware accelerated)

Using Raspberry Pi Camera with ffmpeg

Capturing video from the rpi camera with ffmpeg can vary from less than 5% to 100% of the CPU (rpi zero) depending on ffmpeg using the hardware acceleration or not.

On many github issues one finds the suggestion of using h264_omx codec to use the gpu - but it does not ship with the default ffmpeg on Raspbian.

Instead I found that one can use the v4l2 driver provided by raspbian to get hardware accelerated h264 output. Also setting the video size will save one from using a (cpu) scale filter.

ffmpeg

capture h264 video from rpi camera

@moritzmhmk
moritzmhmk / stm32f103c8t6.lib
Created January 18, 2018 23:34
STM32F103C8T6 KiCad
EESchema-LIBRARY Version 2.3
#encoding utf-8
#
# STM32F103C8T6
#
DEF STM32F103C8T6 U 0 40 Y Y 1 F N
F0 "U" 200 0 60 H V C CNN
F1 "STM32F103C8T6" 0 0 60 H V C CNN
F2 "" 200 0 60 H I C CNN
F3 "" 200 0 60 H I C CNN