Skip to content

Instantly share code, notes, and snippets.

View cdgraff's full-sized avatar

AlejandroF cdgraff

View GitHub Profile
@cdgraff
cdgraff / livestreammonitor.py
Created August 12, 2022 02:16 — forked from sinkers/livestreammonitor.py
Script for live video streaming monitoring with notifications
#!/usr/bin/python
'''
Script to monitor live streams and send an Amazon SNS if the stream is down (and possibly take restorative action)
Future:
Black detect: ffmpeg -i out.mp4 -vf blackdetect -f null -
Note the following doesn't seem to fully work without looking at the debug logs
On live ffmpeg -y -i rtmp://cp30129.live.edgefcs.net/live/videoops-videoops@50541 -vf blackdetect -t 10 -loglevel debug -f null -
'''
@cdgraff
cdgraff / check.liq
Created March 6, 2022 19:48 — forked from giflw/check.liq
Playlist check function used with the logs in Liquidsoap
set("log.file.path", "/tmp/test.log")
set("server.socket.path","/tmp/<script>.sock")
set("server.socket",true)
# Simple check function to match any "Finished with ...." line in the logs
def checker(n)
# get info from upcoming request
m = request.metadata(n)
# command to find if the file was played according to the log
command = 'grep -F'
@cdgraff
cdgraff / icecast2-bq-table-schema
Last active May 15, 2019 21:40
BigQuery + Icecast2 logs
[ { "type": "TIMESTAMP", "name": "time" },
{ "type": "STRING", "name": "host" },
{ "type": "STRING", "name": "user" },
{ "type": "STRING", "name": "method" },
{ "type": "STRING", "name": "path" },
{ "type": "STRING", "name": "code" },
{ "type": "INTEGER", "name": "size" },
{ "type": "STRING", "name": "referer" },
{ "type": "STRING", "name": "agent" },
{ "type": "STRING", "name": "duration" } ]
root@raspberrypi3-e78c6d9:/data# SoapySDRUtil --probe
######################################################
## Soapy SDR -- the SDR abstraction library ##
######################################################
Probe device
usb_claim_interface error -6
Found Rafael Micro R820T tuner
Detached kernel driver
Found Rafael Micro R820T tuner
#!/usr/bin/env python
"""
Produces load on all available CPU cores
"""
from multiprocessing import Pool
from multiprocessing import cpu_count
def f(x):
while True:
x*x
const {Storage} = require('@google-cloud/storage');
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
const ffmpeg = require('fluent-ffmpeg');
var bucket = 'test-demo-transcode';
ffmpeg.setFfmpegPath(ffmpegPath);
exports.transcodeVideo = (data, context) => {
const file = data;
@cdgraff
cdgraff / asound.state
Created June 23, 2018 20:51
/var/lib/alsa/asound.state
state.audioinjectorpi {
control.1 {
iface MIXER
name 'Master Playback Volume'
value.0 121
value.1 121
comment {
access 'read write'
type INTEGER
count 2
$ git clone -b 1.23 https://github.com/crosstool-ng/crosstool-ng.git
$ cd crosstool-ng
$ ./bootstrap
$ ./configure --prefix=/usr/local
$ make
$ sudo make install
$ cd ..
$ mkdir ctng
$ ct-ng menuconfig
@cdgraff
cdgraff / gist:654d839f455e8f838c997fce2eb60cc7
Created March 8, 2018 18:11 — forked from sgergely/gist:3793166
Midnight Commander Keyboard Shortcuts for Mac OSX
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name
rtl_fm, a simple narrow band FM demodulator for RTL2832 based DVB-T receivers
Use: rtl_fm -f freq [-options] [filename]
-f frequency_to_tune_to [Hz]
use multiple -f for scanning (requires squelch)
ranges supported, -f 118M:137M:25k
[-M modulation (default: fm)]
fm, wbfm, raw, am, usb, lsb
wbfm == -M fm -s 170k -o 4 -A fast -r 32k -l 0 -E deemp
raw mode outputs 2x16 bit IQ pairs