Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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}
[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

Using pdftk

Create file pdf_info.txt:

PageLabelBegin
PageLabelNewIndex: 1
PageLabelStart: 1
PageLabelPrefix: Cover
PageLabelNumStyle: NoNumber
PageLabelBegin
@moritzmhmk
moritzmhmk / CEC_Pi_zero.md
Last active July 30, 2017 17:11
CEC Pi zero

Faking HDMI Port

echo "pa 30 00" | cec-client

sets physical address to 3.0.0.0 - which is HDMI Port 3 - receiving remote control signals from different hdmi port

Use Pi zero as "Pulse8 CEC Adapter"

Enable USB Serial

/boot/config.txt add dtoverlay=dwc2 /boot/cmdline.txt add modules-load=dwc2 (not dwc2,g_serial - see below)

@moritzmhmk
moritzmhmk / sane-rpi-arch.md
Last active February 21, 2016 16:43
Network Scanner on Raspberry Pi
pacman -S sane
gpasswd -a moritz scanner
gpasswd -a moritz lp

sane-find-scanner
nano /etc/sane.d/saned.conf
	192.168.1.0/24

systemctl enable saned.socket
systemctl start saned.socket
@moritzmhmk
moritzmhmk / lws.patch
Created December 20, 2015 15:28
Patch mosquitto for new libwebsocket API
diff -Naur a/lib/net_mosq.c a/lib/net_mosq.c
--- a/lib/net_mosq.c 2015-12-20 16:21:08.560283714 +0100
+++ a/lib/net_mosq.c 2015-12-20 16:13:17.750398153 +0100
@@ -166,7 +166,7 @@
#ifdef WITH_BROKER
# ifdef WITH_WEBSOCKETS
if(mosq->wsi){
- libwebsocket_callback_on_writable(mosq->ws_context, mosq->wsi);
+ lws_callback_on_writable(mosq->wsi);
return 0;
@moritzmhmk
moritzmhmk / root-ro
Last active October 2, 2015 20:01 — forked from niun/root-ro
Read-only Root-FS with overlayfs for Raspian
#!/bin/sh
#
# Read-only Root-FS for Raspian
#
# Modified 2015 by Pascal Rosin to work on raspian-ua-netinst with
# overlayfs integrated in Linux Kernel >= 3.18.
#
# Originally written by Axel Heider (Copyright 2012) for Ubuntu 11.10.
# This version can be found here:
# https://help.ubuntu.com/community/aufsRootFileSystemOnUsbFlash#Overlayfs
@moritzmhmk
moritzmhmk / ddi.sh
Last active September 25, 2015 17:29
improved dd with percentage
#!/bin/bash
in="$1"
out="$2"
if [[ $# -ne 2 ]] ; then
echo "Usage: $0 <input> <output>"
exit
fi