Skip to content

Instantly share code, notes, and snippets.

View paul-ridgway's full-sized avatar

Paul Ridgway paul-ridgway

View GitHub Profile
@paul-ridgway
paul-ridgway / ro-root.sh
Last active November 4, 2024 15:17
A scrip to replace the default RPi init to create and chroot to an overlayfs-backed root
#!/bin/sh
# Read-only Root-FS for Raspian using overlayfs
# Version 1.1:
# Changed to use /proc/mounts rathern than /etc/fstab for deriving the root filesystem.
#
# Version 1:
# Created 2017 by Pascal Suter @ DALCO AG, Switzerland to work on Raspian as custom init script
# (raspbian does not use an initramfs on boot)
#
pi@pi3-1:~ $ df -h
Filesystem Size Used Avail Use% Mounted on
192.168.1.50:/nfs/client1 205G 68G 127G 35% /mnt
devtmpfs 460M 0 460M 0% /dev
root-rw 464M 103M 362M 23% /rw
192.168.1.50:/nfs/client1 205G 68G 127G 35% /ro
overlayfs-root 464M 103M 362M 23% /
tmpfs 464M 0 464M 0% /dev/shm
tmpfs 464M 12M 452M 3% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
default-lease-time 86400;
max-lease-time 86400;
authoritative;
log-facility local7;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
default-lease-time 86400;
max-lease-time 86400;
authoritative;
log-facility local7;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = /tftpboot
disable = no
#!/usr/bin/env ruby
require 'hidapi'
bus_number = 1
device_address = 4
interface = 3
SOLID_GRN = [0x08, 0x00, 0x01, 0x06, 0x32, 0x02, 0x01, 0xbb]
PRESS_FADE_GRN = [0x08, 0x00, 0x04, 0x0a, 0x32, 0x02, 0x01, 0xb4]
Mongoid.default_client.collections.each(&:drop)
rsync -aAXv --progress --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/usr/tmp/*","/run/*","/mnt/*","/media/*","/var/cache/*","/","/lost+found","/backup"} /* /backup/
name: Build
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
core_a: ["STM32"]
core_b: ["stm32"]
board: ["Nucleo_144"]
opts: ["pnum=NUCLEO_F767ZI,upload_method=MassStorage,xserial=generic,usb=none,xusb=FS,opt=osstd,rtlib=nano"]
function strokesRequired(picture) {
var strokes = 0;
while (true) {
// Find the next truthy cell and extract x and y
const next = picture.flatMap((row, x) => row.flatMap((char, y) => (char && { char, x, y }))).filter(r => r)[0];
if (!next) { // None left means the picture is filled
break;
}
const remove = [[next.x, next.y]]; // We will remove the current cell after
eliminateNeighbours(picture, [], remove, next.char, next.x, next.y);