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 / .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
@KelSolaar
KelSolaar / flattenListsOfLists.py
Created September 19, 2012 11:42
Flatten Lists Of Lists
a = [1,2,3]
b = [4,5,6]
print zip(a,b)
import itertools
print list(itertools.chain.from_iterable(zip(a,b)))
print sum(map(list, zip(a,b)), [])
@KelSolaar
KelSolaar / CrittercismRamblings.html
Created October 10, 2012 19:11
Crittercism Ramblings
<!DOCTYPE html>
<html>
<head>
<title>Example Document without Crittercism</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://d1a62freaxhn7x.cloudfront.net/v1/crittercismClientLibraryMin.js"></script>
<script type="text/javascript">
$(document).ready(function() {
Crittercism.init({
appId : '5075c158d5f9b9796b000002', // Example: 47cc67093475061e3d95369d
@KelSolaar
KelSolaar / hueRamblings.py
Created November 19, 2012 08:44
Philips Hue - On
import json
import urllib2
def hueOn(address, client, on=True):
for light in (1, 2, 3):
url = "http://%s/api/%s/lights/%s/state" % (address, client, light)
request = urllib2.Request(url, json.dumps({"on": on}))
request.get_method = lambda: "PUT"
response = urllib2.urlopen(request)
@KelSolaar
KelSolaar / lightsmishNormalisation.py
Last active December 11, 2015 01:39
Nuke - Lightsmith Normalisation
def getWeightedAverage(node):
width, height = node.width(), node.height()
red = green = blue = 0.0
for x in range(width):
for y in range(height):
red += node.sample("red", x, y)
green += node.sample("green", x, y)
blue += node.sample("blue", x, y)
count = width * height
return red / count, green / count, blue / count
@KelSolaar
KelSolaar / editorCapture.py
Created January 21, 2013 02:01
sIBL_GUI - Editor Capture
import os
import re
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import foundations.walkers
import foundations.common
def captureEditorPages(editor, outputDirectory, prefix):
viewport = editor.viewport()
@KelSolaar
KelSolaar / planator.py
Created January 24, 2013 00:18
Craig's Planator
import maya.cmds as cmds
import os
MAPPING = {64 : "/path/to/chair.png",
128 : "/path/to/mop.png",
256 : "/path/to/safe.png",
512 : "/path/to/book.png"}
def getSplitextBasename(path):
basename = os.path.splitext(os.path.basename(os.path.normpath(path)))[0]
@KelSolaar
KelSolaar / texturator.py
Last active August 28, 2017 14:40
Craig's Texturator
import maya.cmds as cmds
import os
def getSplitextBasename(path):
basename = os.path.splitext(os.path.basename(os.path.normpath(path)))[0]
return basename
def getShaderBranch(texture):
lambert = cmds.shadingNode("lambert", asShader=True)
@KelSolaar
KelSolaar / QtCommercialLicence.txt
Created February 7, 2013 23:12
Qt Commercial Licence
Subject:
Non Commercial Project with No Sources Distribution, What kind ofLicenses ?
Hello,
I would like to know what would be the license needeed to build a non commercial project with no source distribution. I want my application to be free but I also want the source code to not be available so that my program is not taken over/modified and distributed by someone else.
Regards,
Thomas
@KelSolaar
KelSolaar / persistence.py
Last active December 16, 2015 03:29
Persistence Ramblings Addon for Softimage
from win32com.client import constants as siConstants
class Runtime(object):
instance = None
class Foo(object):
def __init__(self, bar):
self.bar = bar