<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[//]]></title><description><![CDATA[//]]></description><link>http://mx.cm/</link><generator>Ghost 0.7</generator><lastBuildDate>Tue, 26 Jun 2018 09:02:25 GMT</lastBuildDate><atom:link href="http://mx.cm/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[On the sad reality of technical interviews]]></title><description><![CDATA[<blockquote class="twitter-tweet" lang="en"><p lang="en" dir="ltr">“We love your open source work, the code is excellent, but would you mind showing us a quick fibonacci sequence on the whiteboard?”&#10;&#10;ಠ_ಠ</p>&mdash; I Am Devloper (@iamdevloper) <a href="https://twitter.com/iamdevloper/status/667293986969677824">November 19, 2015</a></blockquote>  

<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>]]></description><link>http://mx.cm/on-the-sad-reality-of-technical-interviews/</link><guid isPermaLink="false">4ab7f71a-8230-4fb1-9110-dc7b30f58cb4</guid><dc:creator><![CDATA[Max Presman]]></dc:creator><pubDate>Thu, 26 Nov 2015 21:52:38 GMT</pubDate><content:encoded><![CDATA[<blockquote class="twitter-tweet" lang="en"><p lang="en" dir="ltr">“We love your open source work, the code is excellent, but would you mind showing us a quick fibonacci sequence on the whiteboard?”&#10;&#10;ಠ_ಠ</p>&mdash; I Am Devloper (@iamdevloper) <a href="https://twitter.com/iamdevloper/status/667293986969677824">November 19, 2015</a></blockquote>  

<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>]]></content:encoded></item><item><title><![CDATA[On homejoy; medium / backchannel]]></title><description><![CDATA[<p><a href="https://medium.com/backchannel/why-homejoy-failed-bb0ab39d901a">https://medium.com/backchannel/why-homejoy-failed-bb0ab39d901a</a></p>]]></description><link>http://mx.cm/on-homejoy-medium-backchannel/</link><guid isPermaLink="false">c59e0712-ee4a-4b8d-ae75-f28b229adc84</guid><dc:creator><![CDATA[Max Presman]]></dc:creator><pubDate>Mon, 26 Oct 2015 16:01:58 GMT</pubDate><content:encoded><![CDATA[<p><a href="https://medium.com/backchannel/why-homejoy-failed-bb0ab39d901a">https://medium.com/backchannel/why-homejoy-failed-bb0ab39d901a</a></p>]]></content:encoded></item><item><title><![CDATA[Cloudflare on real-time metrics && architecture]]></title><description><![CDATA[<iframe width="560" height="315" src="https://www.youtube.com/embed/LA-gNoxSLCE" frameborder="0" allowfullscreen></iframe>]]></description><link>http://mx.cm/cloudflare-on-logging-architecture/</link><guid isPermaLink="false">f4fecca4-5a84-471e-8730-f94e0862767c</guid><dc:creator><![CDATA[Max Presman]]></dc:creator><pubDate>Sun, 25 Oct 2015 22:19:24 GMT</pubDate><content:encoded><![CDATA[<iframe width="560" height="315" src="https://www.youtube.com/embed/LA-gNoxSLCE" frameborder="0" allowfullscreen></iframe>]]></content:encoded></item><item><title><![CDATA[Jeremy Edberg on building infrastructure.]]></title><description><![CDATA[<iframe width="560" height="315" src="https://www.youtube.com/embed/x-zwxuIb1lY" frameborder="0" allowfullscreen></iframe>]]></description><link>http://mx.cm/jeremy-edberg-on-building-clouds/</link><guid isPermaLink="false">5688fc05-83f3-4ccf-b1a2-e5ab428bef45</guid><dc:creator><![CDATA[Max Presman]]></dc:creator><pubDate>Sun, 25 Oct 2015 17:51:09 GMT</pubDate><content:encoded><![CDATA[<iframe width="560" height="315" src="https://www.youtube.com/embed/x-zwxuIb1lY" frameborder="0" allowfullscreen></iframe>]]></content:encoded></item><item><title><![CDATA[strava with moto 360]]></title><description><![CDATA[<iframe height="405" width="590" frameborder="0" allowtransparency="true" scrolling="no" src="http://www.strava.com/activities/206750639/embed/7762b61309349eb8e6d4acb3fbf42abc8100e7af"></iframe>]]></description><link>http://mx.cm/a-shiny-new-moto-360-3/</link><guid isPermaLink="false">eda2a66c-40e3-4345-8cf9-0262c0246e2a</guid><dc:creator><![CDATA[Max Presman]]></dc:creator><pubDate>Mon, 13 Oct 2014 03:52:34 GMT</pubDate><content:encoded><![CDATA[<iframe height="405" width="590" frameborder="0" allowtransparency="true" scrolling="no" src="http://www.strava.com/activities/206750639/embed/7762b61309349eb8e6d4acb3fbf42abc8100e7af"></iframe>]]></content:encoded></item><item><title><![CDATA[Running DD-WRT on Netgear Nighthawk R7000]]></title><description><![CDATA[<p><img src="http://mx.cm/content/images/2014/Mar/2014_03_15_2043.png" alt="hello DD-WRT"></p>

<p>&lt;3</p>]]></description><link>http://mx.cm/running-dd-wrt-on-netgear-nighthawk-r7000/</link><guid isPermaLink="false">62e60aaf-206c-45bf-a05d-cf0de802c9fd</guid><dc:creator><![CDATA[Max Presman]]></dc:creator><pubDate>Sun, 16 Mar 2014 03:44:35 GMT</pubDate><content:encoded><![CDATA[<p><img src="http://mx.cm/content/images/2014/Mar/2014_03_15_2043.png" alt="hello DD-WRT"></p>

