Skip to content

Instantly share code, notes, and snippets.

@jaimemrjm
Last active October 16, 2021 21:30
Show Gist options
  • Save jaimemrjm/aeeca9bd95a2b5f2efb6df2f0776d36c to your computer and use it in GitHub Desktop.
Save jaimemrjm/aeeca9bd95a2b5f2efb6df2f0776d36c to your computer and use it in GitHub Desktop.
Raspberry Pi consejos y notas (desactualizado)

Backup SD of Raspberry Pi

sudo dd bs=4M if=/dev/sdb | gzip > ~/camelberry_image-`date +%d%m%y`.gz

To restore backup

sudo gzip -dc ~/camelberry_image-date.gz | dd bs=4M of=/dev/sdb

Bright Pi

Como root:

apt-get install i2c-tools
echo "i2c-dev" >> /etc/modules
echo "dtparam=i2c1=on" >> /boot/config.txt

Comandos para luces:

alias leds_ir_on='sudo i2cset -y 1 0x70 0x09 0x0f;sudo i2cset -y 1 0x70 0x00 0xa5'
alias leds_white_on='sudo i2cset -y 1 0x70 0x09 0x0f;sudo i2cset -y 1 0x70 0x00 0x5a'
alias leds_off='sudo i2cset -y 1 0x70 0x00 0x00'

Camera

sudo modprobe bcm2835-v4l2 # o meter en /etc/modules
cvlc v4l2:///dev/video0 --v4l2-width 1920 --v4l2-height 1080 --v4l2-chroma h264 --sout '#standard{access=http,mux=ts,dst=0.0.0.0:12345}' :demux=264

Monitor del disco

#!/bin/bash
CURRENT=$(df /media/disk1 | grep / | awk '{ print $5}' | sed 's/%//g')
THRESHOLD=97

if [ "$CURRENT" -gt "$THRESHOLD" ] ; then
    mail -s 'Disk Space Alert' xxxx@gmail.com << EOF
The external disk partition remaining free space is critically low. Used: $CURRENT%
EOF
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment