Skip to content

Instantly share code, notes, and snippets.

@enkiusz
enkiusz / zketech-ebc-a20.py
Last active April 20, 2025 09:26
ZKETECH EBC-A20 Control code
#!/usr/bin/env python3
"""
A simple CLI tool to control and monitor the ZKETECH EBC-A20 battery
tester from https://www.zketech.com/en/
It can trigger charge or discharge as well as perform charge-discharge
cycles to measure battery capacity.
Currenly only the CC (Constant Current) load type is implemented, the
CP (Constant Power) load type is a simple fixme. Additionally, some
  1. Install ptvsd using the same Python interpreter Qgis uses. E.g. on Windows:
C:\OSGeo4W64\apps\Python37\python.exe -m pip install ptvsd==4.3.2 
  1. Add a debug configuration to launch.json:
{
    "name": "Python: Remote Attach",
@AsgerPetersen
AsgerPetersen / notes.md
Last active March 28, 2025 18:31
Debugging QGIS 3.x python plugins on OSX using VS Code

Debugging QGIS 3.x python plugins on OSX using VS Code

Plugin

In QGIS install the plugin debugvs.

Python dependencies

The debugvs plugin needs the python module ptvsd to function. This module is not installed by default.

In principle you just pip install ptvsd in the python interpreter used by QGIS.

@lars-tiede
lars-tiede / asyncio_loops.py
Last active April 3, 2024 15:28
asyncio + multithreading: one asyncio event loop per thread
import asyncio
import threading
import random
def thr(i):
# we need to create a new loop for the thread, and set it as the 'default'
# loop that will be returned by calls to asyncio.get_event_loop() from this
# thread.
loop = asyncio.new_event_loop()
@cgudea
cgudea / geodesy_regex.py
Created August 28, 2014 19:38
regular expressions for verifying common coordinate systems
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#