This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import json, urllib2, sys, argparse | |
OK = 0 | |
WARNING = 1 | |
CRITICAL = 2 | |
UNKNOWN = 3 | |
p = argparse.ArgumentParser() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
def split_img(img_path): | |
""" | |
Splits an image vertically down the middle and returns a tuple | |
containing (left_half, right_half) Pillow Image objects. | |
""" | |
img = Image.open(img_path) | |
width, height = img.size | |
half_width = int(width/2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import os | |
import argparse | |
p = argparse.ArgumentParser() | |
p.add_argument("img_filename") | |
sizes = { | |
"thumbnail": 100, | |
"small": 240, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame, pytmx, argparse | |
def draw_tmx(tmx, window): | |
# For each layer | |
for l in xrange(0, len(tmx.tilelayers)): | |
# For each y tile coordinate | |
for y in xrange(0, tmx.height): | |
# For each x tile coordinate | |
for x in xrange(0, tmx.width): | |
# try not strictly necessary, but a hangover from some old bad code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _format_csv_value(self, value): | |
"""Takes a single CSV value string and formats it in compliance with RFC4180. | |
Multiple values can be joined together by putting them in a list and using ",".join(the_list). | |
http://tools.ietf.org/html/rfc4180#page-3 | |
:param value: A single value destined to be output among multiple in a CSV row | |
:return: The escaped and/or quoted string if necessary, otherwise simply returns <value>. | |
""" | |
for x in [",", '"', "\n", "\r\n"]: |
NewerOlder