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
| #!/usr/bin/env sh | |
| # A script that receives start and end parameters in the format HH:mm and | |
| # exit with an error code if the current time is not within the desired | |
| # window. | |
| # The given times are not inclusive, so if you want 06:00-10:00 inclusive | |
| # you need to specify 05:59 and 10:01 respectively. | |
| # This script assumes that we are interested in time periods shorter than | |
| # a single day, and it handles overnight periods. | |
| # Inspired by https://unix.stackexchange.com/a/395936/305967 |
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
| #Profile addition to redefine cd as a proxy for push location (and cd- for Pop). | |
| # cd ... is transformed into into cd ..\.. (extra dot is an extra level), | |
| # cd ^ is transformed into cd <<script i.e. profile>> directory | |
| # cd \*doc is transformed into cd \*\Doc*\ | |
| # cd = is transformed into an item from the stack. = is the first each extra = goes one deeper in the stack | |
| # cd - will not tab expand but will pop an item from the location stack. 3 or more - will do an extra pop. | |
| # -- means "all the rest are a strings", so two levels needs -- -- | |
| # cd ~ Now supports tab expansion | |
| # cd ~~ Tab completes "Special" folders (e.g. MyDocuments, Desktop, ProgramFiles) | |
| # cd ~~Name\ Transorms to or tab completes the special folder |
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
| import os | |
| import sys | |
| import bpy | |
| output = None | |
| input = None | |
| info = None | |
| error = None | |
| write = None |
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
| import maya.api.OpenMaya as om | |
| import pymel.core as pm | |
| def intersect_mesh(pos, vec, mesh_name): | |
| selectionList = om.MSelectionList() | |
| selectionList.add(mesh_name) | |
| dagPath = selectionList.getDagPath(0) | |
| fnMesh = om.MFnMesh(dagPath) |
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
| import maya.OpenMaya as om | |
| import maya.cmds as cmds | |
| def getUvShelList(name): | |
| selList = om.MSelectionList() | |
| selList.add(name) | |
| selListIter = om.MItSelectionList(selList, om.MFn.kMesh) | |
| pathToShape = om.MDagPath() | |
| selListIter.getDagPath(pathToShape) | |
| meshNode = pathToShape.fullPathName() |
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
| # colored stream handler for python logging framework (use the ColorStreamHandler class). | |
| # | |
| # based on: | |
| # http://stackoverflow.com/questions/384076/how-can-i-color-python-logging-output/1336640#1336640 | |
| # how to use: | |
| # i used a dict-based logging configuration, not sure what else would work. | |
| # | |
| # import logging, logging.config, colorstreamhandler | |
| # |
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
| ''' | |
| Exposes the MayaPyManager class, which is used to run instances of MayaPy with explict control over paths and environment variables. A Manager can run scripts, modules, or command strings in a separate MayaPy environment; results and errors are captured and returned. | |
| Typical uses might be: | |
| - running unit tests | |
| - running a copy of Maya.standalone as a headless RPC server with StandaloneRPC https://github.com/theodox/standaloneRPC | |
| - spawning multipe copies of maya to batch process files in parallel on a multi-core machine | |
| - do any of the above on multiple maya versions concurrently |
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 demonstration of how to implement Server-sent events (SSE) in Python | |
| using Bottle micro web-framework. | |
| SSE require asynchronous request handling, but it's tricky with WSGI. One way | |
| to achieve that is to use gevent library as shown here. | |
| Usage: just start the script and open http://localhost:8080/ in your browser. | |
| Based on: |