import smtplib def send_email(subject, message) recipient = 'email@example.com' gmail_sender = 'firstname.lastname@example.org' gmail_password = 'your_gmail_password' #use tls gmail_smtp = smtplib.SMTP('smtp.gmail.com', 587) gmail_smtp.ehlo() gmail_smtp.starttls() gmail_smtp.ehlo() #login gmail_smtp.login(gmail_send, gmail_password) #message formatting mail_header = 'To: ' + recipient + '\n' + 'From: ' + gmail_sender + '\n' + 'Subject: ' + subject + '\n' message_body = message mail message = mail_header + '\n ' + message_body + '\n\n' #send gmail_smtp.sendmail(gmail_sender, recipient, mail_message) #close gmail_smtp.close()
While I am not really in a position to do many of the mini projects given in the book (wrong type of house plus we rent), reading some of the project ideas did give me some inspiration for other activities. One of those is a Buffer-like tool I’m now writing to queue tweets over-and-above what the free level of Buffer will allow (and on a different schedule from my Buffer-fed queue). In conjunction with python-twitter, cron, and simple email messages, I’ve got a system started to which I can email things I would like to be posted, and they will go out when the cron job runs.
The Arduino is an impressive embedded platform – one that has also rekindled another long-time interest I’ve had in robotics. Years back, I recall seeing Sally Struthers advertising for one of those learn-at-home groups, and one of the options was robotics. (By “years back”, I mean 20+ years ago – probably more like 25 years ago, at this point.) I used to own a copy of Robot Builder’s Bonanza – and read it cover-to-cover a couple times. I loved watching Battlebots on TV. I’ve always wanted to buy/use LEGO Mindstorms.
Using robots to automate daily activities (and, of course, for fun) has been a fascination since I first saw Lost In Space and myriad other scifi shows and movies.
Riley does a great job of not demanding you be an expert programmer (or even a programmer at all) with the fully-implemented code examples in the book. He also does a good job of indicating what you’ll likely have to tweak on your own – and what you can probably just leave alone in the examples. Add to this the “extra credit challenges”, and I highly recommend it to anyone interested in home automation, embedded development, robotics, or just general programming/scripting.
There are some other interesting Python snippets throughout the book – that don’t have to be used in the context of an Arduino (like using Google’s SMTP server (via authentication)).
[W]hen you choose a language, you’re also choosing a community. The programmers you’ll be able to hire to work on a Java project won’t be as smart as the ones you could get to work on a project written in Python. And the quality of your hackers probably matters more than the language you choose. Though, frankly, the fact that good hackers prefer Python to Java should tell you something about the relative merits of those languages.
He had a follow-up the next month to expand a little on that thought:
[Y]ou could get smarter programmers to work on a Python project than you could to work on a Java project.
I didn’t mean by this that Java programmers are dumb. I meant that Python programmers are smart. It’s a lot of work to learn a new programming language. And people don’t learn Python because it will get them a job; they learn it because they genuinely like to program and aren’t satisfied with the languages they already know.
Which makes them exactly the kind of programmers companies should want to hire.
I wonder – what is the “new” Python? If Python was what the Cool Kids™ were picking up for fun a decade ago, what is it today? R? Ruby? Or something that isn’t as well known? Ruby is two years newer than Python, but seems to have only become truly popular with the advent of Ruby-on-Rails. R may be too focused (it being designed for statistics programming), though it is also 20 years old now.
If you were a hiring manager, what would strike you as “motivated” or “must be smart” in terms of language(s) on resume?