Skip to content

Instantly share code, notes, and snippets.

@chrisstubbs93
chrisstubbs93 / ffmpeg.sh
Last active January 11, 2024 22:40
auto-restart FFMPEG when it stops sending frames to youtube
#!/bin/sh
sleep 5
ffmpeg -re -f mjpeg -r 10 -i "http://localhost/?action=stream" -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -acodec aac -ab 1k -strict experimental -s 640x360 -vcodec h264 -pix_fmt yuv420p -g 20 -vb 500k -preset ultrafast -crf 31 -r 10 -f flv "rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx" 2> /home/pi/ffmpeg.log
@chrisstubbs93
chrisstubbs93 / GxGDEH029A1.cpp
Created April 13, 2019 21:45
GxGDEH029A1.cpp from GxEPD modified to dump every screen update over the serial port in XPM2 format (save as .xmp without <<< >>> tags and open in GIMP)
// class GxGDEH029A1 : Display class for GDEH029A1 e-Paper from Dalian Good Display Co., Ltd.: www.good-display.com
//
// based on Demo Example from Good Display, available here: http://www.good-display.com/download_detail/downloadsId=515.html
// Controller: IL3820 : http://www.good-display.com/download_detail/downloadsId=540.html
//
// Author : J-M Zingg
//
// Version : see library.properties
//
// License: GNU GENERAL PUBLIC LICENSE V3, see LICENSE
@chrisstubbs93
chrisstubbs93 / TCA9548A.ino
Created December 27, 2018 22:08
TCA9548A set and check multiplexer bus for arduino
#include <Wire.h>
#define TCAADDR 0x70
void setup() {
Wire.begin();
Serial.begin(115200);
}
void loop() {
for (int bus = 0; bus <= 7; bus++) {
@chrisstubbs93
chrisstubbs93 / motors.py
Created September 19, 2018 21:14
Python Websockets server for motor control on Pi GPIO
import socket, hashlib, base64, threading
import RPi.GPIO as GPIO
import time
from collections import namedtuple
from functools import wraps
import threading
from threading import Timer
from functools import partial