Skip to content

Instantly share code, notes, and snippets.

View geerlingguy's full-sized avatar
:shipit:
Tea, Earl Grey, hot.

Jeff Geerling geerlingguy

:shipit:
Tea, Earl Grey, hot.
View GitHub Profile
@Coreforge
Coreforge / memcpy_unaligned.c
Last active April 20, 2023 18:41
A simple (and not optimal) library to fulfill memory access requirements for BCM2711 PCIe
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
//#include <stdlib.h>
void* memcpy(void* dst, const void* src, size_t n){
volatile char* vc_src = (char*)src;
volatile char* vc_dst = (char*)dst;
// copy byte by byte, hopefully avoiding any alignment issues
size_t pos = 0;
@aussielunix
aussielunix / Day0.md
Last active July 29, 2023 21:32
Runsheet for bootstrapping a clean MacOS M1 using https://github.com/geerlingguy/mac-dev-playbook

Day 0 - Bootstrap MacOS with Ansible

After factory resetting the maching you will need to do the following things to bootstrap it with Ansible.

  • Set default shell to bash chsh -s /bin/bash (optional)
  • Open the App Store and sign in (but do not install anything)
  • Install command line tools
    • xcode-select --install
  • Add Python 3.8 to the $PATH
  • export PATH="$HOME/Library/Python/3.8/bin:$PATH"
@geerlingguy
geerlingguy / photogrammetry.sh
Last active February 14, 2024 09:47
Photogrammetry automation script using COLMAP and OpenMVS
#!/bin/bash
# Photogrammety automation script.
#
# Based on https://peterfalkingham.com/2018/04/01/colmap-openmvs-scripts-updated/
# Adapted from https://www.instructables.com/Free-Photogrammetry-on-Mac-OS-From-Photos-to-3D-Mo/
#
# See full guide on Jeff Geerling's blog:
# TODO
#
# Usage:
@docdyhr
docdyhr / Ansible101Notes.md
Last active April 13, 2021 15:54
Notes, snippets and one-liners from the Ansible 101 YouTube series based on Jeff Geerling's book Ansible for DevOps
@alwynallan
alwynallan / Makefile
Last active April 4, 2024 04:42
Hardware PWM Controller for the Raspberry Pi 4 Case Fan
CC = gcc
RM = rm -f
INSTRUMENT_FOR_PROMETHEUS := false
ifeq ($(INSTRUMENT_FOR_PROMETHEUS),true)
CFLAGS = -Wall -DINSTRUMENT_FOR_PROMETHEUS
LIBS = -lbcm2835 -lprom -lpromhttp -lmicrohttpd
else
CFLAGS = -Wall
/*
Deprecated, see https://gist.github.com/alwynallan/1c13096c4cd675f38405702e89e0c536
If you have to use software PWM, it's still here.
*/
@geerlingguy
geerlingguy / increase-pci-bar-space.sh
Last active January 15, 2024 22:17
Increase the BAR memory address space for PCIe devices on the Raspberry Pi Compute Module 4
#!/bin/bash
# The default BAR address space available on the CM4 may be too small to allow
# some devices to initialize correctly. To avoid 'failed to assign memory'
# errors on boot, you can increase the range of the PCIe bus in the Raspberry
# Pi's Device Tree (a .dtb file specific to each Pi model).
#
# You should probably read up on Device Trees if you don't know what they are:
# https://www.raspberrypi.org/documentation/configuration/device-tree.md
#
@geerlingguy
geerlingguy / nvidia-gt710-arm-pi-setup.sh
Last active April 14, 2024 16:26
Set up the Nvidia GeForce GT 710 on Raspberry Pi Compute Module 4
#!/bin/bash
# Attempt to set up the Nvidia GeForce GT 710 on a Pi CM4.
#
# I have tried both armv7l and aarch64 versions of the proprietary driver, in
# addition to the nouveau open source driver (which needs to be compiled into
# a custom Raspberry Pi kernel).
#
# tl;dr - None of the drivers worked :P
@geerlingguy
geerlingguy / pi-general-benchmark.sh
Last active March 23, 2024 02:38
Raspberry Pi Benchmark Suite - Phoronix
#!/bin/bash
#
# Benchmark script for Raspberry Pi OS.
#
# WARNING: This script is meant to be run as the root user.
# This script should never be run on a system/partition you
# care about. You should only run this on a system that you
# intend to use only for benchmarking and can reinstall or
# re-flash easily.
#
@geerlingguy
geerlingguy / pi-cpu-stress.sh
Last active March 28, 2024 15:20
Raspberry Pi CPU temperature and throttling test script
#!/bin/bash
# Raspberry Pi stress CPU temperature measurement script.
#
# Download this script (e.g. with wget) and give it execute permissions (chmod +x).
# Then run it with ./pi-cpu-stress.sh
#
# NOTE: In recent years, I've switched to using s-tui. See:
# https://github.com/amanusk/s-tui?tab=readme-ov-file#options
# Variables.