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 / cm4-fan.sh
Last active March 14, 2024 17:40
Fan controller script for the CM4 IO Board EMC2301 and PWM fans
#!/bin/bash
#
# Jeff Geerling's super-rudimentary fan controller script for the CM4.
#
# Use:
# 1. Download this script to a path like `/opt/cm4-fan.sh`
# 2. Run it with: `nohup bash /opt/cm4-fan.sh`
# 3. Profit!
#
# You should wrap it in a systemd unit file if you want it to persist and come
@geerlingguy
geerlingguy / systembuttons.py
Last active October 17, 2021 02:19
Python 3 version of Null 2 systembuttons.py
#!/usr/bin/python3
# Shutdown and volume control
import keyboard
import time
import os
INITIAL_VOLUME = "25%"
def shutdown():
@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:
@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 / minecraft.yml
Created September 24, 2020 18:01
Minecraft installation on Kubernetes via Ansible and Helm
# Minecraft Server deployment for Kubernetes clusters via Ansible's Helm module.
#
# The Helm module is part of the Kubernetes collection. Install it with:
#
# ansible-galaxy collection install community.kubernetes
#
# Then run the playbook:
#
# ansible-playbook main.yml
#
@geerlingguy
geerlingguy / travis-ci-docker-upgrade.sh
Last active August 12, 2020 19:41
Upgrade Docker CE version in Travis CI environments
#!/bin/bash
#
# See: https://docs.travis-ci.com/user/docker/#installing-a-newer-docker-version
#
# Add the following in your .travis.yml file to upgrade Docker prior to your build:
#
# before_install:
# - curl https://gist.githubusercontent.com/geerlingguy/ce883ad4aec6a5f1187ef93bd338511e/raw/36612d28981d92863f839c5aefe5b7dd7193d6c6/travis-ci-docker-upgrade.sh | sudo bash
#
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@geerlingguy
geerlingguy / mariadb.yml
Last active January 29, 2024 19:43
Wordpress in Kubernetes K3s on Raspberry Pi
# This manifest assumes 'wordpress' namespace is already present:
#
# kubectl create namespace wordpress
#
# Apply the manifest with:
#
# kubectl apply -f mariadb.yml
---
apiVersion: v1
kind: Secret
@geerlingguy
geerlingguy / drupal.yml
Last active January 19, 2024 02:15
Drupal in Kubernetes K3s on Raspberry Pi
# This manifest assumes 'drupal' namespace is already present:
#
# kubectl create namespace drupal
#
# Apply the manifest with:
#
# kubectl apply -f drupal.yml
---
kind: ConfigMap
apiVersion: v1
@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.
#