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
@geerlingguy
geerlingguy / c2clat.sh
Last active December 4, 2025 03:33
Get core-to-core latency graph via c2clat
# Make sure CPU is in performance mode (see notes in Gist comments).
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Install c2clat and gnuplot-nox
sudo apt install -y gnuplot-nox
git clone https://github.com/rigtorp/c2clat
cd c2clat
g++ -O3 -DNDEBUG c2clat.cpp -o c2clat -pthread
# Set up the PNG dimension (set to 4096,2160 for 96+ CPU cores)
@albal
albal / led_control.md
Created January 15, 2025 19:00 — forked from ffalt/led_control.md
Lincstation LED commands on TrueNAS 24.10

Disclaimer: These commands with wrong parameters could damage your system. Take care!

Before you use any commands on this page you MUST find out the bus number for the led control on your system

Run

i2cdetect -y 0

i2cdetect -y 1
@CJCShadowsan
CJCShadowsan / hplcalculator.py
Last active July 28, 2025 15:24
HPL.dat calculator - Takes system specs on a single-node basis and calculates N, NB, P, and Q based on available memory and cores
#!/usr/bin/env python3
import math
import psutil
def get_system_info():
# Get the number of physical cores
num_cores = psutil.cpu_count(logical=False)
# Get available physical memory (in bytes)
@Coreforge
Coreforge / memcpy_unaligned.c
Last active June 25, 2025 21:24
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 October 5, 2025 17:08
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 9, 2025 01:09
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
#