Skip to content

Instantly share code, notes, and snippets.

@rgov
rgov / trace.py
Created Apr 25, 2022
trace all the python things
View trace.py
#!/usr/bin/env python3
# why the heck are you crashing suddenly
import datetime
import functools
import threading
import traceback
import os
import signal
import sys
View rossniff.py
#!/usr/bin/env python3
'''
This is a so-far unsuccessful script for sniffing ROS service calls.
The idea was to republish them as regular messages so they could be recorded to a rosbag.
But I had trouble getting it to work...
'''
import argparse
import io
View rosbag_to_csv_example.py
#!/usr/bin/env python3
import argparse
import csv
import datetime
import math
import rosbag
parser = argparse.ArgumentParser()
View winch_math.py
#!/usr/bin/env python3
import math
from scipy.integrate import quad
# Starting distance (in meters)
start = 2.0
# Target distance (in meters)
View kernel-uimage+dtb.bbclass
# As of Linux version 3.7, we must provide a device tree blob on boot so that
# the kernel understands our hardware configuration.
#
# However, the version of U-Boot currently in use predates the use of device
# trees, and provides no way of specifying the DTB to load. Therefore, there
# exists a configuration option CONFIG_ARM_APPENDED_DTB=y which instructs the
# kernel to find the DTB immediate following the kernel image itself.
#
# To produce a uImage file with the combined kernel + DTB, we just concatenate
# the two before running mkimage. (Note, the uImage file header includes a
@rgov
rgov / README.md
Created Mar 2, 2021
Use a custom keyring with live-build
View README.md
apt install dirmngr

In auto/config:

# Create a keyring that contains the keys we need for debootstrap
# See https://github.com/ValveSoftware/steam-runtime/issues/81
gpg "--keyring=$(pwd)/config/keyring.gpg" --no-default-keyring --keyserver keyserver.ubuntu.com --receive-keys 0x40976EAF437D05B5

In auto/build, before the build starts:

@rgov
rgov / NOTES.md
Created Feb 18, 2021
Notes on writing an ACPI SSDT
View NOTES.md
$ i2cdetect -l
i2c-3    unknown    i915 gmbus panel                N/A
i2c-1    unknown    i915 gmbus ssc                  N/A
i2c-8    unknown    DPDDC-C                         N/A
i2c-6    unknown    i915 gmbus dpd                  N/A
i2c-4    unknown    i915 gmbus dpc                  N/A
i2c-2    unknown    i915 gmbus vga                  N/A
i2c-0    unknown    SMBus I801 adapter at e000      N/A
i2c-7    unknown    DPDDC-B                         N/A

i2c-5 unknown i915 gmbus dpb N/A

@rgov
rgov / README.md
Last active Feb 18, 2021
Building a custom Ubuntu kernel
View README.md

I had a need to build a custom Ubuntu 18.04 kernel with a minor config option change.

The build script is based on these instructions from the Ubuntu wiki.

Differences from mainline

  • Enables interrupt support for the PCA9535 GPIO controller
  • Excludes the Nvidia DKMS modules
View cam_capture.py
'''
This module provides a function to enable video capture from screen devices such
as attached iPhones. Only macOS hosts are supported.
enable_screen_capture_devices()
You may need QuickTime running to see the devices:
https://stackoverflow.com/questions/48166748/coremediaio-doesnt-list-iphone-camera-unless-quicktime-is-open
'''
View raspi-pinouts.c
static const char *gpio_alt_names_2711[54*6] =
{
"SDA0" , "SA5" , "PCLK" , "SPI3_CE0_N" , "TXD2" , "SDA6" ,
"SCL0" , "SA4" , "DE" , "SPI3_MISO" , "RXD2" , "SCL6" ,
"SDA1" , "SA3" , "LCD_VSYNC" , "SPI3_MOSI" , "CTS2" , "SDA3" ,
"SCL1" , "SA2" , "LCD_HSYNC" , "SPI3_SCLK" , "RTS2" , "SCL3" ,
"GPCLK0" , "SA1" , "DPI_D0" , "SPI4_CE0_N" , "TXD3" , "SDA3" ,
"GPCLK1" , "SA0" , "DPI_D1" , "SPI4_MISO" , "RXD3" , "SCL3" ,
"GPCLK2" , "SOE_N_SE" , "DPI_D2" , "SPI4_MOSI" , "CTS3" , "SDA4" ,
"SPI0_CE1_N", "SWE_N_SRW_N", "DPI_D3" , "SPI4_SCLK" , "RTS3" , "SCL4" ,