Skip to content

Instantly share code, notes, and snippets.

View pmp-p's full-sized avatar
🚜
coding or farming

Paul m. p. Peny pmp-p

🚜
coding or farming
View GitHub Profile
@pmp-p
pmp-p / nginx.conf
Created March 10, 2024 07:22 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@pmp-p
pmp-p / repro.sh
Last active February 9, 2024 02:37
gc orc/arc bug
#!/bin/bash
# wasi-sdk from https://github.com/WebAssembly/wasi-sdk/releases
# Nim git
PATH=/opt/wasi-sdk-21.0/bin:$PATH ./Nim/bin/nim \
--exceptions:goto \
--cc:clang -d:wasi --threads:off -d:emscripten --cpu:wasm32 \
--passC="-m32 -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_MMAN" \
@pmp-p
pmp-p / wmaltmouse.au3
Created February 7, 2024 02:18
move win32 windows like on most Xwindows desktops (autoit)
#cs ----------------------------------------------------------------------------
move win32 windows like on most Xwindows desktops (autoit)
AutoIt Version: 3.3.8.1
Author: pmp-p
https://github.com/pmp-p
@pmp-p
pmp-p / mocap.py
Created January 2, 2023 20:29 — forked from rdb/mocap.py
Motion capture animation recording in Panda3D
from panda3d.core import CharacterJoint, CharacterSlider, CharacterVertexSlider
from panda3d.core import AnimBundle, AnimGroup, AnimChannelScalarDynamic
from panda3d.core import AnimChannelMatrixXfmTable, AnimChannelScalarTable
from panda3d.core import PTA_float
class MotionCapture:
def __init__(self, actor, part_name="modelRoot", lod_name="lodRoot"):
self.part_bundle = actor.get_part_bundle(part_name, lod_name)
self.joint_tables = {}
@pmp-p
pmp-p / find-top-level-from-wheel-file.py
Created October 2, 2022 00:11 — forked from pradyunsg/find-top-level-from-wheel-file.py
Figuring out the top-level importable names from a wheel
"""Takes a .whl file and figures out the top-level importable names in that wheel.
Usage:
$ python find-top-level-from-wheel-file.py ./setuptools-65.4.1-py3-none-any.whl
['_distutils_hack', 'pkg_resources', 'setuptools']
Testing:
$ pytest find-top-level-from-wheel-file.py
...
@pmp-p
pmp-p / webrtc-editor.md
Created May 24, 2022 12:12 — forked from aoloe/webrtc-editor.md
webrtc collaborative document editing

specification:

  • php server storing a server.
  • the first person opening a file becomes the master and is in charge to save to the server
  • all other users open webrtc connection to the master and keep the document in sync with him
  • if it makes things easier, only allow one user at a time to edit a block (paragraph, list, section)

todo:

  • check if and how to get webrtc to work without a node server.
  • try to convert a chat example in a text editor.
@pmp-p
pmp-p / noargs_checker.py
Last active June 4, 2022 12:33
METH_NOARGS checker
#!/bin/env python3.11
import sys, os
SRC = sys.argv[-1]
if SRC[0] == "/":
print("only relative paths to . !")
raise SystemExit
ROOTDIR = f"{os.getcwd()}/{SRC}"
@pmp-p
pmp-p / python-wasm-build.sh
Last active March 7, 2022 11:49
python-wasm-plus
#!/bin/env bash
reset
PREFIX=
ASSETS=$(realpath assets)
echo "
PREFIX=${PREFIX}
ASSETS=${ASSETS}
"
rm ${PREFIX}browser-gui/worker/python.*
@pmp-p
pmp-p / gentest.c
Last active November 23, 2020 11:50
Run python tests as typed in REPL, displaying code input + result
#include <stdio.h>
#include <stdlib.h>
#define PY_SSIZE_T_CLEAN
#include <Python.h>
// NEED https://github.com/python/cpython/pull/22190 applied !
#define MAX 1024
char buf[MAX];
@pmp-p
pmp-p / Panda3D hosted by wxPython as Subprocess.py
Created October 28, 2020 11:24 — forked from hubertgrzeskowiak/Panda3D hosted by wxPython as Subprocess.py
This is an example on how to create a Panda3d instance in a subprocess, which window is hosted in a wxPython panel. This approach has the advantage of scope separation (both libraries define globals) and framerate independence. The disadvantage is the more complex communication between the processes.
import sys
import os
from multiprocessing import Process, Pipe
import wx
from direct.task import Task
from pandac.PandaModules import WindowProperties
from pandac.PandaModules import loadPrcFileData
from direct.showbase.ShowBase import ShowBase