Skip to content

Instantly share code, notes, and snippets.

@pardeike
Last active May 31, 2022 19:53
Show Gist options
  • Save pardeike/d161baa4586476f0a25c21c5f84db550 to your computer and use it in GitHub Desktop.
Save pardeike/d161baa4586476f0a25c21c5f84db550 to your computer and use it in GitHub Desktop.
Useful Rasberry Pi setup and maintainance scripts and commands
# install Raspberry Pi OS
https://www.raspberrypi.com/software/
- download Raspberry Pi Imager
- Choose OS: Raspberry Pi OS (other) > Raspberry Pi OS (64bit)
- Choose Storage: use SDCard
- Select Prefs Icon: set up wifi, ssh, login etc
# Connect
- ssh user@raspberrypi.local
# change sound out to headphones
- sudo raspi-config
Menu: 1 > S2 > 1
# edit locale
https://www.howtoraspberry.com/2020/04/fix-locale-problems-on-raspberry-pi/
- sudo vi /etc/default/locale
Content:
File generated by update-locale
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_ALL=en_US.UTF-8
# update everything
- sudo apt update
- sudo apt upgrade
# firmware update for legacy camera support (NOT WORKING)
https://stackoverflow.com/a/70218011
https://raspberrypi.stackexchange.com/a/135425
- sudo rpi-update
- sudo reboot
- add the following to the end of /boot/config.txt
[all]
camera_auto_detect=0
dtoverlay=imx477,media-controller=0
gpu_mem=256
dtoverlay=vc4-kms-v3d
# basics
- sudo apt-get install vim
# git
- git config --global user.email "you@example.com"
- git config --global user.name "Your Name"
# create ssh key (if not set in SD card writer)
ssh-keygen
# on mac
ssh-copy-id -i ~/.ssh/id_rsa ap@pi.local
# shell stuff
edit ~/.bash_aliases
- add export PYGAME_HIDE_SUPPORT_PROMPT=1 to silence pygame
echo 1 > .hushlogin
# install swift
https://forums.swift.org/t/new-swift-package-repository-for-ubuntu-debian-linux-distributions/50412/16
- curl -s https://archive.swiftlang.xyz/install.sh | sudo bash
- sudo apt update
- sudo apt install swiftlang
- swift --version
# camera
- sudo -H apt install python3-picamera
- python:
#!/usr/bin/env python
from picamera import PiCamera
from time import sleep
camera = PiCamera()
camera.start_preview()
sleep(5)
camera.capture('picture.jpg')
camera.stop_preview()
# sound
- curl http://wolo-usa.com/siren6.wav > police.wav
- aplay police.wav
- sudo apt-get install python3-pygame
- python:
#!/usr/bin/env python
import pygame
pygame.mixer.init(frequency=22050, size=-16, channels=1, buffer=4096)
my_sound = pygame.mixer.Sound('police.wav')
my_sound.play()
pygame.time.wait(int(my_sound.get_length() * 1000))
# piface
https://github.com/piface/pifacedigitalio
- sudo apt install python3-pip
- sudo pip3 install pifacecommon
- sudo pip3 install pifacedigitalio
Documentation: http://pifacedigitalio.readthedocs.org/
Legacy docs: http://www.piface.org.uk/products/piface_digital/
# protoc
https://snapcraft.io/install/protobuf/raspbian
- sudo apt install snapd
- sudo reboot
- sudo snap install core
- sudo snap install protobuf --classic
# swift proto plugin
https://github.com/apple/swift-protobuf
- git clone https://github.com/apple/swift-protobuf.git
- cd swift-protobuf
- git tag -l
- git checkout tags/[tag_name]
- swift build -c release
- sudo cp .build/release/protoc-gen-swift /usr/local/bin/
# swift grpc plugins
https://github.com/grpc/grpc-swift
- git clone https://github.com/grpc/grpc-swift.git
- cd grpc-swift
- make plugins
- sudo cp protoc-gen-swift protoc-gen-grpc-swift /usr/local/bin/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment