Skip to content

Instantly share code, notes, and snippets.

View justinfx's full-sized avatar

Justin Israel justinfx

View GitHub Profile
from flask.ext.restful import Resource
from flask import Response
from ctypes import CDLL
gotest = CDLL("gotest.so")
class api2(Resource):
def get(self):
return gotest.GetValWithConcurrency()
@justinfx
justinfx / repeat.py
Created May 25, 2015 10:40
Example of a repeatable command decorate, for Maya (maya.cmds)
"""
Original example reformatted from:
http://blog.3dkris.com/2011/08/python-in-maya-how-to-make-commands.html
python_inside_maya discussion:
https://groups.google.com/d/topic/python_inside_maya/xfuCYBO6aLg/discussion
"""
import maya.cmds as cmds
@justinfx
justinfx / child.py
Last active May 22, 2018 12:52
Using subprocess in Python, to communicate between Parent/Child via STDIN pipe (https://groups.google.com/d/msg/python_inside_maya/waJHs-gsS4c/j0_q39Nj4h0J)
#!/usr/local/bin python
import time
import subprocess
def main():
p = subprocess.Popen(["python", "child.py"], bufsize=0, stdin=subprocess.PIPE)
for i in xrange(10):
p.stdin.write("Parent command: %d\n" % i)
@justinfx
justinfx / web_threads.py
Created December 27, 2014 03:16
Example of using worker QThreads to process data before loading web results. (pyside, qt)
from PySide import QtCore, QtGui, QtWebKit
from threading import current_thread
class MainWindow(QtGui.QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
container = QtGui.QWidget(self)
@justinfx
justinfx / go_test.go
Created December 16, 2014 10:19
Some basic benchmarks of fileseq vs gofileseq vs seqls
package main
import (
"github.com/justinfx/gofileseq"
"testing"
)
func BenchmarkGoSeq10(b *testing.B) {
var res fileseq.FileSequences
var err error
#!/usr/bin/env python
"""
Re: https://groups.google.com/d/topic/python_inside_maya/ISwX-LOAcnc/discussion
"""
class ObjProcessor(object):
def __init__(self, filename):
self.filename = filename
@justinfx
justinfx / cix_to_py.py
Created June 1, 2014 05:39
A small script to convert a .cix (codeintel schema) file into a python stub module, for use in auto-completion
#!/usr/bin/env python
'''
A small script to convert a .cix (codeintel schema) file into
a python stub module, for use in auto-completion.
https://community.activestate.com/faq/codeintel-cix-schema
Requires jinja2 for the output template format
'''
@justinfx
justinfx / trans_qt_browser.py
Last active January 16, 2019 07:45
Qt/PySide example of a partially transparent browser window, based on screenshot: http://goo.gl/UiULPU
#!/usr/bin/env python
from PySide import QtCore, QtGui, QtWebKit
class TransWindow(QtGui.QDialog):
"""
Example of a partially transparent browser window
Base on screenshot: http://goo.gl/UiULPU
"""
@justinfx
justinfx / convert_imagick.go
Last active August 29, 2015 14:00
comparing OpenImageIGO to iMagick
package main
import (
"github.com/justinfx/imagick/imagick"
"runtime"
)
const (
WIDTH = 320
HEIGHT = 240
@justinfx
justinfx / qtWidgetLeaks.py
Last active August 29, 2015 14:00
A helper class for monitor widget growth and trying to track if instances are leaking
import pprint
import datetime
from collections import defaultdict
from PySide import QtCore, QtGui
class WidgetLeakWatcher(QtCore.QObject):
"""
Monitor the growth or existance of widgets in
the application, at intervals.