<p>&lt;3</p>]]></content:encoded></item><item><title><![CDATA[Vagrant / Virtualbox 4.3.* / Ubuntu 13.10]]></title><description><![CDATA[<p>Noticed that Vagrant 1.4.3 no longer syncs folders after upgrading to VirtualBox 4.3 with Ubuntu 13.04/13.10</p>

<h4 id="thecause">the cause</h4>

<p>seems like most of the images that are used by vagrant use an oudated version of the Guest Additions (at 4.2) which do not work</p>]]></description><link>http://mx.cm/vagrant-virtualbox-4-3/</link><guid isPermaLink="false">52adf46c-00dd-438a-91c7-cceed851dc64</guid><category><![CDATA[vagrant]]></category><category><![CDATA[virtualbox]]></category><category><![CDATA[ubuntu13.10]]></category><dc:creator><![CDATA[Max Presman]]></dc:creator><pubDate>Mon, 03 Mar 2014 07:27:00 GMT</pubDate><content:encoded><![CDATA[<p>Noticed that Vagrant 1.4.3 no longer syncs folders after upgrading to VirtualBox 4.3 with Ubuntu 13.04/13.10</p>

<h4 id="thecause">the cause</h4>

<p>seems like most of the images that are used by vagrant use an oudated version of the Guest Additions (at 4.2) which do not work with 4.3</p>

<h4 id="fixingupguestadditions">fixing up guest additions</h4>

<p>we start by installing the guest additions plugin</p>

<pre><code class="language-bash">vagrant plugin install vagrant-vbguest  
</code></pre>

