Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Thomas Mansencal KelSolaar

🎯
Focusing
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
KelSolaar / snapOnClosestVertex.py
Created Jun 10, 2010
Autodesk Maya - Snap On Closest Vertex - Python Script
View snapOnClosestVertex.py
The code previously provided in this Gist has been moved there: https://github.com/KelSolaar/Snippets/blob/master/src/maya/libraries/snapOnClosestVertex.py
View unpackDefaults.py
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)
View readOsCommandOutput.py
from subprocess import Popen, PIPE
p = Popen('ls -l', stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
print stdout, stderr
@KelSolaar
KelSolaar / mayaWidgetEmbeddingIntoPyQtWidget.py
Created Nov 3, 2011
Maya Widget Embedding Into PyQt Widget
View mayaWidgetEmbeddingIntoPyQtWidget.py
import maya.OpenMayaUI
import maya.cmds as cmds
import sip
from PyQt4.QtGui import *
from PyQt4.QtCore import *
mainWindow = QMainWindow()
centralWidget = QListView()
mainWindow.setCentralWidget(centralWidget)
dockWidget = QDockWidget("DockWidget", mainWindow)
View mayaTextField.py
import maya.cmds as cmds
import re
import functools
def validateTextFieldUserInput(widget, pattern, fallback, callback, input):
if re.match(pattern, input):
callback(input)
else:
fallback(widget)
@KelSolaar
KelSolaar / getFStops.py
Created May 4, 2012
Calculate FStops Difference Between Two Images
View getFStops.py
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
KelSolaar / ascendantsWalker.py
Created May 28, 2012
Maya Ascendants Walker
View ascendantsWalker.py
import maya.cmds as cmds
def ascendantsWalker(path, visitor=None):
parents = cmds.listRelatives(path, allParents=True, fullPath=True)
if not parents:
return
for parent in parents:
visitor and visitor(parent)
yield parent
@KelSolaar
KelSolaar / snapPivotsToVertex.py
Created Jun 3, 2012
Maya - Snap Pivots To Vertex
View snapPivotsToVertex.py
import maya.cmds as cmds
for transform in cmds.ls(sl=True, 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))
View linkedinPasswordChecker.py
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
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 ./gensrclist.sh
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.