Change name of imported type (aliasing)
The goal is to make code more productive and clean in cases where multiple classes with same name must be used in code. It should relief a developers frustration in that
| #!/usr/bin/env python3 | |
| """PR #3381 — Single-command outlet test. | |
| Usage: python3 .ai/bug4-outlet-toggle-test.py <test> [port] | |
| Tests: | |
| og1.off.le SOG_0 (OG1) OFF, LE word order | |
| og1.on.le SOG_0 (OG1) ON, LE word order | |
| og1.off.be SOG_0 (OG1) OFF, BE word order | |
| og1.on.be SOG_0 (OG1) ON, BE word order |
| #!/usr/bin/env python3 | |
| """Test EchterAgo's probe idea: write CANCEL|OUTPUT_ON|OUTPUT_OFF to OutletCommand_BF. | |
| On spec-compliant firmware: EMBXILVAL (invalid command combo detected) | |
| On LE-buggy firmware: different error or no error (combo lands in reserved bits) | |
| Must run with NUT driver stopped: systemctl stop nut-driver@apc | |
| """ | |
| import sys |
| #!/usr/bin/env python3 | |
| """Test: Modbus/TCP word order via APC NMC. | |
| Reads raw register values to verify read word order, then tests write | |
| word order for OutletCommand (load.on) in both big-endian and little-endian. | |
| Safe: load.on while already on is a NOOP. | |
| Usage: | |
| python3 bug4-test-modbus-tcp.py <NMC_HOST> [NMC_PORT] |
| #!/usr/bin/env python3 | |
| """Bug 4 — Test: Does setting SOURCE_RJ45_PORT bit fix OutletCommand writes? | |
| This script bypasses the NUT driver and sends a raw Modbus write to register | |
| 1538 (OutletCommand_BF) with the SOURCE_RJ45_PORT bit (bit 14) set. | |
| Command: load.on targeting MOG (Main Outlet Group) | |
| - Without source bit: 0x0102 = CMD_OUTPUT_ON | TARGET_MOG | |
| - With source bit: 0x4102 = CMD_OUTPUT_ON | TARGET_MOG | SOURCE_RJ45_PORT |
| #!/usr/bin/env python3 | |
| """Bug 4 — Test: Confirm word-order bug in apc_modbus OutletCommand writes. | |
| The NUT driver's _apc_modbus_from_uint64() stores 32-bit values in big-endian | |
| word order: [MSW, LSW]. But APC UPS expects little-endian: [LSW, MSW]. | |
| For command value 0x0102 (load.on + MOG): | |
| - NUT sends: [0x0000, 0x0102] → FAILS (value in wrong register) | |
| - Correct: [0x0102, 0x0000] → WORKS (value in register 1538) |
| { | |
| "mcpServers": { | |
| "github": { | |
| "command": "docker", | |
| "args": [ | |
| "run", | |
| "-i", | |
| "--rm", | |
| "-e", | |
| "GITHUB_PERSONAL_ACCESS_TOKEN", |
| #!/usr/bin/env python | |
| """Fetch unresolved review comments from a GitHub PR. | |
| Based on: https://stackoverflow.com/a/66072198/844449 | |
| Usage: | |
| python scripts/gh-comments.py [PR_NUMBER] | |
| python scripts/gh-comments.py 17 | |
| """ |
| --- | |
| apiVersion: v1 | |
| kind: ServiceAccount | |
| metadata: | |
| name: shell-cluster-admin | |
| --- | |
| apiVersion: rbac.authorization.k8s.io/v1 | |
| kind: ClusterRoleBinding | |
| metadata: | |
| name: shell-cluster-admin |
| --- a | |
| +++ b | |
| +--- | |
| apiVersion: autoscaling/v2 | |
| kind: HorizontalPodAutoscaler | |
| metadata: | |
| name: php-apache | |
| spec: | |
| scaleTargetRef: | |
| apiVersion: apps/v1 |