Skip to content

Instantly share code, notes, and snippets.

View KelSolaar's full-sized avatar
🔅
Bending Light

Thomas Mansencal KelSolaar

🔅
Bending Light
View GitHub Profile
@KelSolaar
KelSolaar / aces_xyz_matrices.ipynb
Last active September 1, 2015 20:13
ACES - XYZ Matrices
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@KelSolaar
KelSolaar / unpackDefaults.py
Created September 23, 2011 15:00
Unpack Defaults
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)
@KelSolaar
KelSolaar / readOsCommandOutput.py
Created September 27, 2011 11:42
Read Os Command Output
from subprocess import Popen, PIPE
p = Popen('ls -l', stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
print stdout, stderr
@KelSolaar
KelSolaar / mayaTextField.py
Created March 29, 2012 09:26
Maya TextField
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 10:22
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
KelSolaar / ascendantsWalker.py
Created May 28, 2012 10:17
Maya Ascendants Walker
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 June 3, 2012 10:03
Maya - Snap Pivots To Vertex
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))
@KelSolaar
KelSolaar / linkedinPasswordChecker.py
Created June 6, 2012 17:37
Linkedin Password Checker
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 September 4, 2012 20:58
FreeImage OsX Lion Make File
# -*- 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
@KelSolaar
KelSolaar / .travis.yml
Created September 17, 2012 20:13
Travis - Setup file for PyQt and multiple Python interpreters.
language: python
python:
- "2.6"
- "2.7"
before_install:
- cd ..
- curl -O http://www.riverbankcomputing.co.uk/static/Downloads/sip4/sip-4.13.3.tar.gz
- tar -xvf sip-4.13.3.tar.gz
- cd sip-4.13.3
- python configure.py