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
from mandrill import Mandrill | |
import base64 | |
mail_client = Mandrill('<api_key>') | |
frm_email = '[email protected]' | |
frm_name = 'Given Name' | |
# Sending image as attachment | |
img_attachment = base64.b64encode(open('~/sample_image.jpg', 'rb').read()) |
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
# Script to populate data into MongoDB | |
import twitter | |
import time | |
import logging | |
from pymongo import MongoClient | |
CONSUMER_KEY = '<twitter_consumer_key>' | |
CONSUMER_SECRET = '<twitter_secret_key>' |
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
""" | |
Code to download and upload raw data from mix-panel | |
""" | |
import hashlib | |
import datetime | |
import time | |
import tempfile | |
import os | |
import bz2 |
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 pandas | |
df = pandas.read_csv('offers.csv.gz', compression='gzip') | |
categories = df.category.tolist() | |
subset = open('subset.csv', 'w') | |
fl = open('transactions.csv', 'r') | |
fl.readline() | |
while True: | |
l = fl.readline() | |
if l == '': |
NewerOlder