Skip to content

Instantly share code, notes, and snippets.

@ddelpero
ddelpero / waitress_server.py
Created March 20, 2019 13:21
Python waitress windows service
# Example class to start a Waitress server as a windows service
# the specific use case is running Waitress as a windows server using pywin32
# The Waitress docs only show how to use waitress-serve, but since waitress-serve is blocking
# you don't get a return value, which makes it impossible to gracefully stop the Waitress server
# from a windows service
# However, looking at the waitress-serve code, it's easy to write a custom class
# example pywin32 windows service: https://gist.github.com/drmalex07/10554232
from waitress.server import create_server
@ddelpero
ddelpero / constant_error_lookup.omh
Created May 17, 2018 14:02
Omnis Studio Fileops Error code lookup
; cl list
; name character
; ident number long
; desc character
; constantgroup character
; value number long
; errorDesc character
Do $constants.$makelist($ref.$name,$ref.$ident,$ref.$desc,$ref.$constantgroup) Returns cl
Do cl.$redefine(name,ident,desc,constantgroup,value)
@ddelpero
ddelpero / boost_python.cpp
Last active October 19, 2016 18:15
Boost Embedded Python example showing how to send an instantiated C++ object to Python, and then call the object from Python. https://wiki.python.org/moin/boost.python/EmbeddingPython#Full_example
#include "stdafx.h"
#include <boost/python.hpp>
#include <boost/python/handle.hpp>
#include <boost/python/ptr.hpp>
#include <boost/python/class.hpp>
#include <boost/python/errors.hpp>
#include <Python.h>
class CppClass {
@ddelpero
ddelpero / remote_test_runner
Last active October 20, 2016 10:42
Omnis Studio remote task unit test runner
; sample call to run all test case method: http://127.0.0.1:5921/ultra?OmnisLibrary=UnitTest&OmnisClass=rt&testLib=UnitTest&testObject=AssertTest
; sample call to run specific method: http://127.0.0.1:5921/ultra?OmnisLibrary=UnitTest&OmnisClass=rt&testLib=UnitTest&testObject=AssertTest&method=$testAssertFalse_2
If len(pParams.method)
Do $libs.[pParams.testLib].$objects.[pParams.testObject].$newref(pParams.method) Returns tRef
Do tRef.$run()
Set reference testRef to tRef.$ref
Else
@ddelpero
ddelpero / omnis.persistent.data
Created May 21, 2014 15:14
Omnis Studio example to save persistant list data in intial value
//Omnis Studio example to save persistant list data in intial value
//$construct
//ivSaveList: list of list variables to save
Do ivSaveList.$define(listName,saveName,schemaName)
Do ivSaveList.$add('tvComponentType','tvComponentTypeEncoded','sCustomComponents')
Do ivSaveList.$add('tvOptionsList','tvOptionsListEncoded','sOptions')
Do ivSaveList.$add('tvWindowConfigList','tvWindowConfigListEncoded','sWindowConfig')
For ivSaveList.$line from 1 to ivSaveList.$linecount step 1