Skip to content

Instantly share code, notes, and snippets.

View defencedog's full-sized avatar

defencedog

  • Pakistan
View GitHub Profile
@maxiimilian
maxiimilian / multi_root.py
Last active May 27, 2024 13:27
Function to look for all roots within given interval/bracket based on scipy's `root_scalar`. Resolution `n` of this function only needs to be high enough so that all sign changes of roots are covered.
import warnings
from typing import Callable, Iterable
import numpy as np
from scipy.optimize import root_scalar
def multi_root(f: Callable, bracket: Iterable[float], args: Iterable = (), n: int = 30) -> np.ndarray:
""" Find all roots of f in `bracket`, given that resolution `n` covers the sign change.
Fine-grained root finding is performed with `scipy.optimize.root_scalar`.
@ShannonScott
ShannonScott / Video Screen Capture with GStreamer.md
Created October 30, 2019 16:28
[Video Screen Capture with GStreamer] Capture a Linux desktop window video with gsteramer. #tags: gstreamer, linux, xwindows, video

Capture a video of a given X Window with gstreamer.

X Window ID

Get the target window ID with the following:

xwininfo