-
-
Save HackingGate/9dc4434c3de17188a17844438fc38aff to your computer and use it in GitHub Desktop.
#!/usr/bin/python | |
from sense_hat import SenseHat | |
import os | |
def get_cpu_temp(): | |
res = os.popen('vcgencmd measure_temp').readline() | |
return float(res.replace("temp=", "").replace("'C\n", "")) | |
def get_temp(sense): | |
t1 = sense.get_temperature_from_humidity() | |
t2 = sense.get_temperature_from_pressure() | |
t = (t1 + t2) / 2 | |
t_cpu = get_cpu_temp() | |
t_corr = t - ((t_cpu - t) / 15) - 3 | |
return t_corr | |
sense = SenseHat() | |
humidity = sense.get_humidity() | |
pressure = sense.get_pressure() | |
print("%s %s %s" % (get_temp(sense), humidity, pressure)) |
Migrating to 64-bit OS (aarch64)
Why?
https://www.linuxserver.io/blog/a-farewell-to-arm-hf
How?
Reflash the image
Official Raspberry Pi OS
Download Raspberry Pi OS
https://www.raspberrypi.com/software/operating-systems/
Install Raspberry Pi OS using Raspberry Pi Imager
brew install raspberry-pi-imager
Flash with SSH enabled
sudo dpkg-reconfigure locales
Install Docker
https://docs.docker.com/engine/install/debian/
Configure Docker
https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user
sudo usermod -aG docker $USER
Relogin the user
Calibre web with docker compose
docker-compose.yml
---
version: "2.1"
services:
calibre-web:
image: lscr.io/linuxserver/calibre-web:latest
container_name: calibre-web
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- DOCKER_MODS=linuxserver/mods:universal-calibre
- OAUTHLIB_RELAX_TOKEN_SCOPE=1 #optional
volumes:
- /home/pi/calibre/config:/config
- /home/pi/calibre/library:/books
ports:
- 8083:8083
restart: unless-stopped
Crontab
crontab -e
@reboot (sleep 30s ; cd calibre ; /usr/bin/docker compose up -d --build)&
Basic Configuration
Calibre web
Install https://github.com/janeczku/calibre-web
Create /etc/systemd/system/calibre-web.service
[Unit]
Description=Calibre-Web
After=network.target
[Service]
Type=simple
User=pi
Group=pi
WorkingDirectory=/home/pi/calibre
ExecStart=/home/pi/.local/bin/cps
Restart=on-failure
[Install]
WantedBy=multi-user.target
Enable and start
sudo systemctl enable calibre-web
sudo systemctl start calibre-web
Cloudflare tunnel
For SSH, RDP, SMB
https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/use-cases/
tailscale
fileserver
Install
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
Init
filebrowser config init
Change listen port from default 8080
to 8780
(Optional)
filebrowser config set --port 8780
Test
filebrowser -r .
Add user
filebrowser users add admin admin
Update user
filebrowser users update admin --username pi
filebrowser users update pi --password pass1234
Add /etc/systemd/system/filebrowser.service
with the following content.
[Unit]
Description=filebrowser
After=network.target
[Service]
Type=simple
WorkingDirectory=/home/pi
ExecStart=/usr/local/bin/filebrowser -r /home/pi
Restart=on-failure
User=pi
Group=pi
[Install]
WantedBy=multi-user.target
Load, enable and run
sudo systemctl daemon-reload
sudo systemctl enable --now filebrowser.service
1. Install QEMU:
2. Download the Raspberry Pi OS image and Kernel image: