This is the first balenaOS masterclass.
There are no prerequisites apart from basic linux knowledge and terminal access to a device running balenaOS.
Masterclass Type: Core Maximum Expected Time To Complete: 60 minutes
| javascript:(function()%7Bdocument.body.innerHTML%20%3D%20'%3Ch1%3ELoading...%3C%2Fh1%3E'%3Bconst%20url%20%3D%20new%20URL(window.location.href)%3Bconst%20videoId%20%3D%20url.searchParams.get('v')%3Bconst%20xhr%20%3D%20new%20XMLHttpRequest()%3Bxhr.open('GET'%2C%20%60https%3A%2F%2Fwww.youtube.com%2Fget_video_info%3Fvideo_id%3D%24%7BvideoId%7D%26el%3Ddetailpage%60%2C%20false)%3Bxhr.send(null)%3Bconst%20response%20%3D%20decodeURIComponent(xhr.responseText).split(%22%26%22).filter((line)%20%3D%3E%20line.startsWith(%22player_response%22))%5B0%5D.split(%22player_response%3D%22)%5B1%5D%3Bconst%20info%20%3D%20JSON.parse(response)%3Bconst%20streams%20%3D%20info.streamingData.formats.sort((s1%2C%20s2)%20%3D%3E%20s1.height%20%3C%20s2.height)%3Bdocument.body.innerHTML%20%3D%20%60%3Cvideo%20style%3D%22width%3A%20100%25%3B%20max-width%3A%20500px%3B%22%20id%3D%22video%22%20controls%3D%22controls%22%20class%3D%22video-stream%22%20x-webkit-airplay%3D%22allow%22%20autoplay%20playsinline%20src%3D%22%24%7Bstreams%5B0%5D.url%7D%22% |
| # syntax=docker/dockerfile:experimental | |
| FROM rust:slim as builder | |
| RUN apt-get update && \ | |
| apt-get install musl-tools -y && \ | |
| apt-get clean && rm -rf /var/lib/apt/lists/* && \ | |
| rustup target add x86_64-unknown-linux-musl | |
| COPY . . | |
| RUN --mount=type=cache,target=/usr/local/cargo,from=rust:slim,source=/usr/local/cargo \ | |
| --mount=type=cache,target=target \ | |
| RUSTFLAGS=-Clinker=musl-gcc \ |
| caff () { | |
| if [ -z "$(docker images -q caff)" ]; then | |
| # shellcheck disable=SC2016 | |
| echo 'Bootstrapping `caff` docker image' | |
| docker run \ | |
| --detach \ | |
| --name caff \ | |
| debian \ | |
| bash -c 'apt-get update -y && apt-get install -y man signing-party && apt-get clean' &>/dev/null | |
| while [ -n "$(docker ps -qf name=caff)" ]; do |
| switch: | |
| - platform: template | |
| switches: | |
| lounge_tv: | |
| friendly_name: Lounge TV | |
| value_template: "{{ state_attr('switch.lounge_tv_plug', 'current_power_w') | float > 25 }}" | |
| icon_template: mdi:television | |
| turn_on: | |
| service: remote.turn_on | |
| entity_id: remote.lounge_tv |
72 Parties!
sqlite> select * from parties;
id name
---------- ----------
1 Lab
2 Con
3 PC
4 UKIP
| #!/usr/bin/env python | |
| import random | |
| import sys | |
| import urllib | |
| import requests | |
| from lxml import etree | |
| <?xml version="1.0" encoding="ISO-8859-1"?><RECIPES> | |
| <RECIPE> | |
| <NAME>Barb's Hef</NAME> | |
| <VERSION>1</VERSION> | |
| <TYPE>All Grain</TYPE> | |
| <BREWER>Nick Corona</BREWER> | |
| <ASST_BREWER></ASST_BREWER> | |
| <BATCH_SIZE>18.9271680</BATCH_SIZE> | |
| <BOIL_SIZE>25.4333820</BOIL_SIZE> | |
| <BOIL_TIME>60.0000000</BOIL_TIME> |
| #!/usr/bin/env python | |
| """ Fed up with GitHub stars being essentially useless, I decided to give them | |
| some purpose. | |
| Run this script occasionally (via cron or similar) to keep a local and | |
| up-to-date copy of your starred repos (and even delete repos which | |
| have been unstarred!). | |
| Three variables may or may not need configuring to run this script in your | |
| environment, they are ``github_username``, ``starred_dir`` and ``cleanup``. |
| function autoArchive() { | |
| var archiveLabels = ["<...>"], | |
| deleteLabels = ["<...>"], | |
| maxAgeDays = 7, | |
| log = DocumentApp.openById("<Log Document ID>"), | |
| logger = log.getBody(); | |
| var maxDate = new Date(); | |
| logger.appendParagraph(maxDate.toString()); | |
| maxDate.setDate(maxDate.getDate()-maxAgeDays); |