Skip to content

Instantly share code, notes, and snippets.

View cdeil's full-sized avatar

Christoph Deil cdeil

View GitHub Profile
(memray-crash) (base) cdeil@Kryvoff-MBP memray-crash % lldb -- python -m pytest test_example.py --memray
(lldb) target create "python"
Current executable set to '/Users/cdeil/temp/memray-crash/.venv/bin/python' (arm64).
(lldb) settings set -- target.run-args "-m" "pytest" "test_example.py" "--memray"
(lldb) process handle SIGILL --stop true --pass false --notify true
NAME PASS STOP NOTIFY
=========== ======= ======= =======
SIGILL false true true
(lldb) bt
error: Command requires a current process.
"""Snake in Arcade.
# Learnings
1. Key input handling and update time delta is tricky.
Creating `snake.direction_commands` to keep track works well.
The `time_to_move` solution here works OK.
A simpler alternative could be to use `Window.update_rate` which
is passed to `on_update` as `delta_time` directly.
2. Grid vs pixel coordinates can litter the code.
"""
Solar system simulation. Visualisation with Arcade.
"""
import collections
import dataclasses
import math
import time
import arcade
"""
Solar system simulation. Visualisation with Arcade.
"""
import arcade
class Vec2d:
def __init__(self, x: float, y: float):
self.x = x
@cdeil
cdeil / ms.md
Created January 4, 2025 08:23
asdf

Demo:

version: 5
environments:
default:
channels:
- url: https://conda.anaconda.org/conda-forge/
indexes:
- https://pypi.org/simple
packages:
osx-arm64:
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/bzip2-1.0.8-h99b78c6_7.conda
{
"build": "hf2054a2_0",
"build_number": 0,
"depends": [
"pthread-stubs",
"xorg-libxau >=1.0.11,<2.0a0",
"xorg-libxdmcp"
],
"license": "MIT",
"license_family": "MIT",
reading sources... [100%] upgrade
/Users/cdeil/code/oss/panel/doc/api/panel.__init__.rst:4: WARNING: Could not import class or module '__init__.panel' specified for inheritance diagram
/Users/cdeil/code/oss/panel/doc/api/panel.__init__.rst:5: WARNING: Explicit markup ends without a blank line; unexpected unindent.
/Users/cdeil/code/oss/panel/doc/api/panel.__main__.rst:4: WARNING: Could not import class or module '__main__.panel' specified for inheritance diagram
/Users/cdeil/code/oss/panel/doc/api/panel.__main__.rst:5: WARNING: Explicit markup ends without a blank line; unexpected unindent.
/Users/cdeil/code/oss/panel/doc/api/panel.__version.rst:4: WARNING: Could not import class or module '__version.panel' specified for inheritance diagram
/Users/cdeil/code/oss/panel/doc/api/panel.__version.rst:5: WARNING: Explicit markup ends without a blank line; unexpected unindent.
/Users/cdeil/code/oss/panel/doc/api/panel._param.rst:4: WARNING: Could not import class or module '_param.panel' specified for inheritance di
panel $ pixi run -e test-ui pytest --ui panel/tests/ui/widgets/test_icon.py -v --browser chromium -n logical --dist no -n 0
=============================================================================================== test session starts ================================================================================================
platform darwin -- Python 3.12.5, pytest-7.4.4, pluggy-1.5.0 -- /Users/cdeil/code/oss/panel/.pixi/envs/test-ui/bin/python3.12
cachedir: .pytest_cache
rootdir: /Users/cdeil/code/oss/panel
configfile: pyproject.toml
plugins: asyncio-0.23.8, cov-5.0.0, github-actions-annotate-failures-0.2.0, playwright-0.5.0, rerunfailures-14.0, anyio-4.4.0, base-url-2.1.0, xdist-3.6.1
asyncio: mode=Mode.AUTO
collected 17 items
(panel) (panel) panel $ pixi run test-ui
✨ Pixi task (_install-ui in test-ui): playwright install chromium
Removing unused browser at /Users/cdeil/Library/Caches/ms-playwright/chromium-1084
Removing unused browser at /Users/cdeil/Library/Caches/ms-playwright/chromium-1105
Removing unused browser at /Users/cdeil/Library/Caches/ms-playwright/chromium-1117
Removing unused browser at /Users/cdeil/Library/Caches/ms-playwright/firefox-1425
Removing unused browser at /Users/cdeil/Library/Caches/ms-playwright/webkit-1921
Downloading Chromium 127.0.6533.17 (playwright build v1124) from https://playwright.azureedge.net/builds/chromium/1124/chromium-mac-arm64.zip
136.9 MiB [====================] 100% 0.0s
Chromium 127.0.6533.17 (playwright build v1124) downloaded to /Users/cdeil/Library/Caches/ms-playwright/chromium-1124