Skip to content

Instantly share code, notes, and snippets.

@jauderho
jauderho / gist:6b7d42030e264a135450ecc0ba521bd8
Last active April 20, 2024 18:46
HOWTO: Upgrade Raspberry Pi OS from Bullseye to Bookworm
### WARNING: READ CAREFULLY BEFORE ATTEMPTING ###
#
# Officially, this is not recommended. YMMV
# https://www.raspberrypi.com/news/bookworm-the-new-version-of-raspberry-pi-os/
#
# This mostly works if you are on 64bit. You are on your own if you are on 32bit or mixed 64/32bit
#
# Credit to anfractuosity and fgimenezm for figuring out additional details for kernels
#
@klaasnicolaas
klaasnicolaas / hourly_price_charts.yaml
Last active April 22, 2024 15:30
Collecting the hourly energy prices via a service in the EnergyZero or easyEnergy integration and using them in an ApexCharts card in your dashboard.
- type: custom:apexcharts-card
graph_span: 1d
header:
show: true
title: Electriciteitsprijzen Vandaag (€/kwh)
span:
start: day
now:
show: true
label: Now
@darth-veitcher
darth-veitcher / check_throttle.sh
Created October 13, 2021 10:15
Check for throttling on RaspberryPi
#!/bin/bash
# This bash script outputs the status of your Pi and checks whether you are being throttled for undervoltage and gives you your temperature
# Article and discussion at https://jamesachambers.com/measure-raspberry-pi-undervoltage-true-clock-speeds/
# Author James A Chambers 6-6-17
# Output current configuration
vcgencmd get_config int | egrep "(arm|core|gpu|sdram)_freq|over_volt"
# Measure clock speeds
for src in arm core h264 isp v3d; do echo -e "$src:\t$(vcgencmd measure_clock $src)"; done
@nevercast
nevercast / pixels.py
Last active November 20, 2022 17:34
Simple MicroPython ESP32 RMT NeoPixel / WS2812B driver.
# Copyright public licence and also I don't care.
# 2020 Josh "NeverCast" Lloyd.
from micropython import const
from esp32 import RMT
# The peripheral clock is 80MHz or 12.5 nanoseconds per clock.
# The smallest precision of timing requried for neopixels is
# 0.35us, but I've decided to go with 0.05 microseconds or
# 50 nanoseconds. 50 nanoseconds = 12.5 * 4 clocks.
# By dividing the 80MHz clock by 4 we get a clock every 50 nanoseconds.
@johnaboxall
johnaboxall / 14201491-oled-TCA9548A
Created October 26, 2019 02:41
Using TCA9548A with OLED on Arduino
// Display - https://pmdway.com/collections/oled-displays/products/0-49-64-x-32-white-graphic-oled-i2c
// Guide - https://pmdway.com/blogs/product-guides-for-arduino/tutorial-using-the-0-49-64-x-32-graphic-i2c-oled-display-with-arduino
// TCA9548A - https://pmdway.com/blogs/product-guides-for-arduino/using-the-tca9548a-1-to-8-i2c-multiplexer-breakout-with-arduino
#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h>
void TCA9548A(uint8_t bus)
{
async () => {
const response = await fetch('large.bin');
const buffer = await response.arrayBuffer();
};
@thijstriemstra
thijstriemstra / play.sh
Last active March 22, 2023 06:58
omxplayer USB audio
# Playback on USB audio device (the second soundcard's first device),
# with omxplayer:
#
# $ ./play.sh myfile.mp4
#
# Use 'aplay -l' to list available devices, e.g:
#
# $ aplay -l
# card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]
# Subdevices: 1/1
@yasamoka
yasamoka / cncjs-pendant-python-example.py
Created February 3, 2018 05:06
CNC.js pendant Python example
# inspired by cncjs-pendant-raspi-gpio: https://github.com/cncjs/cncjs-pendant-raspi-gpio
# This CNC.js pendant opens a connection to the CNC.js web server, opens a serial port connection,
# writes a command, then terminates.
import jwt
import logging
from socketIO_client import SocketIO, LoggingNamespace
SERVER_ADDRESS = "localhost"
SERVER_PORT = 8000
@boneskull
boneskull / README.md
Last active November 12, 2021 22:45
MicroPython on ESP32: MQTT and DS18B20 temperature sensor full example
/*
* Multiplexed SSD1306 Demo
* Copyright © 2018-01-02 tobozo
*
* https://github.com/tobozo
* https://twitter.com/tobozotagada
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the “Software”), to deal in
* the Software without restriction, including without limitation the rights to