Rico's Nerd Cluster

「离开世界之前 一切都是过程」

Compute Comparison

Arduino Uno vs Rpi Zero vs Rpi 4b+ vs Rpi 5 vs Nvidia Orin Nano Across Multiple Dimensions

Memory Device RAM Cache (L1 / L2) Disk / Storage / Non-Volatile Memory Notes Arduino UNO 2 KB ❌ None No Disk; Program...

Arduino Notes

View

Common Commands millis() is unsigned long 1 unsigned long previous_time = millis() uint8_t lowByte(uint16_t value); 1 2 3 uint16_t value = 0x1234; uint8_t lower = lowByte(value); ...

Python - Numpy View and Contiguous Array

View

What is np.view When slicing or transpose takes place on an array, we actually get a np.view object that shares the underlying memory with the array. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...

Python - Numpy and Pandas Operations

A Mumbo Jumbo Of Numpy and Pandas Operations and Examples

Numpy General Programming Rules In Numpy np allocates memory like C, so it’s contiguous. Math operations can be applied to all elements, which is a lot faster than for loop and use math modu...

Python - Python Subprocessing

Subprocess

Subprocess Module Reference The recommended approach to invoking subprocesses is to use the run() function for all use cases it can handle. For more advanced use cases, the underlying Popen inter...

Python - Python Packaging System

Packaging, Pip

Setuptools Entrypoints Entrypoints are a way to specify components in your package to the rest of the python space, so they can be dynamically discovered. So this enables: Console scripts (co...

Python - Poetry Packaging System and Pip

Poetry, Pip

Introduction Using Poetry is highly recommended because it simplifies dependency management and packaging, even when not using virtual environments. Environments without Poetry can install poetry ...

Python - How To Write Pytest

Pytest Is The New Black (Compared To Unittest)

Run Pytest Run a specific test file pytest path/to/test_file.py Run a test in it: pytest path/to/test_file.py::test_function_name Assert For integer assertions: 1 assert (1==1) F...

Python - Immutable And Memory View

Python has mutable and immutable objects: Mutables: bytearray list … Immutables: string bytes … 1 2 3 4 buf = bytearray(b"hello world") mv = memoryview(buf) mv2 = mv[6:11] ...

Python - Python Mixin Classes

MRO

Mixins A mixin is a small, focused class that provides methods to be “mixed in” to other classes via multiple inheritance. Mixins let you bundle reusable behaviors and add them to any class, keepi...