Skip to content

Instantly share code, notes, and snippets.


Thomas Mansencal KelSolaar

Block or report user

Report or block KelSolaar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
KelSolaar /
Created Jun 10, 2010
Autodesk Maya - Snap On Closest Vertex - Python Script
The code previously provided in this Gist has been moved there:
import re
import itertools
def unpackDefault(datas, length=3, default=None):
datas.extend([default for i in range(length-len(datas))])
return datas
def unpackDefault2(datas, length=3, default=None):
return itertools.islice(itertools.chain(iter(datas), itertools.repeat(default)), length)
from subprocess import Popen, PIPE
p = Popen('ls -l', stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
print stdout, stderr
KelSolaar /
Created Nov 3, 2011
Maya Widget Embedding Into PyQt Widget
import maya.OpenMayaUI
import maya.cmds as cmds
import sip
from PyQt4.QtGui import *
from PyQt4.QtCore import *
mainWindow = QMainWindow()
centralWidget = QListView()
dockWidget = QDockWidget("DockWidget", mainWindow)
import maya.cmds as cmds
import re
import functools
def validateTextFieldUserInput(widget, pattern, fallback, callback, input):
if re.match(pattern, input):
KelSolaar /
Created May 4, 2012
Calculate FStops Difference Between Two Images
import itertools
import math
import re
def unpackDefault(data, length=3, default=None):
This definition unpacks given sequence enforcing a given length.
:param data: Sequence to unpack. ( Tuple / List )
:param length: Default length to unpack to. ( Integer )
KelSolaar /
Created May 28, 2012
Maya Ascendants Walker
import maya.cmds as cmds
def ascendantsWalker(path, visitor=None):
parents = cmds.listRelatives(path, allParents=True, fullPath=True)
if not parents:
for parent in parents:
visitor and visitor(parent)
yield parent
KelSolaar /
Created Jun 3, 2012
Maya - Snap Pivots To Vertex
import maya.cmds as cmds
for transform in, l=True):
point = cmds.xform("{0}.vtx[0]".format(transform), q=True, t=True, ws=True)
for pivotType in ("scalePivot", "rotatePivot"):
cmds.move(point[0], point[1], point[2], "{0}.{1}".format(transform, pivotType))
from hashlib import sha1
def getHashes(data, fill=5):
hash = sha1(data).hexdigest()
return hash, "{0}{1}".format("0"*fill, hash[fill:])
hashes = getHashes("password")
for line in file("combo_not.txt", "r"):
if line.strip() in hashes:
print "Hashe(s) found: '{0}'".format(hashes)
KelSolaar / Makefile.osx
Created Sep 4, 2012
FreeImage OsX Lion Make File
View Makefile.osx
# -*- Makefile -*-
# Mac OSX makefile for FreeImage
# This file can be generated by ./
include Makefile.srcs
# General configuration variables:
CC_X86_64 = gcc
CPP_X86_64 = g++
COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS
You can’t perform that action at this time.