Skip to content

Instantly share code, notes, and snippets.

View soxofaan's full-sized avatar

Stefaan Lippens soxofaan

View GitHub Profile
@soxofaan
soxofaan / pyrasite-stacktrace-how-to.md
Last active March 22, 2024 00:45 — forked from reywood/how-to.md
How to get a stack trace from a stuck/hanging python script

How to get a stack trace for each thread in a running Python script

Sometimes a Python script will simply hang forever with no indication of what is going wrong. Perhaps it's polling a service that will never return a value that allows the program to move forward.

Here's a way to see where the program is currently stuck, using pyrasite a tool for injecting code into running Python processes.

Install gdb and pyrasite

Install gdb.

@soxofaan
soxofaan / README.md
Last active January 19, 2024 17:48
Simple pretty CSV and TSV file viewer.
@soxofaan
soxofaan / .block
Last active November 19, 2023 20:06
Microphone pitch detection
license: mit
height: 400
border: no
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@soxofaan
soxofaan / merge-cubes-discontinuous-dates.ipynb
Created July 31, 2023 16:53
openEO `merge_cubes` with discontinuous date ranges
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@soxofaan
soxofaan / sdiff.py
Last active June 22, 2023 03:52
Python implementation of side-by-side diff
# Code licensed MIT 2023 Stefaan Lippens
import difflib
import itertools
from typing import List, Tuple, Iterator
class Sdiffer:
def __init__(self, max_width:int = 80):
# Two columns with a gutter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@soxofaan
soxofaan / example03.ipynb
Created September 1, 2022 10:14
openEO Platform forum 412 example 3
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@soxofaan
soxofaan / ensure_pyspark_executor_logging.py
Created April 7, 2020 08:54
Decorator based trick to enable Python logging from PySpark executors
import functools
import logging
import pyspark
from typing import Callable
LOG_FORMAT = "[P%(process)s/%(name)s] %(levelname)s: %(message)s"
def ensure_executor_logging(
f=None, *,
@soxofaan
soxofaan / forum452.ipynb
Created September 9, 2022 15:45
openEO forum 452 use case
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.