Skip to content

Instantly share code, notes, and snippets.

View ColtonPhillips's full-sized avatar

Colton Phillips ColtonPhillips

View GitHub Profile
@ColtonPhillips
ColtonPhillips / readme.txt
Created October 7, 2018 04:21
PETS [Personal Entertainment Television System] (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@ColtonPhillips
ColtonPhillips / readme.txt
Created October 7, 2018 04:21
PETS [Personal Entertainment Television System] (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@ColtonPhillips
ColtonPhillips / good.py
Created June 21, 2018 06:12
a good file
# Example
from urllib2 import urlopen
import random
cat = (random.randint(100,500), random.randint(100,500))
site = urlopen('http://placekitten.com/{}/{}'.format(*cat))
data = site.read()
cat_file = open('demoncat.jpg','w')
@ColtonPhillips
ColtonPhillips / mac-quick-screenshare
Created October 6, 2017 03:44 — forked from shedali/mac-quick-screenshare
applescript to start screen recording using quicktime
tell application "QuickTime Player" to activate
tell application "System Events"
activate
--set UI elements enabled to true
tell process "QuickTime Player"
click menu item "New Screen Recording" of menu "File" of menu bar 1
end tell
end tell
tell application "QuickTime Player"
@ColtonPhillips
ColtonPhillips / pzr.py
Created June 4, 2016 07:34
Turn PNG files into PUZZLESCRIPT format quickly
def addUnique(l,item):
if item not in l:
l.append(item)
return l
from PIL import Image
import sys
im = Image.open(sys.argv[1])
pix = im.load()
@ColtonPhillips
ColtonPhillips / prepuzzler.py
Created June 4, 2016 07:31
Precompiler for the Pets Game (seek metadata and output objects as image strip)
colors = ["black","white","grey","darkgrey", "lightgrey","gray","darkgray","lightgray","red","darkred","lightred","brown","darkbrown","lightbrown","orange","yellow","green","darkgreen","lightgreen","blue","lightblue","darkblue","purple","pink","transparent"]
numerics = ["1","2","3","4","5","6","7","8","9","0"]
def get_me_my_game_string_now():
import urllib2
game_url = "https://gist.githubusercontent.com/ColtonPhillips/3d66191462a417f45419/raw/6512cd41f0bae75333f7a3b2befd22e4b8fae7ad/Let's%2520Save%2520Everybody's%2520Pets.txt"
response = urllib2.urlopen(game_url)
html = response.read()
return html
@ColtonPhillips
ColtonPhillips / pzr.py
Created November 19, 2015 23:55
This converts a png into puzzlescript object format. It works for sizes that aren't typical for the editor
def addUnique(l,item):
if item not in l:
l.append(item)
return l
from PIL import Image
import sys
im = Image.open(sys.argv[1])
pix = im.load()
@ColtonPhillips
ColtonPhillips / ycbcr2rgb.py
Created July 2, 2015 12:35
Converts ycbcr to rgb
#http://www.equasys.de/colorconversion.html
import sys
y = sys.argv[1]
cb = sys.argv[2]
cr = sys.argv[3]
y = int(y)
cb = int(cb)
cr = int(cr)
r = y + 1.4 * (cr - 128)
@ColtonPhillips
ColtonPhillips / rgb2ycbcr.py
Created June 29, 2015 05:44
Converts rgb to ycbcr (YUV - Luminance + Chromanance)
#http://www.picturetopeople.org/p2p/picture_to_people_colors.p2p/color_converter?color_space=RGB&color_channel1=0&color_channel2=0&color_channel3=0
#https://msdn.microsoft.com/en-us/library/ff635643.aspx
#rgb range - [0,255]
#y range - [0,255]
#cb,cr range - [-128,127]
import sys
import time
#r = int(sys.argv[1])
@ColtonPhillips
ColtonPhillips / quick_rename.py
Created October 21, 2014 09:49
I just wanted a script to rename my JPEG files that my camera created, so it would look better when I upload to flickr.
#!/usr/bin/env python
from os import rename, listdir
badprefix = "IMG"
fnames = listdir('.')
print(fnames)
for fname in fnames:
if fname.startswith(badprefix):
rename(fname, fname.replace(badprefix, 'long_exposure', 1))