Skip to content

Instantly share code, notes, and snippets.

@JarrettR
JarrettR / tft.sh
Created July 5, 2024 16:57
Pi (legacy 32-bit) SPI screen and USB TTY gadget install
pip3 install -y adafruit-python-shell
git clone https://github.com/adafruit/Raspberry-Pi-Installer-Scripts/
cd Raspberry-Pi-Installer-Scripts/
#https://www.tal.org/tutorials/setup-raspberry-pi-headless-use-usb-serial-console
#cmdline additions:
sed -i 's/fbcon=font:VGA8x8/fbcon=font:VGA8x8 modules-load=dwc2,g_serial/g' adafruit-pitft.py
#boot additions
sed -i 's/dtparam=i2c_arm=on/dtparam=i2c_arm=on\ndtoverlay=dwc2/g' adafruit-pitft.py
systemctl enable getty@ttyGS0.service
python adafruit-pitft.py
@JarrettR
JarrettR / esp32_convert_lirc_to_rmt.py
Created May 20, 2024 20:10
Convert LIRC config files to the ESP32 RMT peripheral boilerplate code.
import re
import argparse
class LIRCConfigParser:
def __init__(self, file_path):
self.file_path = file_path
self.config = {}
self.header = None
self.one = None
self.zero = None
#include <ArduinoJson.h>
#include <ArduinoOTA.h>
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <WiFiManager.h>
#include "Config.h"
#include "SerialCom.h"
header = '''
#pragma once
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/rmt.h"
#include "driver/gpio.h"
#include "esp_system.h"
#include "esp_log.h"
//https://github.com/mswietlicki/Lirc_remotes/blob/master/benq.config
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/rmt.h"
#include "driver/gpio.h"
#include "esp_system.h"
#include "esp_log.h"
@JarrettR
JarrettR / fbmp.js
Last active February 24, 2024 22:26
// ==UserScript==
// @name FBMP Hider
// @namespace http://tampermonkey.net/
// @version 2024-01-11
// @description try to take over the world!
// @author You
// @match https://www.facebook.com/marketplace/*
// @require https://code.jquery.com/jquery-3.2.1.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
@JarrettR
JarrettR / swap_components.py
Created July 21, 2022 22:57
KiCad extension for swapping components
"""
Swaps the location of two selected components
"""
import pcbnew
class ComponentSwap(pcbnew.ActionPlugin):
"""
Select two (or more!) components and press the button
"""
def defaults(self):
import subprocess
# .\stm8flash.exe -c stlinkv2 -p stm8s105?4 -r out.bin -b 1
out = b'\x00'
while out == b'\x00':
subprocess.run(['stm8flash.exe', '-c', 'stlinkv2', '-p', 'stm8s105?4', '-r', 'out.bin', '-b', '1'])
@JarrettR
JarrettR / .config
Created March 28, 2020 07:14
Lichee Pi Nano Linux Config
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 4.15.0-rc8 Kernel Configuration
#
CONFIG_ARM=y
CONFIG_ARM_HAS_SG_CHAIN=y
CONFIG_MIGHT_HAVE_PCI=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_HAVE_PROC_CPU=y
CONFIG_STACKTRACE_SUPPORT=y
#Modifications to /boot/* files, will not be saved when powered on.
#Please ensure you edit from the DietPi-RamDisk location /DietPi/*
#NB: This is intended for advanced users, unless you know what you are doing, do not edit this file. Please use the DietPi programs instead.
#NB: Do not remove uncommented lines, as the items are scraped by DietPi programs, on demand.
#------------------------------------------------------------------------------------------------------
# D I E T - P I
# DietPi-Automation settings, applied on the 1st boot of DietPi, ONCE
#------------------------------------------------------------------------------------------------------