Skip to content

Instantly share code, notes, and snippets.

View PandaWhoCodes's full-sized avatar

Thomas Ashish Cherian PandaWhoCodes

View GitHub Profile

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

@PandaWhoCodes
PandaWhoCodes / getAge.py
Created October 27, 2017 16:42
Uses local image for Microsoft Azure face API
def getage():
subscription_key = '2c2c93c599a841e5ac01a2e0635fe3be'
uri_base = 'https://westcentralus.api.cognitive.microsoft.com'
# Request headers.
headers = {
'Content-Type': 'application/octet-stream',
'Ocp-Apim-Subscription-Key': subscription_key,
}
# Request parameters.
params = {
@PandaWhoCodes
PandaWhoCodes / noise.py
Created October 29, 2017 11:29
Noise reduction using pyaudio documentation code
"""
Measure the frequencies coming in through the microphone
Patchwork of wire_full.py from pyaudio tests and spectrum.py from Chaco examples
"""
import pyaudio
import numpy as np
import scipy.signal
CHUNK = 1024 * 2
#Just replace Ashish and manoj.jpg
import cv2
import dlib
import numpy
import sys
PREDICTOR_PATH = "shape_predictor_68_face_landmarks.dat"
SCALE_FACTOR = 1
FEATHER_AMOUNT = 11
@PandaWhoCodes
PandaWhoCodes / spellCorrector.py
Last active May 24, 2021 21:03
using naive bayes auto corrects the spellings.
import re, collections
def get_words(text):
return re.findall('[a-z]+', text.lower())
def langModel(wordseq):
wordCount = collections.defaultdict(lambda: 1)
for word in wordseq:
wordCount[word] += 1
return wordCount
  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 / scrape_links.py
Created December 19, 2017 19:55
Scrapes the page to get the links, filters them and store them as a CSV file
@PandaWhoCodes
PandaWhoCodes / python-mailgun.py
Created January 2, 2018 16:52 — forked from campos-rafael/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
@PandaWhoCodes
PandaWhoCodes / flask_api1.py
Created December 14, 2018 18:48
The following snippet creates an API to recieve 2 numbers and return their sum.
from flask import Flask, request
app = Flask(__name__)
@app.route('/', methods=['GET'])
def add():
num1 = request.args.get('num1')
num2 = request.args.get('num2')
return num1 + num2