Skip to content

Instantly share code, notes, and snippets.

View PandaWhoCodes's full-sized avatar

Thomas Ashish Cherian PandaWhoCodes

View GitHub Profile
@PandaWhoCodes
PandaWhoCodes / amazon-rekognition.md
Created March 31, 2017 15:24 — forked from alexcasalboni/amazon-rekognition.md
Amazon Rekognition - Python Code Samples

Amazon Rekognition - Python Code Samples

  1. Labels Detection
  2. Faces Detection
  3. Faces Comparison
  4. Faces Indexing
  5. Faces Search
@PandaWhoCodes
PandaWhoCodes / ngrams.py
Created September 21, 2017 17:35 — forked from benhoyt/ngrams.py
Print most frequent N-grams in given file
"""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

Workshop PyConf Hyderabad

Time Series Analysis with Python

With Applications of Machine Learning Algorithms

Session by Dr. Yves J. Hilpisch | The Python Quants GmbH

Hyderabad, 07. October 2017

  1. install zbar on windows with include and library files

  2. make sure mingw installed and bin directory added to the path

  3. in PYTHONPATH\Lib\distutils, create a file distutils.cfg and add two lines:

    [build]

    compiler=mingw32

  4. get dll lib and include file from ftp://sourceware.org/pub/pthreads-win32/dll-latest copy files to PATH_MINGW32/[lib,bin,include] separately, just need file name like pthreadGC2 and remember to chang the name to libpthread

  5. change or add lines in setup.py:

@PandaWhoCodes
PandaWhoCodes / python-mailgun.py
Created January 2, 2018 16:52 — forked from jehutymax/python-mailgun.py
Send e-mails using Mailgun from a Python script
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]']
@PandaWhoCodes
PandaWhoCodes / send_mailgun_attachments.py
Created January 2, 2018 16:53 — forked from adamlj/send_mailgun_attachments.py
MailGun API Python Requests multiple Attachments Send mail with multiple files/attachments with custom file names
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
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':
@PandaWhoCodes
PandaWhoCodes / dijkstra.py
Created October 26, 2019 14:13 — forked from zaz/dijkstra.py
Dijkstra's algorithm — Python
# 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 = {}
@PandaWhoCodes
PandaWhoCodes / SFTP.py
Created April 12, 2021 10:35 — forked from billcrook/SFTP.py
An SFTP util class I created for use in my airflow pipelines. Not beautiful, but it works.
import logging
import pexpect
from airflow.hooks.base_hook import BaseHook
class SFTP(object):
"""
Requires openssh_client. Spawns process to execute sftp command.
"""