This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Pass-thru process output by adding stdout/stderr tags and timestamps | |
| This is an 'async' version, it uses aiostream.stream.merge() to merge | |
| stdout and stderr streams. | |
| Requires https://github.com/vxgmichel/aiostream: | |
| pip install aiostream | |
| """ | |
| import sys | |
| import asyncio, aiostream |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Code from "Fluid Simulation for Dummies" paper using numpy | |
| # https://mikeash.com/pyblog/fluid-simulation-for-dummies.html | |
| # | |
| # See also: | |
| # * Real-Time Fluid Dynamics for Games | |
| # http://graphics.cs.cmu.edu/nsp/course/15-464/Fall09/papers/StamFluidforGames.pdf | |
| # * Lily Pad: Towards Real-time Interactive Computational Fluid Dynamics | |
| # https://arxiv.org/abs/1510.06886 | |
| # https://github.com/weymouth/lily-pad | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Game of life game on python using numpy | |
| import numpy as np | |
| import numpy.typing as npt | |
| import matplotlib.pyplot as plt | |
| from collections.abc import Iterable, Generator | |
| # Roll around edges: True - Original "Game of Life" behavior | |
| ROLL_EDGES = True | |
| # Sleep between frames |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Clifford algebra experiments | |
| Uses https://pypi.org/project/clifford/ module: | |
| pip install clifford | |
| """ | |
| from clifford import g2, g3 | |
| import clifford # type-hints | |
| import numpy as np | |
| def nabla_clifford(space: np.array, *, blades: tuple or None=None, axes: tuple or None=None) -> np.array: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Approximation of the tempered musical intervals via rational numbers | |
| See https://en.wikipedia.org/wiki/Interval_(music) | |
| """ | |
| import math | |
| import music_math | |
| # Closest ratios for intervals in the octave | |
| # as rational numbers, format: (<divident>, <divisor>) | |
| RATIONAL_ARRAY = [(1, 1), # 0: Unison |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Simple polynomial approximation tool""" | |
| import math | |
| class approximator: | |
| """Approximate signal value, by keeping track of its derivatives over time""" | |
| # Vector of the signal value deltas tuple(val, time): | |
| # 0 - values itself (zero-derivative): | |
| # delta0: value | |
| # time0: time | |
| # 1 - first mean derivative for the interval 'time1' to 'time0': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo "Adding $2 secs to $1" | |
| epoch=$(date -d "$1" +%s) | |
| result=$(expr $epoch + $2) | |
| echo $epoch + $2 = $result | |
| date -d @$result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| setlocal EnableDelayedExpansion | |
| set BASE_DIR=%~dp0release-1928-x64-gdal-3-2-1-mapserver-7-6-2 | |
| set BIN_BASE_DIR=%BASE_DIR%\bin | |
| set GDAL_DRIVER_PATH=%BIN_BASE_DIR%\gdal\plugins | |
| for /F %%x IN ( | |
| 'py -c "from importlib import util; osgeo=util.find_spec('osgeo'); print(osgeo.submodule_search_locations[0] if osgeo else '')"' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class integrator: | |
| def __init__(self, start, tau): | |
| self.output_dot_tau = start * tau | |
| self.tau = tau | |
| def __call__(self, input, period=1): | |
| # Optimized from "period * (input - self.output) / self.tau + self.output" | |
| self.output_dot_tau += period * (input - self.output_dot_tau / self.tau) | |
| return self.output_dot_tau / self.tau |