Skip to content

Instantly share code, notes, and snippets.

View csaez's full-sized avatar

Cesar Saez csaez

View GitHub Profile
@csaez
csaez / get_weight.py
Last active October 11, 2015 20:37
Softimage: A fast way to get the weight parameter (on mixer) of a given shape property
from xml.dom.minidom import parseString
from sipyutils import si, siut
siget = lambda sFullName: si().Dictionary.GetObject(sFullName)
def GetWeight(p_oShape):
lData = list()
sConn = siut().DataRepository.GetConnectionStackInfo(p_oShape)
for i in parseString(sConn).getElementsByTagName("object"):
if "Mixer" in i.toxml():
@csaez
csaez / one_undo.py
Last active October 11, 2015 20:37
Softimage: A python decorator to wrap an execution into 1 undo level.
from functools import wraps
def OneUndo(function):
@wraps(function)
def _decorated(*args, **kwargs):
try:
Application.BeginUndo()
f = function(*args, **kwargs)
finally:
Application.EndUndo()
@csaez
csaez / wishes.py
Last active December 16, 2015 03:59
Snippet to query wishdev's wishes. getWishes() function returns a dictionary with the wishes submited via http://goo.gl/Ikpxw (stored in google drive).
import urllib
from xml.dom import minidom
def getWishes():
URL = "http://goo.gl/67wYX"
urllib.urlcleanup()
xmldata = minidom.parseString(urllib.urlopen(URL).read())
columns = dict()
for node in xmldata.getElementsByTagName("entry"):
@csaez
csaez / ui2py.bat
Last active December 16, 2015 17:40
Handy shortcut to convert a .ui file into python module (using pyuic4 provided by PyQt4).
pyuic4 -x %1 -o %~n1.py
@csaez
csaez / guess_the_number.py
Last active December 17, 2015 04:49
Interactive Programming in Python - Mini-project #2: "Guess the number" game
# Mini-project #2 - "Guess the number"
#
# 'Introduction to Interactive Programming in Python' Course
# RICE University - coursera.org
# by Joe Warren, John Greiner, Stephen Wong, Scott Rixner
import simplegui
import random
# initialize global variables used in your code
@csaez
csaez / stopwatch.py
Last active December 17, 2015 04:49
Interactive Programming in Python - Mini-project #3 - "Stopwatch: The Game"
# Mini-project #3 - "Stopwatch: The Game"
#
# 'Introduction to Interactive Programming in Python' Course
# RICE University - coursera.org
# by Joe Warren, John Greiner, Stephen Wong, Scott Rixner
import simplegui
# define global variables
@csaez
csaez / pong.py
Last active December 17, 2015 10:58
Interactive Programming in Python - Mini-project #4 - "Pong"
# Mini-project #4 - "Pong"
#
# 'Introduction to Interactive Programming in Python' Course
# RICE University - coursera.org
# by Joe Warren, John Greiner, Stephen Wong, Scott Rixner
import simplegui
import random
import math
@csaez
csaez / memory.py
Last active December 17, 2015 18:39
Interactive Programming in Python - Mini-project #5 - "Memory"
# Mini-project #5 - implementation of card game - "Memory"
#
# 'Introduction to Interactive Programming in Python' Course
# RICE University - coursera.org
# by Joe Warren, John Greiner, Stephen Wong, Scott Rixner
import simplegui
import random
@csaez
csaez / blackjack.py
Created June 1, 2013 11:54
Interactive Programming in Python - Mini-project #6 - "Blackjack"
# Mini-project #6 - Blackjack
#
# 'Introduction to Interactive Programming in Python' Course
# RICE University - coursera.org
# by Joe Warren, John Greiner, Stephen Wong, Scott Rixner
import simplegui
import random
# load background sprite
@csaez
csaez / spaceship.py
Last active February 12, 2020 08:15
Interactive Programming in Python - Mini-project #7 - "Spaceship"
# Mini-project # 7 - Spaceship
#
# 'Introduction to Interactive Programming in Python' Course
# RICE University - coursera.org
# by Joe Warren, John Greiner, Stephen Wong, Scott Rixner
import simplegui
import math
import random