Skip to content

Instantly share code, notes, and snippets.

@DeflateAwning
DeflateAwning / polars_upgrade_regex_magic.md
Last active February 21, 2025 00:51
Polars Upgrade Regex Magic

Sometimes the Python Polars library upgrades.

The following are some codebase migrations I've used.

Pre-v0.20.x

  1. Find+Replace: pl.Utf8 -> pl.String

v0.20.31 to v1.x

@DeflateAwning
DeflateAwning / PCB_Ordering_Checklist.md
Last active January 6, 2025 01:24
A KiCAD (or generic) PCB ordering checklist

PCB Ordering Checklist

Check list is tailored for KiCAD.

Main Checklist

  1. Pages are "US Letter" if printing in Canada/US
  2. Print PCB on paper to check footprints
  3. Check STM32 pin assignments with STM32CubeIDE, if applicable.
  4. Revision and date?
  5. Organization logo?
@DeflateAwning
DeflateAwning / RP2040-Zero with MicroPython Setup Guide.md
Last active January 7, 2025 01:01
RP2040-Zero with MicroPython Setup Guide

RP2040-Zero with MicroPython Setup Guide

  1. Install VS Code.
  2. In VS Code, install the "MicroPico" extension.
  3. Download the MicroPython firmware from: https://micropython.org/download/RPI_PICO/RPI_PICO-latest.uf2
  4. Connect the RP2040-Zero to the computer. If a USB Drive doesn't appear, press: reset-down, boot-down, reset-up, boot-up.
  5. Open the USB Drive that appeared. Copy on the MicroPython uf2 file. Wait 30 seconds.
  6. Use Device Manager (or SerialTest) to see that a new USB Serial Device appeared.
  7. In VS Code with MicroPython, see that it's connected (see the status bar at the very bottom).
  8. Optional: Run pip install micropython-rp2-rpi_pico-stubs to install Python type checking helpers.
@DeflateAwning
DeflateAwning / Agilent_DSOX3012A_Scope_Repair.md
Last active December 12, 2024 05:21
Repair Agilent DSO-X 3012A Oscilloscope (Busted Power Supply)
@DeflateAwning
DeflateAwning / np_to_polars_memory.py
Last active March 25, 2025 20:56
Benchmark Numpy to Polars
import numpy as np
import pandas as pd
import polars as pl
import time
from memory_profiler import memory_usage
# Array shapes to test
shapes = [
(10_000, 10),
(10_000, 200),
@DeflateAwning
DeflateAwning / np_columns_to_polars_benchmark.py
Created March 25, 2025 21:05
Benchmark the conversion of Numpy to Polars vs. Numpy to Pandas to Polars
"""
Related to https://github.com/pydata/xarray/issues/10135
Result (in VS Code debugger):
Shape | NumPy → Polars | NumPy → Pandas → Polars
-----------------------------------------------------------------
10,000 x 10 | 0.003997 s | 0.033097 s
10,000 x 200 | 0.002424 s | 0.050915 s
100,000 x 10 | 0.000278 s | 0.021541 s