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
# command to install this library. | |
# conda install pandas-datareader | |
# example 1 | |
import pandas_datareader as pdr | |
tsla = pdr.DataReader('tsla', data_source='google', start='2017-1-1') | |
# example 2 | |
# calculates the trailing stop order price, can be used for weight loss like time series as well. |
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 json | |
import subprocess | |
"""EDIT FNAME TO UPDATE WITH YOUR LOCAL FILE PATH""" | |
FNAME = "/PATH/To/SUBLIME/SFTP/FILE/sftp-config.json" | |
def update_json_file(given_ip, filename): | |
jsonfile = open(filename, "r") # open the json file for reading | |
data = json.load(jsonfile) # read the json into the buffer |
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) |
d3.unconf example gist. Fork it here.
NewerOlder