Skip to content

Instantly share code, notes, and snippets.

View CanOfColliders's full-sized avatar

CanOfColliders

View GitHub Profile
@CanOfColliders
CanOfColliders / split-skymap-into-images.py
Created July 15, 2013 10:08
Simple script to split a cubemap/skymap image produced by blender into 6 separated image files for use in Unity3Ds skybox materials.
#!/usr/bin/env python
# Will split a png cubemap/skymap image produced by blender into 6 separated image files for use in a skybox within unity
# Requires Python Imaging Library > http://www.pythonware.com/products/pil/
# The author takes no responsibility for any damage this script might cause,
# feel free to use, change and or share this script.
# 2013-07, CanOfColliders, m@canofcolliders.com
from PIL import Image
@CanOfColliders
CanOfColliders / castToType.py
Last active December 17, 2015 21:38
Python: Trys to cast a string into int or float if possible, won't throw an error if not, just returns the string untouched.
# trys to cast strings into float or int if possible, or returns it.
def castToType(n):
n = n.replace(",", ".")
try:
num = float(n)
if "." not in n:
return int(num)
return num
except ValueError:
return n