- Labels Detection
- Faces Detection
- Faces Comparison
- Faces Indexing
- Faces Search
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
"""Print most frequent N-grams in given file. | |
Usage: python ngrams.py filename | |
Problem description: Build a tool which receives a corpus of text, | |
analyses it and reports the top 10 most frequent bigrams, trigrams, | |
four-grams (i.e. most frequently occurring two, three and four word | |
consecutive combinations). | |
NOTES |
-
install zbar on windows with include and library files
-
make sure mingw installed and bin directory added to the path
-
in PYTHONPATH\Lib\distutils, create a file distutils.cfg and add two lines:
[build]
compiler=mingw32
-
get
dll
lib
andinclude
file from ftp://sourceware.org/pub/pthreads-win32/dll-latest copy files toPATH_MINGW32/[lib,bin,include]
separately, just need file name likepthreadGC2
and remember to chang the name tolibpthread
-
change or add lines in
setup.py
:
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 string | |
import requests | |
html = 'https://s3.amazonaws.com/.../email.htm' | |
content = requests.get(html) | |
DJANGO_MAILGUN_SERVER_NAME = '' | |
DJANGO_MAILGUN_API_KEY = '' | |
recipient_list = ['[email protected]', '[email protected]'] |
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
requests.post("https://api.mailgun.net/v2/DOMAIN/messages", | |
auth=("api", "key-SECRET"), | |
files={ | |
"attachment[0]": ("FileName1.ext", open(FILE_PATH_1, 'rb')), | |
"attachment[1]": ("FileName2.ext", open(FILE_PATH_2, 'rb')) | |
}, | |
data={"from": "FROM_EMAIL", | |
"to": [TO_EMAIL], | |
"subject": SUBJECT, | |
"html": HTML_CONTENT |
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 | |
import dis | |
import traceback | |
import io | |
def t(frame, event, args): | |
frame.f_trace_opcodes=True | |
stack = traceback.extract_stack(frame) | |
pad = " "*len(stack) + "|" | |
if event == 'opcode': |
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
# Zaz Brown | |
# github.com/zaz/dijkstra | |
"""An efficient algorithm to find shortest paths between nodes in a graph.""" | |
from collections import defaultdict | |
class Digraph(object): | |
def __init__(self, nodes=[]): | |
self.nodes = set() | |
self.neighbours = defaultdict(set) | |
self.dist = {} |
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 logging | |
import pexpect | |
from airflow.hooks.base_hook import BaseHook | |
class SFTP(object): | |
""" | |
Requires openssh_client. Spawns process to execute sftp command. | |
""" |