Skip to content

Instantly share code, notes, and snippets.

@poulou0
Last active October 21, 2022 13:34
Show Gist options
  • Save poulou0/cbfaf188c64c88f9f2d11b78af282ef9 to your computer and use it in GitHub Desktop.
Save poulou0/cbfaf188c64c88f9f2d11b78af282ef9 to your computer and use it in GitHub Desktop.
raspi4 cheat sheet

To ssh without password

ssh-copy-id pi@192.168.x.x

Restart if offline

Append a job to crontab https://stackoverflow.com/a/16068840/1748645

(crontab -l; echo "*/5 * * * * /bin/bash -c \"ping -c 1 8.8.8.8 &> /dev/null || sudo reboot\"") | crontab

For ZSH

Installation:

sudo apt install zsh
chsh -s $(which zsh)
curl -L git.io/antigen > antigen.zsh

To be prettier and more useful nano .zshrc:

source ~/antigen.zsh
antigen use oh-my-zsh
antigen bundle git
antigen bundle command-not-found
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-autosuggestions
antigen theme essembeh
antigen apply

LCD 3.5 GPIO

Sources:

Installation:

sudo curl https://raw.githubusercontent.com/goodtft/LCD-show/master/usr/tft35a-overlay.dtb --output /boot/overlays/tft35a.dtbo && \
printf "\ndtoverlay=tft35a:rotate=270,speed=27000000" | sudo tee -a /boot/config.txt

Rotate touch (https://gist.github.com/satmandu/3fd42c5a538bc34a1636950740838d3e)

sudo nano /etc/X11/xorg.conf.d/99-calibration.conf

Rotate 90:
  Section "InputClass"
    Identifier "calibration"
    MatchProduct "ADS7846 Touchscreen"
    Option "Calibration" "3932 300 3801 294 "
    Option "SwapAxes" "0"
  EndSection
Rotate 180:
  Section "InputClass"
    Identifier "calibration"
    MatchProduct "ADS7846 Touchscreen"
    Option "Calibration" " 300 3932 3801 294 "
    Option "SwapAxes" "1"
  EndSection
Rotate 270:
  Section "InputClass"
    Identifier "calibration"
    MatchProduct "ADS7846 Touchscreen"
    Option "Calibration" " 300 3932 294 3801 "
    Option "SwapAxes" "0"
  EndSection

Old way:

sudo curl https://raw.githubusercontent.com/goodtft/LCD-show/master/usr/tft35a-overlay.dtb --output /boot/overlays/tft35a.dtbo && \
sudo sed -i 's/dtoverlay=vc4-kms-v3d/#dtoverlay=vc4-kms-v3d/' /boot/config.txt && \
printf "\nhdmi_force_hotplug=1\ndtoverlay=tft35a:rotate=270,speed=27000000" | sudo tee -a /boot/config.txt && \
sudo sed -i '1s/$/ fbcon=map:10/' /boot/cmdline.txt

GNU screen

Installation:

sudo apt install -y screen

For better color:

printf "term screen-256color" > .screenrc

To start on boot nano .profile or nano .zprofile and in the end:

if ! screen -list | grep -q "main"; then
    screen -S main
else
    printf "To attach to the main screen: \e[92mscreen -x main\e[39m\nand for detach: \e[96mCtrl\e[39m + \e[96ma\e[39m followed by \e[96md\e[39m\n\n"
fi

Docker

Sources:

Installation:

From the OMV-Extras > Docker (tab) OR for the latest wget -O - https://get.docker.com | sudo bash

sudo groupadd docker && \
sudo usermod -aG docker $USER

Restart to take effect

Portainer

Sources:

Installation:

From the OMV-Extras > Docker (tab) OR

docker volume create portainer_data && \
docker run -d -p 8000:8000 -p 9443:9443 -p 9000:9000 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment