A convenience module for shelling out with realtime output
Credit: Largely taken from https://www.endpoint.com/blog/2015/01/28/getting-realtime-output-using-python
#!/usr/bin/env python -u | |
import os | |
import re | |
import sys | |
import itertools | |
import contextlib | |
import subprocess | |
sys.stdout.reconfigure(line_buffering=True) |
import asyncio | |
import time | |
from time import perf_counter_ns | |
# noinspection PyPep8Naming | |
class ns_per_it: | |
__slots__ = 'n', 'res' | |
def __init__(self, n: int): |
import asyncio | |
class AsyncInit: | |
def __await__(self): | |
async def _(): | |
await self.__ainit__() | |
return self | |
return _().__await__() |
A convenience module for shelling out with realtime output
Credit: Largely taken from https://www.endpoint.com/blog/2015/01/28/getting-realtime-output-using-python
import sys | |
import webbrowser | |
def main(): | |
return 42/0 | |
def excepthook(type_, value, traceback): | |
webbrowser.open_new_tab('https://stackoverflow.com/search?q=[python] {} {}'.format(type_, value)) |
Original blog post - http://blog.alexellis.io/live-stream-with-docker/
How do I rebuild the image from scratch?
This will take several hours on a Raspberry Pi Zero - but less time on a Pi 2 or Pi 3. You can edit the Dockerfile for a Pi 2/3 and change RUN make
to RUN make -j 4
to take advantage of the quad-core processor.
$ git clone https://github.com/alexellis/raspberrypi-youtube-streaming/
extension_id=jifpbeccnghkjeaalbbjmodiffmgedin # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc"
unzip -d "$extension_id-source" "$extension_id.zip"
Thx to crxviewer for the magic download URL.
#!/bin/bash | |
WATCH_FILE="abc.123" | |
while read oldrev newrev refname; do | |
if [ "$refname" = "refs/heads/master" ]; then | |
if git diff-tree --name-only -r -z $oldrev $newrev | grep --quiet $WATCH_FILE ; then | |
# WATCH_FILE changed... | |
fi | |
fi | |
done |