How to check mail from Amazon WorkMail in Python

Finally, Amazon added IMAP support to WorkMail, so now it’s pretty easy to get mail from it. Next is pretty simple piece of code how to get mail in Python3 from Amazon WorkMail: Python import sys import imaplib import email import email.header import datetime // find imap host for your region here: http://docs.aws.amazon.com/general/latest/gr/rande.html#wm_region M = imaplib.IMAP4_SSL('imap.mail.eu-west-1.awsapps.com') M.login('email@example.com', 'password') M.select("inbox") rv, data = M.search(None, "ALL") if rv != 'OK': print("No messages found!") else: for num in data[0].split(): rv, data = M.fetch(num, '(RFC822)') if rv != 'OK': print("ERROR getting message", num) continue msg = email.message_from_bytes(data[0][1]) hdr = email.header.make_header(email.header.decode_header(msg['Subject'])) subject = str(hdr) print('Message %s: %s' % (num, subject)) print('Date:', msg['Date']) 1234567891011121314151617181920212223242526272829 import sysimport imaplibimport emailimport email.headerimport datetime // find imap host for your region here: http://docs.aws.amazon.com/general/latest/gr/rande.html#wm_regionM = imaplib.IMAP4_SSL('imap.mail.eu-west-1.awsapps.com')M.login('email@example.com', 'password') M.select("inbox") rv, data = M.search(None, "ALL") if rv != 'OK':print("No messages found!")else:for num in data[0].split():rv, data = M.fetch(num, '(RFC822)')if rv != 'OK':print("ERROR getting message", num)continue msg = email.message_from_bytes(data[0][1])hdr = email.header.make_header(email.header.decode_header(msg['Subject']))subject = str(hdr) print('Message %s: %s' % (num, subject))print('Date:', msg['Date']) Here is pretty good imaplib...

Quick deploy of Cloudera QuickStart VM on Amazon AWS

I’m getting Coursera Big Data Specialization now. It should be pretty cool specialization, I’ll share my impressions later. From the first course, they ask to use Hadoop Cloudera distribution to do some homeworks. Problem is that virtual machine provided by Cloudera require 4GB of RAM available, but my laptop have only 4GB. So I spend some time and imported image provided by Cloudera into Amazon’s AWS image (AMI) and launched on EC2 instance. I shared my AMI to public, so you can easily find it under N.Virginia region in “Community AMIs” by name import-ami-fh49yw9s. The cheapest instance you can use for that image with 4GB of ram will cost you only 0.05$ an hour, only for running time. To configure this instance right you also should open some ports in inbound rules of your security group for this instance. I suggest opening ports: 80 (http), 22 (ssh), and 8888 (Hue). After launching your instance you should be able to login to Hue with following url: Your_Public_DNS:8888. Basic login and pass both are “cloudera“. You can use the same login/pass to connect to this server using SSH. Have a good time learning Hadoop and Big...

Great video to start with Shiny apps

In this intro to making interactive apps with R, RStudio programming maven Joe Cheng introduces you (and the Los Angeles R Users Group) a revealing overview of how quick and easy it is to make and publish Shiny...

Hello world!

Hello, this my first post. I want to write a few strings about “Hello world” programs. Right now I’m passioned about R programming language. Code for Hello world program in R looks pretty trivial, for example: R cat('Hello, world!\n') 1 cat('Hello, world!\n') In Java language programs are a little more difficult, but still boring: Java public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, world!"); } } 12345 public class HelloWorld {    public static void main(String[] args) {        System.out.println("Hello, world!");    }} Let’s go to esoteric programming languages (esolang). An esolang is a programming language designed for fun or just to test the boundaries of computer programming languages. Classic esolang is Brainfuck, Hello World program looks pretty interesting: +++++ +++++ initialize counter (cell #0) to 10 [ use loop to set the next four cells to 70/100/30/10/40 > +++++ ++ add 7 to cell #1 > +++++ +++++ add 10 to cell #2 > +++ add 3 to cell #3 > + add 1 to cell #4 > ++++ add 4 to cell #5 <<<<< - decrement counter (cell #0) ] > ++ . print 'H' > + . print 'e' +++++ ++ . print 'l' . print 'l' +++ . print 'o' >>> ++++ . print ',' << ++ . print ' ' < +++++ +++ . print 'w' ----- --- . print 'o' +++ . print 'r' ----- - . print 'l' ----- --- . print 'd' > + . print '!' > . print '\n' 123456789101112131415161718192021222324 +++++ +++++ initialize counter (cell #0) to 10[ use loop to set the next four cells to 70/100/30/10/40> +++++ ++ add 7 to cell #1>...