Skip to content

Instantly share code, notes, and snippets.

@jamesjjcondon
jamesjjcondon / dataset_mongo.py
Created May 23, 2019 04:01 — forked from erogol/dataset_mongo.py
PyTorch MongoDB dataset interface
import io
import os
import numpy as np
from PIL import Image
from pymongo import MongoClient
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
def pil_loader(f):
@jamesjjcondon
jamesjjcondon / download_attachments_from_sender_gmail.py
Created April 17, 2018 10:29 — forked from styrmis/download_attachments_from_sender_gmail.py
Download all attachments from Gmail from a specific sender
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
@jamesjjcondon
jamesjjcondon / gmail.py
Created April 17, 2018 04:16 — forked from jasonrdsouza/gmail.py
Python script to access a gmail account and download particular emails
import email, getpass, imaplib, os
detach_dir = '.' # directory where to save attachments (default: current)
user = raw_input("Enter your GMail username:")
pwd = getpass.getpass("Enter your password: ")
# connecting to the gmail imap server
m = imaplib.IMAP4_SSL("imap.gmail.com")
m.login(user,pwd)
m.select("cs2043") # here you a can choose a mail box like INBOX instead