Skip to content

Instantly share code, notes, and snippets.

View tstellanova's full-sized avatar
💭
growing excited

Todd Stellanova tstellanova

💭
growing excited
View GitHub Profile
@tstellanova
tstellanova / setup_pigpiod.md
Last active March 31, 2024 17:45
Install pigpiod on Raspberry Pi 3 (RPi3) running raspbian buster

Install pigpio

If you're working with the rpi3's gpio, the pigpio library can be very handy.

sudo apt-get update
sudo apt-get install pigpio 

If you also want to access pigpio from python, install: sudo apt-get install python-pigpio python3-pigpio

Setup pigpiod service to run at boot

@tstellanova
tstellanova / uconsole_cm4_setup.md
Last active March 3, 2024 21:50
New uConsole setup

Assembly

  • When assembling the uConsole, at step "E. Mount the Core", the CM4 module tends to unplug/disengage from the two connectors that hold it on the main board. Carefully use glue or another method to secure the CM4 to the core board.
  • When placing the heat transfer putty on the CM4, between the CM4 and the case, spread the putty so that it will make approximately flat contact with the case. The Broadcom chip is a bit thicker than the adjacent chips. If needed you can scribe some shallow hash marks into the putty to make it spread more easily.

Software Configuration

  • Use the external antenna rather than the CM4 internal antenna
@tstellanova
tstellanova / rpi_hostname.md
Last active March 3, 2024 20:43
Configure hostname on raspberry Pi3 (RPi3), RPi4, CM4 and similar

Set the hostname

sudo vi /etc/hosts
# replace raspberrypi with your desired hostname, and save
sudo vi /etc/hostname
# replace raspberrypi with your desired hostname, and save
# you will get a warning about "sudo: unable to resolve host raspberrypi" after save
sudo reboot
  • The host should now be available on hostname.local
@tstellanova
tstellanova / gui1_liners.sh
Last active March 2, 2024 05:24
one liners for wmctrl and xrandr on ubuntu 22 with wayland
# wmctrl one-liners
# DISPLAY is needed if you're running from eg an ssh shell
# list all windows
DISPLAY=:0 wmctrl -lG
# Resize the "active" window
# dimensions are: X,Y,width,height
DISPLAY=:0 wmctrl -r :ACTIVE: -e 0,40,40,1000,500
@tstellanova
tstellanova / terminal_markdown_viewer.md
Last active February 14, 2024 12:56
How to view Markdown documents more easily in Mac OSX Terminal
  • Install a couple of tools (markdown renders markdown as html, and the lynx browser) using homebrew:
brew install markdown lynx
  • When you want to view a markdown document from the commandline, render it with markdown and pipe the output to lynx:
markdown README.md | lynx -stdin
@tstellanova
tstellanova / rpi0_rust_env.md
Last active February 2, 2024 18:20
Install rust development environment on Raspberry Pi Zero W (rpi0w)

Purpose

Setup your Raspberry Pi 0 w to develop with the Rust language.

Initial configuration

  • Ensure your rpi0 has a network connection so it can download and install packages
  • Install Raspbian based on Debian Stretch

Configure pigpio

If you're working with the rpi0's GPIO, the pigpio library can be very handy.

@tstellanova
tstellanova / x11grab_ffmpeg.sh
Created January 28, 2024 21:04
ffmpeg one liners to capture a portion of the screen and save to video file using x11grab
# x11grab from the default device at offset x=70, y=65
ffmpeg -video_size 1280x720 -framerate 30 -f x11grab -i :0.0+70,65 -c:v libx264rgb -crf 0 -preset ultrafast -color_range 2 out6.mkv
# use x265 output encoding instead
ffmpeg -video_size 1280x720 -framerate 30 -f x11grab -i :0.0+70,65 -c:v libx265 out7.mp4
@tstellanova
tstellanova / convert_image_to_raw.sh
Created January 14, 2024 00:26
Create 1bpp raw data file from any image with imagemagick, for eg embedded rust custom mono fonts
# first, install imagemagick, eg on debian:
# sudo apt install libpng-dev libjpeg-dev libtiff-dev imagemagick
convert input_image.png -depth 1 gray:output.raw
@tstellanova
tstellanova / dump_frame.sh
Last active December 27, 2023 17:55
Grab a single frame from a video using ffmpeg
# Input a video ID (this is used to build an input filename) and frame to dump
video_id=$1
guess_frame=$2
# modern video formats prefer timestamps over framerates, so YMMV
frame=$(( ${guess_frame} ))
printf "video_id: %s frame: %d \r\n" ${video_id} ${frame}
# this is a heuristic guess as to how frequently (every 250 frames) we see a keyframe
keyframe=$(( ${frame} / 250 ))
@tstellanova
tstellanova / micropython_for_ch32v0x.md
Last active November 12, 2023 00:32
Building micropython for WCH CH32v07

Simple grab n build

git clone https://github.com/r4d10n/micropython-wch-ch32v307.git
cd micropython-wch-ch32v307
make -C mpy-cross