Skip to content

Instantly share code, notes, and snippets.

View christianll9's full-sized avatar
🏠
Working from home

Christian christianll9

🏠
Working from home
  • University of Hildesheim
  • Germany
View GitHub Profile
@christianll9
christianll9 / permanent-YT-stream-pi.md
Last active November 13, 2021 10:08
How to stream permanently from a YouTube channel with a Raspberry Pi
View permanent-YT-stream-pi.md

Abstract

This tutorial explains, how you can program your Pi so that it automatically tries to connect to a specific YouTube live stream link at startup and always tries to reconnect if the connection is lost. My personal use case was for my grandpa to watch a live stream of his local church without the need to understand YouTube/internet. If you want a permanent stream of a specific channel, use the following link format: https://www.youtube.com/channel/<channel-id>/live (ID can be found with online tools like YouTube Channel ID Finder). This Gist should also work with other streaming services, if they are supported by Streamlink.

Tutorial

  1. Install a useful OS. This tutorial assumes the Raspberry Pi OS (32-bit).
  2. Setup an internet connection.
  3. Install the latest stable version of Streamlink. Older versions have problems with the more recent YouTube API. For the instal
@christianll9
christianll9 / stop-idle-gcloud.py
Last active June 18, 2021 08:01 — forked from why-not/stop-idle-azure.py
Automatically Shutting Down Google Cloud VM (when idle AND no one is logged in via SSH)
View stop-idle-gcloud.py
# BASED on https://gist.github.com/why-not/18c5c0c00ee4cddf5ca176f770918639
# This is how the cron file should look like.
# PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/sn$
# * * * * * /home/script/stop-idle-gcloud.py > /tmp/user_error.log
## Watchout, for some reason cron files seem to require an extra new line at the end,
## consult this SO: https://askubuntu.com/questions/23009/why-crontab-scripts-are-not-working
## Also take care to setup a PATH variable for the cron explicitly. It doesn't see