This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Run as a background task | |
while true # Keep an infinite loop to reconnect when connection lost/broker unavailable | |
do | |
mosquitto_sub -h localhost -t mqtthost/message/\# -F "%t %p" | while read -r payload | |
do | |
# Here is the callback to execute whenever you receive a message: | |
topic=$(echo "$payload" | cut -d ' ' -f 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rpi ~$ sudo systemctl --full --force edit wifi_powersave@.service | |
In the empty editor insert these statements, save them and quit the editor: | |
[Unit] | |
Description=Set WiFi power save %i | |
After=sys-subsystem-net-devices-wlan0.device | |
[Service] | |
Type=oneshot | |
RemainAfterExit=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXTRA_CFLAGS += -Wno-bool-operation | |
EXTRA_CFLAGS += -fno-stack-protector | |
ARCH=arm64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import paho.mqtt.client as mqtt | |
MQTT_SERVER = "localhost" | |
MQTT_PATH = "Image" | |
# The callback for when the client receives a CONNACK response from the server. | |
def on_connect(client, userdata, flags, rc): | |
print("Connected with result code "+str(rc)) | |
# Subscribing in on_connect() means that if we lose the connection and | |
# reconnect then subscriptions will be renewed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Format SD card | |
# Mount SD card | |
cd /media/user/ALPINE | |
tar zxvf ~/Downloads/alpine-rpi-3.12.0-armhf.tar.gz . | |
# Append console=ttyAMA0,115200 to 'cmdline.txt' | |
# Append enable_uart=1 to 'config.txt' | |
# Connect TTL/UART cable and power up | |
sudo screen /dev/ttyUSB0 115200 | |
# Login as root on pi | |
alpine-setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/dev/cdrom /media/cdrom iso9660 noauto,ro 0 0 | |
/dev/usbdisk /media/usb vfat noauto,ro 0 0 | |
/dev/mmcblk0p1 /media/mmcblk0p1 vfat rw,relatime,fmask=0022,dmask=0022,errors=remount-ro 0 0 | |
/media/mmcblk0p1/persist-vol0.img /media/persist-vol0 ext4 rw,relatime,errors=remount-ro 0 0 | |
overlay /home overlay lowerdir=/home,upperdir=/media/persist-vol0/home,workdir=/media/persist-vol0/.home 0 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Install | |
# | |
sudo apt update && sudo apt upgrade | |
sudo apt-get install autoconf automake avahi-daemon build-essential git libasound2-dev libavahi-client-dev libconfig-dev libdaemon-dev libpopt-dev libssl-dev libtool xmltoman libsoxr-dev | |
# libmosquitto-dev | |
git clone https://github.com/mikebrady/shairport-sync.git | |
cd shairport-sync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/bin/sh | |
curl --silent --user ${USER}:${PASS} --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"filter": {"field": "playcount", "operator": "greaterthan", "value": "0" }, "properties": [ "file" ] }, "id":"libMovies" }' --header 'content-type: application/json;' http://${IP_ADDR}:8080/jsonrpc | jq '.result | .movies | .[] | ."file"' | tr -d \" | awk -F/ '{print $6}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adduser/stable,now 3.118 all [installed] | |
apt-listchanges/stable,now 3.19 all [installed] | |
apt-utils/stable,now 1.8.2 amd64 [installed] | |
apt/stable,now 1.8.2 amd64 [installed] | |
avahi-daemon/stable,now 0.7-4+b1 amd64 [installed] | |
base-files/stable,now 10.3+deb10u3 amd64 [installed] | |
base-passwd/stable,now 3.5.46 amd64 [installed] | |
bash-completion/stable,now 1:2.8-6 all [installed] | |
bash/stable,now 5.0-4 amd64 [installed] | |
bc/stable,now 1.07.1-2+b1 amd64 [installed] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
watch -n 1 'vcgencmd measure_clock arm && vcgencmd measure_temp' |
NewerOlder