from numpy import dot,array,empty_like
from matplotlib.path import Path
def make_path(x1,y1,x2,y2):
return Path([[x1,y1],[x1,y2],[x2,y2],[x2,y1]])
def perp( a ) :
b = empty_like(a)
b[0] = -a[1]
This file contains 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/env python | |
# shell commands being automated. | |
# w | |
# aws ec2 stop-instances --instance-id INSTANCE_ID | |
# az vm deallocate --name NAME --resource-group RESOURCE_GROUP | |
""" | |
The script is the easy part, installing it into the unfriendly(imo) cron system and |
d3.unconf example gist. Fork it here.
This file contains 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 sys, os | |
from cv import * | |
from cv2 import * | |
import glob | |
def detect_face(image): | |
"""Converts an image to grayscale and prints the ratio of face to image if _one_ face is found""" | |
grayscale = CreateImage((image.width, image.height), 8, 1) | |
CvtColor(image, grayscale, CV_BGR2GRAY) |
This file contains 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
"""making a dataframe""" | |
df = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB')) | |
"""quick way to create an interesting data frame to try things out""" | |
df = pd.DataFrame(np.random.randn(5, 4), columns=['a', 'b', 'c', 'd']) | |
"""convert a dictionary into a DataFrame""" | |
"""make the keys into columns""" | |
df = pd.DataFrame(dic, index=[0]) |
NewerOlder