Embedding mailchimp's sign-up form


Want to receive updates from me? Subscribe below!

In [19]:
html_string = '<link href="//cdn-images.mailchimp.com/embedcode/slim-10_7.css" rel="stylesheet" type="text/css">\
<style type="text/css">\
	#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }\
</style>\
<div id="mc_embed_signup">\
<form action="//github.us14.list-manage.com/subscribe/post?u=324739f7480162ee8cad453b8&amp;id=6f694b24ee" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>\
    <div id="mc_embed_signup_scroll">\
	<label for="mce-EMAIL">Subscribe to our mailing list</label>\
	<input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>\
    <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->\
    <div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_324739f7480162ee8cad453b8_6f694b24ee" tabindex="-1" value=""></div>\
    <div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>\
    </div>\
</form>\
</div>\
<!--End mc_embed_signup-->'
In [20]:
from IPython.core.display import display, HTML
display(HTML(html_string))

Configuring Android Galaxy S6 on telcomsel's Mobile Data Network


One of the modern pleasures of traveling in South East Asia is ubiquitous 3 or 4G mobile data access. My experiences in Thailand and Malaysia have been phenomenal in this regard, as I can take care or hotel booking, directions, or language translation on the fly with little to no planning required. In Bali though, I ran into some difficulty. After negotiating the price for a new sim card and 6GB data plan down to a reasonable 125,000 IDR with a local vendor, I popped it in only to find that while calling and SMS functioned, I had no internet access to speak of! Unfortunately, this particular vendor wasn't the most honest of businessmen, and had little sympathy for my technical difficulties. Fortunately, after about an hour of research and fiddling, I found that the automatic APN configuration failed, and I simply had to perform it manually.

The correct APN settings were found here: http://www.telkomsel.com/services/basic-services/3062-GPRS, note that unless you can read Bahasa, google translate will come in useful on the linked page! In summary though, I simply had to create a new APN with 'name' = 'internet' and 'apn' = 'internet'. After that, I was in business! It seemed that my device did automatically register with the tecomsel server, though if yours does not you may need to text 'internet' to the number '5432' on indicated on the linked page.

What is flowt?


A quick introduction to the "flowt" HRV biofeedback app for Android.

In [28]:
# Here is our banner - and the python code used to display it.
from IPython.display import Image, display
banner = Image(filename='../files/images/feature_banner.png')
banner.width = 400
display(banner)

Summary

  • What: android app that measures pulse, heart rate, etc.
  • Why: monitor and control physiological stress
  • How: using your smartphone camera and a technique called photoplethysmography (PPG)

The full scoop

I recently published the Alpha version of a heart rate variability diasgnostic and biofeedback application for Android called "flowt". This app makes use of a technique called photoplyethysmography (PPG) in order to measure your pulse, along with various derived statistics, using only your smartphone camera. Details on how PPG are works will come in a later post, for now I'll skip them and get straight to why flowt is valuable.

The infamous "fight or flight" reaction is familiar to anybody with a pulse. Common symptoms include cold, sweaty hands, increased heart rate, and anxious, racing thoughts. In addition to being uncomfortable, stress has a detrimental impact on many areas of life including cognitive performance, social performance, and cardiac health. In order to help you manage stress, flowt uses a biomarker called Heart Rate Variability. Heart Rate Variability (HRV) is a statistic calculated from your pulse which serves as a quantitative measurement of stress. Specialized equipent exists for taking HRV measurements, but I wanted to build something that didn'y require purchasing any hardware, so flowt uses only your smart phone camera to measure color changes in your finger which are induced by your heart beat. The measurements from your pulse are combined with your own subjective reports in order to track and control stress in the moment, and over time. The ability to actively control your HRV is acquired through a technique called "HRV Biofeedback Training", which I'll call "flowting". The ideal behind flowting is simple: we measure your HRV in real-time as you attempt to improve it through timed breathing exercises, such that you get instant feedback on what's working, and how your body is responding. This type of protocol has been shown to improve resting HRV levels, along with other measures of stress including anxiety, c-reactive protein, blood pressure, and more.

Wait, but what exactly is "Heart Rate Variability"?

Heart rate variabiliy (HRV) is a measure of the variation in beat to beat intervals. In other words, your heart rate is not constant, it is always changing, and HRV measures exactly how much it is changes over time. High HRV describes a state when your heart rate changes a lot in a given period of time, this is a actually a good thing! It may seem counter-intuitive, but a highly variable heart rate is characteristic of the "Rest and Digest" mode of your nervous system, while low HRV is characteristic of the "Fight or Flight" mode. This relationships can be understood in the following way: when you are healthy and stress free, your heart responds flexibly to changes in breathing and other stimuli, whereas when you are stressed, you loose that flexibility and your heart rate becomes more rigid. So by all means, take a deep breath, relax, and flowt on.

Note: I consider this application a "rough draft", please direct any and all opinions and ideas to flowt.biohacker@gmail.com so that I may use them to improve the app!

References and citations coming soon, for now here is link to my notes: notes

Setting up nikola with deployment to github pages


Installing nikola and its dependencies

In the post that follows I document my experience getting nikola setup.

For starters, nikola was my top choice for a static site generator as it:

  • Is open-source python
  • Accepts ipython (Jupyter) notebook as an input format
  • Automatically deploys to github pages, i.e. free hosting!

The instructions on nikola's Getting Started page went smoothly, with one hiccup:

Error: Cannot remove entries from nonexistent file d:\anaconda32\envs\tst\lib\site-packages\easy-install.pth

I'm using ContinuumIO's Anaconda as my package manager, and a bug which is documented here causes any package relying on setuptools to fail, as Anaconda doesn't use easy install. The workaround was simply enough:

pip install --upgrade --ignore-installed "Nikola[extras]"

And with that setuptools is installed and the bug is fixed for the lifetime of that particular conda environment.

Configuring nikola for input from IPython Notebook

You want to be able to run:

nikola new_post -f pynb

in order to create your ipython notebook based blog post. If you try and do that off that bat, you'll get an error saying that the ipynb format hasn't been added to POSTS and PAGES tuples in your conf.py file. Initially I was following this post, but it seems that default nikola installation has changed slightly. In particular I only had to the following tuples to the POSTS and PAGES lists, respectively:

("posts/*.ipynb", "posts", "post.tmpl", True),

("stories/*.ipynb", "stories", "story.tmpl", False),

You can leave the default theme as bootstrap3, as this supports the ipython notebook format. With that, I was able to create my ipython NB blog posts and view them locally with nikola serve --browser

Deploying to github pages

I went with the simplest possible setup, which github really does make breathtakingly simple!

  1. Create a repo called your-username.github.io and bam, you've got free static site hosting. From there simply upload your site contents (as generated by nikola in this case) to the master branch and visit enter your-username.github.io for a pleasant reception.
  2. Follow these instruction from within your nikola site's directory to init and push the empty master branch.
  3. Run nikola github_deploy - and that's it!
In [ ]: