Skip to content

Instantly share code, notes, and snippets.

View traverseda's full-sized avatar

traverseda traverseda

  • Halifax, Nova Scotia, Canada
View GitHub Profile

This is a proposal, no code has actually been written yet.

A python preprocessor that extends python syntax to make it easier to use python as a bash replacement.

Inspired by xonsh, we first determine if something should be running in "shell" mode or python mode.

print hello world #Shell mode

Pynto

PYthon Network Transparent Objects

A "remote object" interface inspired by rpyc.

This lets you access a python object running in a different process as if it was local, and running in your process. This is great for quickly prototyping new software. A chat server can be as simple as exposing a list object and letting users append their messages to it.

"""A type-hinted messagepack-like serializer for immutable python types.
Could be extended to a generic type-hinted messagepack serializer without too much trouble.
If you need that, feel free to reach out.
https://github.com/msgpack/msgpack/blob/master/spec.md
"""
from typing import Union, Tuple, FrozenSet
baseImmutableTypes = Union[str,int,bool,float,bytes,slice,complex,None] #Ellipsis?
import argparse
import asyncio
import logging
import math
import cv2
import numpy
from av import VideoFrame
from aiortc import (
cmake_minimum_required(VERSION 3.17)
project(imgui LANGUAGES CXX)
execute_process(COMMAND cling-config --cmake OUTPUT_VARIABLE CPPYY_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
# Make sure this is set to something like:
# ~/.local/lib/python2.7/site-packages/cpyy_backend/cmake
message("CPYY_MODULE_PATH: " ${CPPYY_MODULE_PATH})
list(INSERT CMAKE_MODULE_PATH 0 ${CPPYY_MODULE_PATH})
find_package(Cppyy)
cmake_minimum_required(VERSION 3.17)
project(imgui LANGUAGES CXX)
execute_process(COMMAND cling-config --cmake OUTPUT_VARIABLE CPPYY_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
# Make sure this is set to something like:
# ~/.local/lib/python2.7/site-packages/cpyy_backend/cmake
message("CPYY_MODULE_PATH: " ${CPPYY_MODULE_PATH})
list(INSERT CMAKE_MODULE_PATH 0 ${CPPYY_MODULE_PATH})
find_package(Cppyy)
"""Tree objects that support the `with` statement.
A bit of an OOP mess though.
"""
import contextvars
defaultParent = contextvars.ContextVar('defaultParent', default=None)
treeSessionStack=[]
from collections import UserList
import weakref
"""
Horrible hacks to allow context managers to exit early, *not* running
whatever code they're wrapping. I'm not sure if this is a reasonable
thing to do or not....
"""
import sys
class ExitEarlyException(Exception):
"""This is an exception that python
import pyglet
import inspect
import mahi_gui
from mahi_gui import imgui
def redirect_pyglet():
import pyglet
# Do not create a hidden window and opengl context
pyglet.options['shadow_window'] = False
# Trick pyglet into using an external context
"""Generate books from a list of urls in tabletop simulator
"""
import sys, json, os, copy
bookBag={"SaveName":"","GameMode":"","Date":"","Gravity":0.5,"PlayArea":0.5,"GameType":"","GameComplexity":"","Tags":[],"Table":"","Sky":"","Note":"","Rules":"","TabStates":{},"ObjectStates":[{"Name":"Bag","Transform":{"posX":57.0064,"posY":1.26014686,"posZ":-2.550843,"rotX":1.26331825e-05,"rotY":-2.48861652e-05,"rotZ":6.62508e-06,"scaleX":1,"scaleY":1,"scaleZ":1},"Nickname":"Book Bag","Description":"","GMNotes":"","ColorDiffuse":{"r":0.7058823,"g":0.366520882,"b":0},"Locked":False,"Grid":True,"Snap":True,"IgnoreFoW":False,"MeasureMovement":False,"DragSelectable":True,"Autoraise":True,"Sticky":True,"Tooltip":True,"GridProjection":False,"HideWhenFaceDown":False,"Hands":False,"MaterialIndex":-1,"MeshIndex":-1,"LuaScript":"","LuaScriptState":"","XmlUI":"","ContainedObjects":[]}],"LuaScript":"","LuaScriptState":"","XmlUI":"","VersionNumber":""}
books=bookBag["ObjectStates"][0]["ContainedObjects"]
bookBase = {