<p>append xorg server to the bootstrap.sh (guest additions won't work without it)</p>

<pre><code class="language-bash">  apt-get update
  apt-get upgrade --yes
  ...

  apt-get install xorg

  ...

  apt-get autoremove
  apt-get clean
</code></pre>

<p>finally, re-run the provisioning</p>

<pre><code class="language-bash">vagrant up --provision  
</code></pre>

<p>I published my vagrant setup on <a href="https://github.com/MaxPresman/vagrant-config">https://github.com/MaxPresman/vagrant-config</a></p>]]></content:encoded></item><item><title><![CDATA[Making a 10-minute email with Python]]></title><description><![CDATA[<p>I was interested in writing a super simple 10 minute email server for a while, but finally found the time. I posted the sample code on <a href="https://github.com/MaxPresman/tempymail">github</a> and will try to present a breakdown of the coding components in this blog post.The app will consist of two portions, the</p>]]></description><link>http://mx.cm/making-a-10-minute-email-with-python/</link><guid isPermaLink="false">f1438065-a11e-40d5-ae43-36e95cc81714</guid><dc:creator><![CDATA[Max Presman]]></dc:creator><pubDate>Mon, 03 Mar 2014 06:14:17 GMT</pubDate><content:encoded><![CDATA[<p>I was interested in writing a super simple 10 minute email server for a while, but finally found the time. I posted the sample code on <a href="https://github.com/MaxPresman/tempymail">github</a> and will try to present a breakdown of the coding components in this blog post.The app will consist of two portions, the mail server to catch the incoming emails and the Flask web app to present the emails to users.</p>

<h2 id="requirements">Requirements</h2>

<p>Python contains the mail handling functions in the standard library, as a result, we just need to install the DB abstraction and ORM  </p>

<pre><code>Flask        ## web framework  
MySQL-python ## connecting and storing emails  
sqlalchemy   ## used for ORM -- can replace   with django or peeweee  
</code></pre>

<h2 id="models">Models</h2>

<p>I present the models in SQLalchemy formet, but those can easily be translated to django or peewee</p>

<pre><code class="language-python">email_account = Table('email_account', metadata,  
    Column('id', Integer, primary_key=True),
    Column('inbox_name', String(60), nullable=False),   
    Column('access_key', String(60), nullable=False),   
    )

emails_recieved = Table('emails_recieved', metadata,  
  Column('id', Integer, primary_key=True),
  Column('owner_id', Integer,                         
      ForeignKey("email_account.user_id"), nullable=False),
  Column('email_desc_html', Text, nullable=False),
  Column('email_from',String(100),nullable=False),
  Column('email_desc_plain', Text,nullable=False),
  Column('email_title', String(500),nullable=False),
)
</code></pre>

<h2 id="mailserverhttpsgithubcommaxpresmantempymailblobmastermail_fetchpy"><a href="https://github.com/MaxPresman/tempymail/blob/master/mail_fetch.py">Mail server</a></h2>

<p>Since this is a small test mail server, we can direct the MX records to the IP of the server. a Namecheap example will look like this (change the mailserver host IP to the right IP address)</p>

<p><img src="http://mx.cm/content/images/2014/Mar/2013_04_09_2353.png" alt="Alt text"></p>

<p>MX records take a bit of time to change. The following python snippet will bind itself to port 25 and handle any incoming mail.</p>

<pre><code class="language-python">from smtpd import SMTPServer  
import asyncore  
import email

class TempySMTPserver(SMTPServer):  
  ## gets called on every new email
  def process_message(self, peer, mailfrom, rcpttos, data):
      #print "peer "    + str(peer      )
      #print "mailfrom" + str(mailfrom  )
      #print "rcpttos:" + str(rcpttos   )
      #print "data"  + str(data)

      ##returns a parsed email object
      parsed_email = email.message_from_string(data)

## bind the server to mail port 25
smtp_obj = TempySMTPserver(('0.0.0.0', 25), None)     

try:                        asyncore.loop()  
except KeyboardInterrupt:   pass  
</code></pre>

<p>Finally, each email can contain multiple bundled types such as HTML and plain text. while processing, it is easier to keep track of each type separately. </p>

<p>To avoid a specific ORM configuration, I left out the database insert statements, but a working SQLA example is located on github</p>

<pre><code class="language-python">for email_recpt in rcpttos:  
  email_username = email_recpt.split("@")[0]

  ##find an existing email_account for this username
  #existing_account = TO-DO

  ## this function is a bit weird, returning a string if only one payload
  pay_loads =  parsed_email.get_payload()

  ## if we are dealing with only 1 payload, convert to array to simply the loop
  if type(pay_loads) != list:
      pay_loads = [pay_loads]

  email_subject    = parsed_email["Subject"]
  html_content = ""
  text_content = ""
  mail_from        = mailfrom

  for recieved_email_type in pay_loads:
      if type(recieved_email_type) == str and parsed_email.get_content_type() == "text/plain":
          text_content = recieved_email_type
      elif type(recieved_email_type) == str and parsed_email.get_content_type() == "text/html":
          html_content = recieved_email_type
      elif recieved_email_type.get_content_type() == "text/plain":
          text_content = recieved_email_type.get_payload()
      elif recieved_email_type.get_content_type() == "text/html":
          html_content = recieved_email_type.get_payload()

  ## TO-DO
  ## insert email_subject,existing_account,html_content,text_content,mail_from into DB
  ## TO-DO
</code></pre>

<p>The <a href="https://github.com/MaxPresman/tempymail/blob/master/flask_frontend.py">Flask application</a> is quite standard and consist of only two routes.</p>]]></content:encoded></item></channel></rss>