Skip to content

Instantly share code, notes, and snippets.

@tanayag
tanayag / dlAttachments.py
Created August 17, 2017 19:09 — forked from baali/dlAttachments.py
Python script to download all gmail attachments.
# Something in lines of http://stackoverflow.com/questions/348630/how-can-i-download-all-emails-with-attachments-from-gmail
# Make sure you have IMAP enabled in your gmail settings.
# Right now it won't download same file name twice even if their contents are different.
import email
import getpass, imaplib
import os
import sys
detach_dir = '.'
def quickSort(ar):
pivot = ar[0]
l = len(ar)
new_ar = []
for i in range(1,l):
if ar[i] < pivot:
@tanayag
tanayag / time_converter.py
Created June 2, 2016 13:36
AM/PM to Military Time Converter
time = raw_input('Enter Time(hh:mm:ssAM/PM): ')
AP = time[8]
if AP == 'A' and time[0:2] == '12':
ms = time.strip('AM')
p = '00'
print p + ms[2:]
@tanayag
tanayag / angry_teacher.py
Created June 2, 2016 13:32
Angry Teacher
#I have added some statements so as to make program user friendly, Hope you don't mind. :p
print 'In a Class, Professor will only take class if number of students decided by him are on time'
t = int(raw_input('Enter the Number of test Cases: '))
for t in range(0,t,1):
nk = raw_input('Input total number of students in class(N) and Minimum number of students required to start the class(K){Seperate them by space}: ').split()
@tanayag
tanayag / Utopian Tree.py
Created June 2, 2016 13:30
Utopian Tree (Python 2) (Hackerrank)
t = int(raw_input())
for t in range(0,t):
n = int(raw_input())
height = 1
if n == 0:
print '1'
@tanayag
tanayag / Sherlock and The Beast.py
Created June 2, 2016 13:29
Sherlock and The Beast (Python 2) (Hackerrank)
t = int(raw_input())
for t in range(0,t):
n = int(raw_input())
if n<9: