<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>doshitan.com: All posts</title>
    <link href="https://doshitan.com/atom.xml" rel="self" />
    <link href="https://doshitan.com" />
    <id>https://doshitan.com/atom.xml</id>
    <author>
        <name>Tanner Doshier</name>
        
        <email>hi@doshitan.com</email>
        
    </author>
    <updated>2018-12-30T00:00:00Z</updated>
    <entry>
    <title>Site Updates</title>
    <link href="https://doshitan.com/site-updates/" />
    <id>https://doshitan.com/site-updates/</id>
    <published>2018-12-30T00:00:00Z</published>
    <updated>2018-12-30T00:00:00Z</updated>
    <summary type="html"><![CDATA[<p>I’ve slapped a new coat of paint on the place and made some minor under the hood
changes. More detail below.</p>
<h1 id="move-to-aws">Move to AWS</h1>
<p>In late 2016 I moved the site from being served from a little VPS+ngnix to
S3+CloudFront. The site was basically all that was running on the VPS and why
pay $5/month to serve up static files when it could cost pennies. The site now
averages about $0.70/month to serve (on a CDN), $0.5/month of which is just
hosting the DNS for <code>doshitan.com</code> on Route53. Cheaper and better performance.
Win-win.</p>
<p>I went into AWS initially planning on just setting things up by hand, but at the
time there was a neat “Host a static website” quickstart thing that sets up the
basics for a static site really easily and even provides a nice status page. I
started with that.</p>
<p>It wasn’t perfect, had to make some tweaks and add some stuff (like www → root
redirecting), but it was cool. I can’t find the slick status page anymore, or a
link to the quickstart, so maybe they dropped it.</p>
<p>But managing things through a GUI long term is not something I wanna do, so
eventually encoded the setup in some terraform (see
<a href="https://gitlab.com/doshitan/doshitan.com/tree/16ef32fb/infra"><code>/infra/</code></a>).
Importing the existing resources into terraform was pretty easy, props to them
for supporting that. At least most of them. The TLS cert for the domain, managed
by ACM, was harder to deal with. In general these can be a bit of a pain for
config tools because of the verification step, but I could not get terraform to
import my existing verified certificate. Not a big deal though, currently using
a data source to pick out the right cert, so at least I don’t have to specify
the ARN by hand.</p>
<p>Pretty happy with things. I wish I could use a CloudFront Origin Access Identity
to restrict access to the S3 bucket so that all requests are forced to flow
through CloudFront, but it breaks the S3 website hosting stuff. So if someone
manages to guess the S3 website URL, they could side step the CloudFront stuff,
which is a) more expensive to me and b) misses out on some security settings.</p>
<p>May setup a shared secret in a header between CloudFront and S3 such that S3
would reject requests without the right value to at least block serving up
actual content to good guessers. Might eventually write my own little server to
perform the S3 website duties and misc. other things. But I can live with things
for now.</p>
<p>Most folks are probably better/more easily served using something like Netlify,
but I like doing things myself and my needs are simple.</p>
<h1 id="better-security">Better security</h1>
<p>While overkill for a static site like this, the move to S3+CloudFront did mean I
lost an easy way to specify recommended security headers, most important to me
is HSTS. In December 2016/early 2017 AWS launched Lambda@Edge, which allows one
to hook into the CloudFront flow and make changes, most importantly for me, it
gives us the ability to add these headers back. Feels like a kludge to setup a
lambda to set some static headers (honestly Amazon, just provide a way to set
static headers in CloudFront<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a>), but it’s easy enough
and I finally got around to setting it up for the site redo. <a href="https://gitlab.com/doshitan/doshitan.com/blob/459db1ff/infra/lambda.js">The lambda is very
simple</a>.</p>
<p>Also added a Content Security Policy (CSP), but instead of as a header, it’s a
HTML <code>&lt;meta&gt;</code> element since it kinda belongs with the content. I could probably
be convinced to go either way with it, but it’s in the HTML for now.</p>
<p>See the <a href="https://observatory.mozilla.org/analyze/doshitan.com">Mozilla Observatory tests</a>.</p>
<h1 id="repo-organization">Repo organization</h1>
<p>Rearranged some things in the repo. Broke apart the structure, with site
executable bits in a top-level <code>executable/</code> dir and the content (posts, pages,
etc.) in <code>content/</code>. The nix build setup has also changed to accommodate the new
layout as well as being reworked in general. The nix stuff is also locked down
to a specific version (should have done that from the beginning).</p>
<p>I’d love to use nix even more to build and publish the site and there is a
derivation to build the content, but because I rely on the files timestamps to
show when a post or page has last been modified and those are lost/reset during
the build that way, I pretty much have to build the site from the repo. Maybe
I’ll move the last modified date into a meta field in the files themselves, but
for now it’s not that big of a deal.</p>
<p>Dropped Bootstrap and therefore the submodule for it.</p>
<p>Moved from using Google Fonts to just subsetting the text fonts<a href="#fn2" class="footnote-ref" id="fnref2" role="doc-noteref"><sup>2</sup></a> myself and serving them with all the other
site content, which required some build scripts. This was interesting and
probably not quite as good as using Google Fonts, but I like having everything
self contained.</p>
<p>Also moved from a full FontAwesome to just a subset with
<a href="http://fontello.com/">fontello</a>, which has a nice setup for automation. See the
<code>fontello-*</code> targets in the
<a href="https://gitlab.com/doshitan/doshitan.com/blob/efc242ce/makefile#L70"><code>makefile</code></a>.</p>
<h1 id="new-look">New look</h1>
<p>I tend to waffle on about things, so I wanted the site optimized for long-form
reading. That has really always been the focus, but I think the new design is
better than what I had before, with a bit wider main column for text and
sidenotes support. It’s based on <a href="https://github.com/edwardtufte/tufte-css">tufte-css</a>, though with a good amount of
<a href="https://gitlab.com/doshitan/doshitan.com/tree/master/executable/src/Site/Css.hs">additions and tweaks</a> to make it work better for a whole site
instead of just an article.</p>
<p>I’m not using the upstream CSS directly, but rather I <a href="https://gitlab.com/doshitan/doshitan.com/tree/master/executable/src/Site/Css/Tufte.hs">ported it</a> to
<a href="http://fvisser.nl/clay/">Clay</a> to be easier for me to work with. “Easier to
work with” in some ways, being embedded in Haskell is nice, but the Clay files
are compiled <em>with</em> the site executable, not <em>by</em> it, so CSS changes take a site
rebuild to take effect. It’s easier to set up this way, but I should probably
move it to be compiled separately at some point.</p>
<p>Tried to reduce and simplify everything. I kinda want to have the site
navigation vertical on the side instead of horizontal across the top. May move
the table of contents into the sidenotes area, but I’d need to avoid any
sidenotes that are on early content, which is a complication.</p>
<p>I’m not very happy with how code blocks look. The Tufte and Pandoc markups kinda
collide. Also not sure I agree with the Tufte approach of not setting off the
blocks with a different background. Will need to keep tweaking things.</p>
<h1 id="new-markup">New markup</h1>
<p>The underlying HTML markup is more compatible with
<a href="http://microformats.org/wiki/h-entry">h-entry</a>.</p>
<p>Finally set a favicon.</p>
<p>I had two constraints I tried to respect in this whole process 1) only care
about modern browsers and 2) no JavaScript. For certain design elements in the
future, especially supporting them across all devices, I may relax the second
constraint, but if I could get something I liked without JS, then I wanted that.
And the first one both helps with that and makes my life easier.</p>
<h1 id="wrap-up">Wrap up</h1>
<p>I’d like to go even more <a href="https://indieweb.org/">IndieWeb</a> in the future with
“notes” (think of a tweet, short unnamed content) and more social support
(distributed commenting/liking/etc., with things like
<a href="https://indieweb.org/Webmention">Webmention</a> and
<a href="https://en.wikipedia.org/wiki/ActivityPub">ActivityPub</a>), but those don’t fit
well with a static site<a href="#fn3" class="footnote-ref" id="fnref3" role="doc-noteref"><sup>3</sup></a> and I like the simplicity of what I’ve got for now.</p>
<p>The goal was to update the site and get it to a place I was happier with. That
goal was achieved. Now to finish the slew of half-written posts I’ve accrued.</p>
<section id="footnotes" class="footnotes footnotes-end-of-document" role="doc-endnotes">
<hr />
<ol>
<li id="fn1"><p>In November 2021 <a href="https://aws.amazon.com/blogs/networking-and-content-delivery/amazon-cloudfront-introduces-response-headers-policies/">AWS annouced CloudFront Response Header
Policies</a>,
finally providing the ability to specify a static list of headers to include in
all responses of the CloudFront distribution.<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn2"><p>Merriweather
and Fira Mono at time of writing<a href="#fnref2" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn3"><p>though <a href="https://webmention.io" class="uri">https://webmention.io</a> and <a href="https://fed.brid.gy" class="uri">https://fed.brid.gy</a>
help<a href="#fnref3" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
</ol>
</section>]]></summary>
</entry>
<entry>
    <title>Setting Up Let’s Encrypt and Choosing an Email Provider</title>
    <link href="https://doshitan.com/stretching-my-sysadmin-muscles/" />
    <id>https://doshitan.com/stretching-my-sysadmin-muscles/</id>
    <published>2016-01-26T00:00:00Z</published>
    <updated>2016-01-26T00:00:00Z</updated>
    <summary type="html"><![CDATA[<p>In the week leading up to the new year I scratched some long standing itches of
mine, adding HTTPS support and setting up email for doshitan.com.</p>
<h1 id="https-everywhere">HTTPS Everywhere</h1>
<p>I’ve wanted to enable HTTPS on doshitan.com since I first started the website,
but didn’t really want to shell out much money (especially reoccurring costs)
for something which should really be free/one-time cost. The leading free option
(that I know of) for a long time was StartSSL, which has a slightly better
setup, with free 1-year certificates or charging just for identity verification
(which actually costs something) and not for every single certificate you want
to generate (which really doesn’t cost anything), but I didn’t want to have to
remember to login and renew/regenerate a free certificate every year or give a
bunch of personal information to an Israeli company to store for years.</p>
<p>In short, I was waiting for <a href="https://letsencrypt.org/">Let’s Encrypt</a> to be
generally available. I think there were other automated CAs issuing free/cheap
DV certificates before Let’s Encrypt, but Let’s Encrypt is more my style (smart,
open, principled, and free). With it entering public beta on December 3rd, it
was just a matter of finding some time to play with it. I’m happy to say it was
fairly painless to get it all set up and with the proper config settings for
nginx, doshitan.com now has an A+ on the SSL Labs test
(<a href="https://www.ssllabs.com/ssltest/analyze.html?d=doshitan.com&amp;hideResults=on&amp;latest">give it a run yourself</a>).</p>
<p>I’ll go through the general setup, but it’s not terribly interesting so feel
free to skip.</p>
<h2 id="lets-encrypt-setup">Let’s Encrypt Setup</h2>
<p>First step was getting the Let’s Encrypt client running. I’m currently running
from git, though there is a packaged version in the experimental repos for
Debian Jessie. As the client stabilizes I’ll move over to the packaged version,
but for now I want to be running the latest code and using <code>letsencrypt-auto</code>
instead of <code>letsencrypt</code>. So just clone the repo somewhere:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git clone https://github.com/letsencrypt/letsencrypt /wherever/</span></code></pre></div>
<p>This site is served by nginx, and Let’s Encrypt doesn’t yet have automagical
support for nginx like it does for Apache, but all it takes is a few extra
command line flags to get it working. Let’s Encrypt certificates are valid for
90 days, so you’ll want to renew them at least every couple of months (~60 days)
to be safe. I setup a simple systemd unit to run the requisite commands and a
timer unit to trigger it every month, which I’ll move out to every two months
after a while. They are as follows:</p>
<div class="sourceCode" id="cb2" data-caption="/etc/systemd/system/letsencrypt-example.service"><pre class="sourceCode ini"><code class="sourceCode ini"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="kw">[Unit]</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="dt">Description</span><span class="ot">=</span><span class="st">Generate/renew SSL certificate for example.com</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="kw">[Service]</span></span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a><span class="dt">Type</span><span class="ot">=</span><span class="st">oneshot</span></span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a><span class="dt">ExecStart</span><span class="ot">=</span><span class="st">/wherever/letsencrypt-auto certonly --renew-by-default --agree-tos -a webroot --webroot-path /var/www/example.com -d example.com -d www.example.com --email webmaster@example.com</span></span>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a><span class="dt">ExecStart</span><span class="ot">=</span><span class="st">/bin/systemctl reload nginx</span></span></code></pre></div>
<div class="sourceCode" id="cb3" data-caption="/etc/systemd/system/letsencrypt-example.timer"><pre class="sourceCode ini"><code class="sourceCode ini"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="kw">[Unit]</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="dt">Description</span><span class="ot">=</span><span class="st">Run letsencrypt-example</span></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="kw">[Timer]</span></span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a><span class="dt">OnCalendar</span><span class="ot">=</span><span class="st">monthly</span></span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a><span class="dt">Persistent</span><span class="ot">=</span><span class="kw">true</span></span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a><span class="kw">[Install]</span></span>
<span id="cb3-9"><a href="#cb3-9" aria-hidden="true" tabindex="-1"></a><span class="dt">WantedBy</span><span class="ot">=</span><span class="st">timers.target</span></span></code></pre></div>
<p>Then enable and start the timer unit:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> systemctl enable letsencrypt-example.timer</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> systemctl start letsencrypt-example.timer</span></code></pre></div>
<p>And that’s it, automatic generation and renewal of a certificate for example.com
and www.example.com.</p>
<h3 id="a-more-general-approach">A more general approach</h3>
<p>On a bit of a tangent, if you had lots of different sites to generate/renew
certificates for, you could break some of this out into template unit with some
environment stuff.</p>
<div class="sourceCode" id="cb5" data-caption="/etc/systemd/system/letsencrypt@.service"><pre class="sourceCode ini"><code class="sourceCode ini"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="kw">[Unit]</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="dt">Description</span><span class="ot">=</span><span class="st">Generate/renew SSL certificate for %I</span></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="kw">[Service]</span></span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a><span class="dt">Type</span><span class="ot">=</span><span class="st">oneshot</span></span>
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a><span class="dt">EnvironmentFile</span><span class="ot">=</span><span class="st">/etc/sysconfig/%I</span></span>
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a><span class="dt">ExecStart</span><span class="ot">=</span><span class="st">/wherever/letsencrypt-auto certonly --renew-by-default --agree-tos -a webroot --webroot-path /var/www/%I --email webmaster@%i.com $OPTIONS</span></span>
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a><span class="dt">ExecStart</span><span class="ot">=</span><span class="st">/bin/systemctl reload nginx</span></span></code></pre></div>
<div class="sourceCode" id="cb6" data-caption="/etc/systemd/system/letsencrypt@.timer"><pre class="sourceCode ini"><code class="sourceCode ini"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="kw">[Unit]</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="dt">Description</span><span class="ot">=</span><span class="st">Run letsencrypt for %I</span></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a><span class="kw">[Timer]</span></span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a><span class="dt">OnCalendar</span><span class="ot">=</span><span class="st">monthly</span></span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a><span class="dt">Persistent</span><span class="ot">=</span><span class="kw">true</span></span>
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a><span class="kw">[Install]</span></span>
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a><span class="dt">WantedBy</span><span class="ot">=</span><span class="st">timers.target</span></span></code></pre></div>
<p>Drop a config file for each domain you’re interested in</p>
<div class="sourceCode" id="cb7" data-caption="/etc/sysconfig/example1.com"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="va">$OPTIONS</span><span class="ex">=-d</span> example1.com <span class="dt">\</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a>         <span class="at">-d</span> www.example1.com <span class="dt">\</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a>         <span class="at">-d</span> sub.example1.com</span></code></pre></div>
<p>Followed by a:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> systemctl enable letsencrypt@example1.com.timer</span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> systemctl start letsencrypt@example1.com.timer</span></code></pre></div>
<p>If all the sites follow the same pattern (as most do), you could change a couple
of the service file lines to something like:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode ini"><code class="sourceCode ini"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="dt">EnvironmentFile</span><span class="ot">=</span><span class="st">-/etc/sysconfig/%I</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="dt">ExecStart</span><span class="ot">=</span><span class="st">/wherever/letsencrypt-auto certonly --renew-by-default --agree-tos -a webroot --webroot-path /var/www/%I --email webmaster@%i.com -d %i -d www.%i $OPTIONS</span></span></code></pre></div>
<p>So no config file is needed if the site only needs the common stuff.</p>
<h2 id="nginx">Nginx</h2>
<p>We need to allow nginx to read the certificates. For me it’s easiest to just
give the <code>www-data</code> user read access with:</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> sudo setfacl <span class="at">-R</span> <span class="at">-m</span> user:www-data:r-x /etc/letsencrypt/archive/ /etc/letsencrypt/live/</span></code></pre></div>
<p>A better approach would keep the stuff (or at least the private keys) strictly
readable by root only (i.e., the web server starts under root but forks a less
privileged process to handle requests and such), but as I only run a static site
under nginx, I’m not too worried about something happening that exposes the
private key.</p>
<p>After the certificates are readable by nginx, we need to have nginx actually use
them. Somewhere in the blocks for both www.example.com and example.com add:</p>
<pre><code>...
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
...</code></pre>
<p>The rest of the ssl settings are gonna vary depending on your needs, but I
generally follow the <a href="https://github.com/h5bp/server-configs-nginx">h5bp config</a>
with whatever tweaks I need. An important step is to generate a unique
Diffie-Hellman parameter with something like:</p>
<div class="sourceCode" id="cb12" data-caption="Using openssl"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> nice <span class="at">-n19</span> openssl dhparam <span class="at">-out</span> /etc/nginx/ssl/dhparam.pem</span></code></pre></div>
<p>Or:</p>
<div class="sourceCode" id="cb13" data-caption="Using gnutls"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> nice <span class="at">-n19</span> certtool <span class="at">--generate-dh-params</span> <span class="at">--outfile</span> /etc/nginx/ssl/dhparam.pem <span class="at">--bits</span> 4096</span></code></pre></div>
<p>Once it eventually finishes, gotta make use of it for each SSL-enabled block in
nginx with:</p>
<pre><code>ssl_dhparam /etc/nginx/ssl/dhparam.pem;</code></pre>
<p>Ensure it’s all good:</p>
<div class="sourceCode" id="cb15"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> sudo nginx <span class="at">-t</span></span></code></pre></div>
<p>Then:</p>
<div class="sourceCode" id="cb16"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> systemctl reload nginx</span></code></pre></div>
<p>And now the site is set.</p>
<h1 id="email">Email</h1>
<p>I also setup email for the doshitan.com domain. The hardest part was deciding
how I wanted to host the mail server. I considered a couple options.</p>
<h2 id="google">Google</h2>
<p>The easiest option is probably just Google Apps as I’ve already been using Gmail
has my primary mail service for years, but I really wanted to detangle from
Google. While I’ve never had an issue with their services, they are rather
omnipresent and I’d rather not contribute to a proprietary mono-culture if I can
help it (which is also part of the reason I primary host my code on
<a href="https://gitlab.com/doshitan">GitLab</a> instead of
<a href="https://github.com/doshitan">GitHub</a> and use
<a href="https://duckduckgo.com/">DuckDuckGo</a> as my primary search engine).</p>
<h2 id="dreamhost">Dreamhost</h2>
<p>I currently register my domains through Dreamhost, partly for historical
reasons, but they are also cheap and reputable, so no real reason to change.
Dreamhost offers email hosting for any domain registered through them, but I’ve
heard some not so good things about their email services. Mail not getting sent,
mail not getting received, etc., so I wasn’t too keen on even trying it out.</p>
<h2 id="self-hosted">Self Hosted</h2>
<p>I’ve tossed around the idea of self hosting an email server for quite a while
actually as it’s not terribly difficult to get something basic setup and I
certainly have all the relevant skills to do so, but there are a lot of
downsides to hosting it myself as well. The main downside is simply not getting
outgoing mail flagged as spam by other mail services. The other big downside is
the maintenance. Self hosting gives you a lot of control, but also a lot of
responsibility and potential headache that I don’t really want to have to deal
with for something I just want to work.</p>
<h2 id="fastmail">FastMail</h2>
<p>I finally settled on FastMail. They are a dedicated email service that strongly
supports open standards and have been around forever (well, since 1999). They
also have some support for calendar and contacts that I might give a shot, but
their email support is the main focus.</p>
<h2 id="the-rest">The rest</h2>
<p>After the host was decided on, it was just a few simple DNS changes to get the
mail flowing. And flowing it is! I’ve been quite happy with the performance of
FastMail so far, in both their Web app and Android app. IMAP has been good so
far too. Haven’t yet given the calendar or contacts stuff a good run, but I
suspect those will be just fine too.</p>
<h1 id="wrap-up">Wrap up</h1>
<p>Not complicated stuff, but I’m happy to have it all set up now.</p>]]></summary>
</entry>
<entry>
    <title>ICT Game Jam 2015</title>
    <link href="https://doshitan.com/game-jam-2015/" />
    <id>https://doshitan.com/game-jam-2015/</id>
    <published>2015-09-03T19:57:15-05:00</published>
    <updated>2015-09-04T00:57:15Z</updated>
    <summary type="html"><![CDATA[<p>It’s been about a month since the first ever ICT Game Jam ended. I took part
mostly just to show my support for local things like this as I’m not all that
interested in game development otherwise. That was freeing in a way, I went in
just to have fun (which I think everyone else did too), no pressure on myself
to even have anything functional at the end! Of course, I’d love to have
something neat on the other side of the weekend, but that wasn’t my goal.</p>
<p>So, seeing as I wasn’t really interested in game development – and all the major
“free” game toolkits (Unity, Unreal, etc.) don’t play nice with GNU/Linux or are
in a language I don’t enjoy, e.g., Phaser – I decided if I was gonna do it I
wanted it to at least be interesting (to me if no one else). That meant choosing
some tools I was actually interested in and at least knew enough to get started
in them, which boiled down to either Haskell or Elm. I ended up deciding on Elm,
mainly because I’ve been wanting to do something with it and this seemed like a
good opportunity.</p>
<p>I came up with a few abstract concepts I felt I could have a chance at actually
making and either adapt to whatever theme was chosen or just ignore the theme
and do my own thing (^_^).</p>
<p>The night before the event started I whipped up a little prototype (if it can
even be called that) of one of my ideas just to make sure I had all of the Elm
platform working together and got over the initial language speed bumps (“How do
I compose functions again? Oh, <code>&lt;&lt;</code> or <code>&gt;&gt;</code>, cool.” and so on).</p>
<p>Given the technical restrictions I had decided upon and my attitude towards the
whole affair, I was fully prepared to do something on my own; very few people
would want to learn a language they’d (likely) never heard of, in a style of
programming they’d (likely) never used, with someone who didn’t want to stay up
all night and didn’t care about winning.</p>
<p>The first night of the event (a Friday) was mostly spent just hanging out with
the folks I knew (including giving a quick into to Haskell to one of them).
Towards the end of the night, there was actually a group of folks on board with
building out one of my ideas (the one I had “prototyped”) in Elm. More
precisely, they were on board with <em>me</em> building the game in Elm and them doing
everything else (^_^). I made it perfectly clear that I couldn’t even promise
we’d have something deliverable by Sunday! I was pretty confident that we’d have
<em>something</em>, but I’d never done a game before and never seriously worked in Elm,
so I wasn’t about to have people depend on me to knock it out of the park in 24
hours. The crazy fools went along with me anyway. So we fleshed out the idea a
bit and made it in theme for the event. Then we all went home around 10pm.</p>
<p>Started up the next day around 9-10am and quickly got to work. I spent a good
amount of time, I think it was like 3-4 hours, getting the gameplay up to the
point of my “prototype”, but of course in a more modularized/nicer fashion with
a start screen that had buttons and such. The thing that took the longest was
just reading the Elm docs about the “Elm Architecture” and trying to map the
Mailbox/Address and Signal stuff into working code, threading the stuff through
to the now separate Game module. By the end of Saturday, the basic gameplay was
pretty much done, a lot of the themeing was in place – thanks to the other
members of the team – and we were pretty happy. We all went home by 10-11pm.</p>
<p>Started Sunday again around 9am. We dropped in all the audio, tweaked some of
the art, and just tried to polish the rest off. We were to deliver our game for
the judge’s to play by noon. It wasn’t long after that the public started coming
in and playing all the games. Of course it’s hard to just stop working on the
thing, especially when Elm makes it hard to get something running that’s broken,
so I kept pushing some updates after the “deadline” (with official approval)
incorporating some of the early feedback we were getting. They were just minor
things, a small progress bar across the top that gave a sense of how much of the
conversation was left to listen to, a tip on the home screen on how to play,
getting the game audio to restart on every new game instead of having to reload
the app and a slight tweak to some colors. Around 2pm it was our turn pitch our
game to the judges and around 4pm they got up and announced the winners for the
Community and Judge’s Choice awards<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a>, among other things. Then we all went
home.</p>
<p>We haven’t done much with it since, though we do plan on making it better at some
point. I’d like to add some localStorage support to store your scores and other
state. In the mockups we had a richer “debriefing” section where you have to
answer questions about key points in conversation to actually “win”, that would
be neat to implement. More “levels”/situations/conversations would also be good.
Having the ring wiggle to the actual sound wave of the conversation would be
pretty sweet too, though that’s pretty much a pipe dream, dunno if I really want
to dive into implementing that. If the Touch library was well supported in
mobile browsers, we’d actually automatically have a mobile game as I made
everything scalable from the start, so that would be nice to get figured out.</p>
<p>All in all it was pretty fun. All the code was done by me from scratch starting
Saturday morning and the other guys did a great job making/collecting all the
other assets and really making the game what it turned out to be. It really
would have just been super simple geometric shapes and solid colors if I had
done it myself. The atmosphere is what makes the game at all interesting to play
and none of that was me.</p>
<p>All the other teams had some fun ideas too and I think everyone really enjoyed
the event. If you’re interested, you can take a look at the code and give the
game a try from the <a href="/golden-ear/">project page</a>.</p>
<section id="footnotes" class="footnotes footnotes-end-of-document" role="doc-endnotes">
<hr />
<ol>
<li id="fn1"><p>We ended up winning the Judge’s Choice, so that was neat.<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
</ol>
</section>]]></summary>
</entry>
<entry>
    <title>An Opinionated Overview of JavaScript Stuff (early 2015)</title>
    <link href="https://doshitan.com/js-overview-early-2015/" />
    <id>https://doshitan.com/js-overview-early-2015/</id>
    <published>2015-04-01T00:00:00Z</published>
    <updated>2015-04-01T00:00:00Z</updated>
    <summary type="html"><![CDATA[<p>The next major version of a product at work is probably a rich/fat web client
talking to a REST API, like many things these days. We are currently at the
beginning of this transition. There is one small sub-system that has been
rewritten in Angular (1.3 at time of writing) utilizing a legacy AJAX system we
have, but before getting too much further along in our current path, I felt it
was probably a good idea to survey the current landscape of web client
frameworks/libraries/tools and get some stuff down on (digital) paper.</p>
<p>Now the discussion here is going to be biased by a couple things:</p>
<ol type="1">
<li>My own personal preferences; I like strong statically typed, functional
languages (e.g., Haskell)</li>
<li>The needs at work. For the work situation, we need (in my opinion) something
that is ‘simple’, not necessarily a shallow learning curve, but rather an
execution model that you can understand, easy debugging and help making sure
things don’t break. Another factor is the development team at work is pretty
small, a couple to a few developers at any given time, so one person needs
to be able to accomplish a lot and maintain the product over time; we need
something expressive.</li>
<li>I haven’t actually used most of these tools. I’m making judgments based on
the project’s documentation and the chatter on other sites (HN, Reddit,
etc.) from people who <em>have</em> used them.</li>
</ol>
<p>It should go without saying, but the contents of my personal blog are my own
opinions and in no way represent the opinions of my employer. Furthermore, I in
no way intended or wish to misrepresent any of the tools in this post, if you
find an issue, please <a href="/about/">get in touch</a>.</p>
<h1 id="plain-js-solutions">Plain JS solutions</h1>
<h2 id="angularjs-1.x">AngularJS 1.x</h2>
<p><a href="https://angularjs.org/">Homepage</a></p>
<p>AngularJS is a sophisticated framework for building web applications which
emphasizes a bi-directional dataflow and testing. It’s one of the oldest of the
‘new’ JS libraries/frameworks and as such, has some inertia to it, though I
feel it really only started picking up steam in the past couple of years.</p>
<h3 id="pros">Pros</h3>
<ul>
<li>Already working for a few things at work</li>
<li>Lots of drop in components</li>
<li>Two-way data binding</li>
<li>Backed by Google</li>
<li>Emphasis on testability</li>
<li>Fairly straightforward design patterns to follow (and <a href="https://web.archive.org/web/20211027063616/https://blog.angularjs.org/2014/02/an-angularjs-style-guide-and-best.html">published guidelines</a>)</li>
</ul>
<h3 id="cons">Cons</h3>
<ul>
<li>Can be complicated and fragile (we have already seen this at work)</li>
<li>Two-way data binding</li>
<li>Likely large and incompatible 2.x coming within the next year, maybe with
migration tools, but likely to be a very different framework (i.e.
knowledge/experience gained on 1.x may not directly translate into
productivity with 2.x)</li>
<li>Can have performance issues
<ul>
<li>Is depending on browsers implementing native code (<code>Object.observe</code>) to
alleviate some of its problems</li>
<li>See <a href="https://markdalgleish.github.io/presentation-a-state-of-change-object-observe/">this presentation on <code>Object.observe</code></a></li>
</ul></li>
</ul>
<h2 id="flux-react">Flux + React</h2>
<p><a href="http://facebook.github.io/flux/">Flux Homepage</a>
• <a href="https://facebook.github.io/react/">React Homepage</a></p>
<p>One of the newer kids on the block, React is ‘View’ layer for web applications
which utilizes a ‘Virtual DOM’ to build up and swap out parts of the DOM
efficiently. Flux is an application architecture (as well as the name of
Facebook’s implementation of the Flux architecture) which emphasizes a
uni-directional dataflow which works well with React.</p>
<h3 id="pros-1">Pros</h3>
<ul>
<li>One-way dataflow</li>
<li>Generally more performant (compared to AngularJS)</li>
<li>Backed by Facebook</li>
<li>Flexibility in implementation/architecture, Flux provides some structure</li>
<li><a href="https://facebook.github.io/react-native/">React Native</a></li>
</ul>
<h3 id="cons-1">Cons</h3>
<ul>
<li>More immature ecosystem (compare to AngularJS)</li>
<li>No single best-practice/do-this architecture to follow, though Flux provides
some structure</li>
</ul>
<h3 id="misc">Misc</h3>
<ul>
<li>While one may end up having to roll their own solutions to some things,
<a href="https://facebook.github.io/react/blog/2014/10/17/community-roundup-23.html#yahoo">Yahoo is rewriting their mail app with React and are open-sourcing a number of library</a>
in the process so the ecosystem is likely to be continue growing with
industrial quality components</li>
<li>In general, the <a href="https://reactjs.org/blog">React blog</a> is worth
reading, particularly the community round-up posts</li>
</ul>
<h3 id="more-info">More info</h3>
<p>Tools are available built around these components:</p>
<ul>
<li><a href="http://martyjs.org/">Marty.js</a>, <a href="https://news.ycombinator.com/item?id=8923053">HN Discussion</a></li>
<li><a href="http://fluxxor.com/">Fluxxor</a></li>
<li><a href="https://github.com/spoike/refluxjs">RefluxJS</a></li>
<li><a href="https://github.com/kjda/ReactFlux">ReactFlux</a></li>
</ul>
<h2 id="mercury">Mercury</h2>
<p><a href="https://github.com/Raynos/mercury">Homepage</a></p>
<h3 id="pros-2">Pros</h3>
<ul>
<li>Extremely modular, can use which parts one wants/needs</li>
<li>Generally very good performance (in contention for title of highest
performing library currently available I’d say)</li>
<li>Flexibility in implementation/architecture</li>
</ul>
<h3 id="cons-2">Cons</h3>
<ul>
<li>Extremely modular</li>
<li>No single best-practice/do-this architecture to follow</li>
<li>No big corporate backing?</li>
</ul>
<h2 id="mithril">Mithril</h2>
<p><a href="https://web.archive.org/web/20150417100450/https://lhorie.github.io/mithril/index.html">Homepage</a></p>
<p>Opposite end of the spectrum from <a href="#mercury">Mercury</a> with regards to modularity: Mithril
is one file. Its goal is to be small and simple, both in the code itself and
the cognitive load required to use it.</p>
<h3 id="pros-3">Pros</h3>
<ul>
<li>Very small and ‘simple’</li>
<li>Very good performance, up there with <a href="#mercury">Mercury</a></li>
<li>Flexibility in implementation/architecture</li>
</ul>
<h3 id="cons-3">Cons</h3>
<ul>
<li>I feel it could be a lot of boilerplate/lack of convenient functionality</li>
<li>No single best-practice/do-this architecture to follow, there are some
official suggestions on how to structure an app, but you would largely be
developing our your way to structure the code</li>
<li>No big corporate backing?</li>
</ul>
<h1 id="typed-js-tools">Typed JS tools</h1>
<p>Plain JS will probably one day get type annotations<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a> likely based
on whatever syntax/semantics Typescript and Flow can come to agree on since
these are the two working tools (that I know of) that have the types sprinkled
in otherwise vanilla JS syntax.</p>
<h2 id="typescript">Typescript</h2>
<p><a href="http://www.typescriptlang.org/">Homepage</a></p>
<p>TypeScript is a superset of JS that gives developers a more familiar OOP syntax
to use that compiles down to plain JS. It was one of the first typed JS
supersets and also brings in ES6/ES 2015-like features (e.g., modules and
classes). The forthcoming 1.5 release will bring the compiler to almost
complete parity with ES6/ES 2015 and the 1.6 release will start pulling in ES7
features. It’s one of the best ways to get the JS-of-tomorrow today.</p>
<h2 id="flow">Flow</h2>
<p><a href="http://flowtype.org/">Homepage</a></p>
<blockquote>
<p>A static type checker for JavaScript</p>
</blockquote>
<p>Flow is practically brand new, just open sourced at the end of 2014, though
Facebook has been using it internally for a while. All it does is type checking
(unlike TypeScript) using annotations similar to TypeScript. From what I’ve
seen Flow’s type system is a bit better and more expressive, though TypeScript
is catching up (e.g. TypeScript 1.4 will include Union Types and Type Aliases,
which Flow already supports).</p>
<p>The downside is that the code Flow type-checks has to be pretty much plain JS
(with type annotations) so you can’t really combine it with other tools (like
Sweet.js) unless those other tools will preserve the annotations when
transforming the code. One could potentially work around this with something
like <a href="https://github.com/jareware/flotate">flotate</a> (some of its <a href="https://github.com/facebook/flow/issues/3#issuecomment-69012810">rationale
discussed
here</a>) as long
as the other tools preserve comments. Some tools (like <a href="#babel">Babel</a>) already support
Flow and I imagine that broader community support for type annotations will
grow quickly.</p>
<h2 id="elm">Elm</h2>
<p><a href="http://elm-lang.org/">Homepage</a></p>
<p>Note: When referring to Elm, generally I mean Elm + the <a href="https://github.com/evancz/elm-html">elm-html
package</a> (which is a virtual-dom library
similar to React).</p>
<p>Elm’s a modern language designed to make writing code for interactive
applications short, fast, and maintainable. It’s well thought-out, pragmatic,
and tries to structure its design so it’s easy to pickup/understand.</p>
<h3 id="pros-4">Pros</h3>
<ul>
<li>“Better” language than JS to work with</li>
<li>Many of the same benefits of Flux + React or Mercury</li>
<li>Interoperable with plain JS (via a language feature called ports)</li>
<li>Can have even better performance than React because of language features
(immutable data structures, optional lazy evaluations, etc.)</li>
<li>Don’t have to deal with npm and bower while also getting some <a href="https://elm-lang.org/news/0.14#better-build-tools">really nice
tooling</a></li>
<li><a href="https://github.com/evancz/elm-architecture-tutorial#the-elm-architecture">A natural way to structure
applications</a></li>
</ul>
<h3 id="cons-4">Cons</h3>
<ul>
<li>Like React, more immature ecosystem</li>
<li>Needs a runtime in the browser</li>
</ul>
<h2 id="purescript">PureScript</h2>
<p><a href="http://www.purescript.org/">Homepage</a></p>
<blockquote>
<p>PureScript is a small strongly typed programming language that compiles to
JavaScript.</p>
</blockquote>
<p>Taking many cues from Haskell, but making them fit in the JS world (like
strict-by-default evaluation), PureScript compiles down to a plain JS with no
runtime (unlike <a href="#elm">Elm</a>). It has existing bindings to things like
<a href="https://github.com/purescript-contrib/purescript-react">React</a> and
<a href="https://github.com/purescript-contrib/purescript-angular">Angular</a>, though
they are both in the alpha/experimental stages. They also push against some of
the functional features of PureScript so using something lower-level and more
friendly to immutable data like
<a href="https://github.com/purescript-contrib/purescript-virtual-dom">virtual-dom</a> is
probably a better approach.</p>
<p>Paired with something like the <a href="https://github.com/bodil/purescript-signal">signal
library</a> and you have a virtual-dom
FRP implementation to play with.</p>
<h3 id="pros-5">Pros</h3>
<ul>
<li>“Better” language than JS to work with</li>
<li>Flexibility in implementation, it’s a full-blown general purpose language so
less choices are made for you, unlike something more focused like <a href="#elm">Elm</a></li>
<li>No (extra) runtime</li>
</ul>
<h3 id="cons-5">Cons</h3>
<ul>
<li>Still somewhat experimental</li>
</ul>
<h2 id="other-haskell-stuff">Other Haskell Stuff</h2>
<p>There’s a lot of awesome stuff going in the Haskell world to improve JS
development, mostly in the form of Haskell-to-JavaScript compilers. As of
today, most of it probably isn’t ready for prime time/big stuff, but is
improving and I expect things to get a lot better here quickly.</p>
<p>See <a href="http://blog.jenkster.com/2015/02/a-brief-and-partial-review-of-haskell-in-the-browser.html">this
post</a>
for a further discussion of some of these options and <a href="http://www.reddit.com/r/haskell/comments/2umqfr/a_brief_and_partial_review_of_haskell_in_the/">the reddit
post</a>
has some good discussion.</p>
<h3 id="full-haskell">Full Haskell</h3>
<ul>
<li><a href="https://github.com/ghcjs/ghcjs">GHCJS</a> - Version of GHC that emits JS
instead of native code, compile <em>any</em> Haskell to JS</li>
<li><a href="http://haste-lang.org/">Haste</a> - Compile <em>almost any</em> Haskell to JS</li>
</ul>
<h3 id="haskell-interop">Haskell interop</h3>
<ul>
<li><a href="https://github.com/faylang/fay/wiki">Fay</a></li>
</ul>
<h3 id="other">Other</h3>
<ul>
<li>Inferno (formerly SJS) - type inference for JS
<ul>
<li><a href="https://noamlewis.wordpress.com/2015/01/20/introducing-sjs-a-type-inferer-and-checker-for-javascript/">Introduction post</a></li>
<li><a href="http://www.reddit.com/r/haskell/comments/2szt1u/introducing_sjs_a_type_inferer_and_checker_for/">Reddit discussion</a></li>
</ul></li>
</ul>
<h1 id="other-js-language-tools">Other JS Language Tools</h1>
<h2 id="sweet.js">Sweet.js</h2>
<p><a href="http://sweetjs.org/">Homepage</a></p>
<p>This is a macro system for JS. It would probably be extremely useful in
cutting down boilerplate if one chooses to use plain JS-of-today for a
project. The biggest downside with Sweet.js is that it doesn’t (yet) support
type annotations so doesn’t integrate super nicely with the other
static-analysis/type-checking tools.</p>
<h2 id="bacon.js-and-rxjs">Bacon.js and RxJS</h2>
<p><a href="https://baconjs.github.io/">Bacon.js Homepage</a>
• <a href="https://web.archive.org/web/20150402055831/http://reactive-extensions.github.io/RxJS">RxJS Homepage</a></p>
<p>Both Bacon.js and RxJS provide “reactive” components, which, roughly speaking,
are things that have some notion of time built into them. They use different
terms, but I believe the libraries are fairly equivalent in functionally. The
<a href="https://baconjs.github.io/api.html#for-rxjs-users">Bacon.js docs</a> have a bit
on their compatibility.</p>
<h2 id="immutable-and-mori">Immutable and Mori</h2>
<p><a href="https://web.archive.org/web/20150822135903/https://facebook.github.io/immutable-js/">Immutable.js Homepage</a>
• <a href="https://swannodette.github.io/mori/">Mori Homepage</a></p>
<p>Provides immutable data structures. Immutable data is great for a variety of
things and in particular in can be a big boon when working with rendering stuff
since determining if anything has changed is a cheap check.</p>
<h2 id="babel">Babel</h2>
<p><a href="https://babeljs.io/">Homepage</a></p>
<p>Babel makes next generation JS features available now by compiling them down
into today’s JS. The currently broadly supported JS lacks a lot of modern
features, this can be a great way to utilize some of them (like modules) until
the browsers/your user base catch up. Used to be called 6to5.</p>
<h2 id="coffeescript">CoffeeScript</h2>
<p><a href="http://coffeescript.org/">Homepage</a></p>
<p>I mention this merely because it is somewhat popular, but I don’t really
consider it an option as it doesn’t bring a whole lot of important things
(namely static type checking) that the other solutions provide, it is largely
just syntax sugar.</p>
<h1 id="everything-else">Everything Else</h1>
<p>There are a bazillion other JS frameworks/tools out there that I didn’t look at
closely, some linked below:</p>
<h2 id="frameworks">Frameworks</h2>
<ul>
<li><a href="https://github.com/staltz/cycle">Cycle.js</a></li>
<li><a href="https://aurelia.io/">Aurelia</a>, <a href="https://web.archive.org/web/20201108141648/http://aurelia.io/blog/2015/01/26/introducing-aurelia/">Blog Announcement</a>, <a href="https://news.ycombinator.com/item?id=8948665">HN announcement</a></li>
<li><a href="http://durandaljs.com/">Durandal</a></li>
<li><a href="http://vuejs.org/">Vue.js</a></li>
<li><a href="http://enyojs.com/">Enyo</a></li>
<li><a href="http://emberjs.com/">Ember.js</a></li>
<li><a href="https://web.archive.org/web/20150915021726/http://rightjs.org/">RightJS</a></li>
</ul>
<h2 id="pieces">Pieces</h2>
<ul>
<li><a href="http://ampersandjs.com/">Amperstand.js</a></li>
<li><a href="http://backbonejs.org/">Backbone.js</a></li>
<li><a href="http://knockoutjs.com/">Knockout</a></li>
<li><a href="https://web.archive.org/web/20160930172648/http://www.ractivejs.org/">Ractive.js</a></li>
</ul>
<h2 id="languages">Languages</h2>
<ul>
<li><a href="http://roy.brianmckenna.org/">Roy</a></li>
<li><a href="http://livescript.net/">LiveScript</a></li>
</ul>
<h2 id="other-1">Other</h2>
<ul>
<li><a href="https://docs.google.com/spreadsheets/d/1r8rJy2Q5p5QORYKcye93UECwOlSgFL24c5fyF7dqhaM/edit?pli=1#gid=1607194899">Comparison of a bunch of frameworks</a> (hint: tabs at the bottom)</li>
</ul>
<h1 id="todomvc-benchmark">TodoMVC Benchmark</h1>
<p>There’s a TodoMVC benchmark with a variety of popular (and obscure) frameworks
here:</p>
<p><a href="https://web.archive.org/web/20160524230706/http://matt-esch.github.io:80/mercury-perf/">http://matt-esch.github.io/mercury-perf</a></p>
<p>The benchmark consists of creating 100 todos, marking them as completed, and
then deleting them. It aims to give an idea of how frameworks perform under
real-world-ish conditions running idiomatic code (as opposed to
micro-benchmarks, which tend to take advantage of obscure tricks and aggressive
optimizations that sacrifice maintainability for extra speed). A more <a href="https://web.archive.org/web/20151103031644/https://evancz.github.io/todomvc-perf-comparison/">limited
benchmark</a>,
but with a prettier graph at the end is also available; it was put together for
<a href="https://elm-lang.org/news/blazing-fast-html">the blog post announcing
elm-html</a>.</p>
<h1 id="best-bets-today">Best Bets Today</h1>
<h2 id="flux-react-immutable-flow">Flux + React + Immutable + Flow</h2>
<p>Integrating a static analysis tool like <a href="#flow">Flow</a> would be a requirement for me, but
that could be dropped if your requirements are pure JS with no build step
(and/or you subscribe to the pulling your hair out and yelling at the computer
style of debugging/refactoring; static analysis really helps people). I’d
probably also want to use some JS-of-tomorrow layer as well, either using
<a href="#babel">Babel</a> or swapping out <a href="#flow">Flow</a> for <a href="#typescript">Typescript</a>.</p>
<p>To see how some of this stuff plays together, see <a href="http://aeflash.com/2015-02/react-tips-and-best-practices.html">this blog
post</a> which
suggests making heavy use of the
<a href="http://facebook.github.io/react/docs/pure-render-mixin.html">PureRenderMixin</a>
(among other things) and generally having pure functions and immutable data.
With the introduction of React Native, this setup has a lot of potential to
reuse all the application-y bits (Flux + Immutable + Flow + (Babel)) and swap
out the React bit for a native view layer.</p>
<h2 id="elm-1">Elm</h2>
<p>A clean, modern language designed from the ground up to make web development
better. Immature in some ways and may not be “production ready” enough for all
cases, but well worth a look and experiment. The language is evolving fairly
quickly, so you’ll need to keep up, but that’s no different that most other
things in the JS world right now (^_^).</p>
<h1 id="tldr">TL;DR</h1>
<p>If you choose to stick with plain JS, look at Flux (Marty.js being my suggested
implementation) + React and try to integrate some sort of static analysis into
your workflow; I’d suggest Flow. If you have/are given more freedom, explore
Elm. If you want something small and simple, look at Mithril.js.</p>
<p>The main take away is: buy what the functional programming folks have been
selling for decades, pure functions and immutable data. You have to go out of
your way to do this in plain JS; using a language that has this style of
programming built in will cut down the boilerplate and open up nicer
abstractions.</p>
<h1 id="tldr-the-tldr">TL;DR the TL;DR</h1>
<p>Learn Haskell.</p>
<p>I hope this was helpful in some way. Thanks for reading/skimming/skipping to
the end.</p>
<section id="footnotes" class="footnotes footnotes-end-of-document" role="doc-endnotes">
<hr />
<ol>
<li id="fn1"><p><a href="https://github.com/mozilla/sweet.js/issues/393#issuecomment-56405997" class="uri">https://github.com/mozilla/sweet.js/issues/393#issuecomment-56405997</a><a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
</ol>
</section>]]></summary>
</entry>
<entry>
    <title>Dotfile Management</title>
    <link href="https://doshitan.com/dotfile-management/" />
    <id>https://doshitan.com/dotfile-management/</id>
    <published>2015-02-19T00:00:00Z</published>
    <updated>2015-02-19T00:00:00Z</updated>
    <summary type="html"><![CDATA[<p>A little over a year ago I spent a weekend migrating my dotfile/home directory
management scheme from the usual monolithic <code>~/dotfiles/</code> directory with
symlinks to the proper places (not even using something like
<a href="https://github.com/technicalpickles/homesick">homesick</a>/<a href="https://github.com/andsens/homeshick">homeshick</a> or <a href="http://www.gnu.org/software/stow/">GNU Stow</a>, just a makefile), to a much improved
version using <a href="http://myrepos.branchable.com/">myrepos</a> and <a href="https://github.com/RichiH/vcsh">vcsh</a>.</p>
<p>At some point in 2013, I stumbled upon <a href="https://web.archive.org/web/20100521222423/http://she.geek.nz/archives/546-migrating-my-homedirectory-from-one-repo-to-many.html">an old post by Penny Leach</a><a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a>. Like her, I’ve found I tend to not commit
changes to this stuff atomically. I change something, intending to commit it
once I test it out to make sure it’s working, only to get on with working and
forget about the committing part. Then I do the same thing with some other
tool’s configuration and eventually end up with weeks of changes in a bunch of
files all in a single repository.</p>
<p>Since Penny’s post (over five years ago at time of writing), vcsh has evolved
(the vcsh script she mentions was <a href="http://git.madduck.net/v/etc/zsh.git/commit/4e5f7ffb64e3e06024312c9d859eeee5c4504dd1">deprecated</a>) and is a bit nicer to work
with. I just followed the <a href="https://github.com/RichiH/vcsh/blob/master/doc/README.md">vcsh docs</a> and used the <a href="https://github.com/RichiH/vcsh/blob/master/doc/README.md#the-steal-from-template-way">‘Steal-from-Template’</a> way
to get setup.</p>
<p>Pretty straightforward after that. My dotfiles now live in separate repositories
for each program/tool and are the <a href="https://gitlab.com/users/doshitan/projects">repositories starting with ‘dots-’ on
gitlab</a>. One very nice thing about
this setup is now each tool’s configuration can be on separate branches at the
same time. For instance, I’ve been reorganizing my vim dotfiles lately and for
systems where I want to test the new configuration I just <code>git checkout wip/reorg</code> in the vim repo; no other tools configuration is touched and if
something is broken, I can just <code>git checkout master</code> and old vim config is
restored. Similar story if I ever need different configurations for different
versions of a tool, or on different machines, just checkout the needed branch
for the respective tool. This is a capability that is lacking in the single
dotfiles repo scheme and it’s really useful to have.</p>
<p>With myrepos, managing a bunch of separate repositories is easy enough and to
configure a new system it’s just:</p>
<pre><code>cd
vcsh clone https://gitlab.com/doshitan/dots-mr.git mr
&lt;tweak symlinks in ~/.config/mr/{available,config}.d/ if needed&gt;
mr up</code></pre>
<p>Basically, get your myrepos config setup, then have it set everything else up.
If you’re still doing a monolithic dotfiles repository and/or symlinking stuff
around, I strongly recommend giving the vcsh/myrepos combination a shot.</p>
<section id="footnotes" class="footnotes footnotes-end-of-document" role="doc-endnotes">
<hr />
<ol>
<li id="fn1"><p>This used
to point to
http://mjollnir.org/blog/migrating-my-homedirectory-from-one-repo-to-many/, but
that has since died and that version doesn’t exist in an archive, so pointing to
a version on her previous blog.<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
</ol>
</section>]]></summary>
</entry>
<entry>
    <title>Migrating to Hakyll</title>
    <link href="https://doshitan.com/migrating-to-hakyll/" />
    <id>https://doshitan.com/migrating-to-hakyll/</id>
    <published>2013-08-30T00:00:00Z</published>
    <updated>2013-08-30T00:00:00Z</updated>
    <summary type="html"><![CDATA[<p class="alert alert-info" role="alert">
Note: While this was posted in February 2015, I had intended on publishing it
back in 2013 shortly after I had moved over to the new site; that didn’t
happen, but it was mostly done and I’ve just cleaned it up a bit to get this
out there, so it is best view as if we are back in August 2013 and that’s why
the post date is what it is.
</p>
<p>As previously mentioned if you follow the blog, I have <a href="/leaving-wordpress-for-hakyll/">left WordPress for
Hakyll</a>. This is the technical followup going
through how I went about setting the site up.</p>
<h1 id="hakyll-setup">Hakyll Setup</h1>
<p>So first things first, install Hakyll. Previously I used cabal-dev, but
Cabal-Install 1.18 includes the <a href="https://github.com/haskell/cabal/wiki/Sandboxed-Builds-and-Isolated-Environments">Sandboxed Builds and Isolated
Environments</a>
work so that is my sandboxing environment now. <a href="https://web.archive.org/web/20190709154928/http://coldwa.st/e/blog/2013-08-20-Cabal-sandbox.html">This
post</a>
is helpful for folks switching over.</p>
<p>I thought it might be an experience to write everything for the site in
Haskell, using Clay as the CSS preprocessor and Fay for JavaScript. I tried
Clay, but it’s math operations on values just don’t work and that’s a deal
breaker. I was going to try implementing the operators, but decided to just
use LESS so I could move forward. I may visit Clay again soon.</p>
<p>I debated what framework to build the site on, if I used one at all. I’ve used
<a href="http://getbootstrap.com/">Bootstrap</a> before and like it well enough. I’ve
heard great things about <a href="http://foundation.zurb.com">Foundation</a> as well, but
I’m not as familiar with the Ruby environment, so out of the two, I’m biased
towards Bootstrap. For the most part they are pretty much the same, especially
with the release of Bootstrap 3 whose revamped grid system borrows a lot from
Foundations – and is better for it. But besides the big two, I thought about
going leaner and different with things like
<a href="https://web.archive.org/web/20150327063937/http://responsablecss.com/">Responsable</a>,
<a href="https://web.archive.org/web/20150226124259/http://framelessgrid.com/">Framless</a>,
<a href="https://web.archive.org/web/20150621222222/http://goldengridsystem.com/">Golden Grid
System</a>,
or <a href="https://web.archive.org/web/20170708135824/https://wail.es/opendaws/">Open
DAWS</a>. I
mean, my site isn’t going to be a big thing with complicated interactions, so I
could do most stuff by hand. Ultimately though, I think what I would build would
come out pretty similar to Bootstrap anyway, so coupled with my familiarity with
it and the better grid system in version three, I went with Bootstrap.</p>
<p>Because I’m using Bootstrap, I haven’t needed any custom JavaScript yet, but
when I do, I think I’ll try Fay.</p>
<h2 id="write-the-code">Write the code</h2>
<p>Hakyll is less a static site generator and more a library to write a static
site generator, as is usual in Haskell land. Not too hard to cobble something
together from other folks’ example code though. Basic file layout for the
project is:</p>
<pre><code>.
├── assets
│   ├── js
│   └── less
├── drafts
├── libs
│   ├── bootstrap
│   └── font-awesome
├── pages
├── posts
├── src
└── templates</code></pre>
<p>Most of it is fairly self-explanatory I think. <code>pages/</code> holds content that
doesn’t really have a “published” date or represent some snapshot in time and
are generally kept current whereas <code>posts/</code> holds the stuff that is time
sensitive. <code>drafts/</code> holds posts that I’m preparing to publish, there is a
makefile target that links/unlinks them into the <code>posts/</code> so I can
enable/disable them easily. <code>libs/</code> holds the git submodules of my front-end
third-party dependencies. <code>src/</code> holds the source code for the site generator.
If you want to have a deeper look, the <a href="https://gitlab.com/doshitan/doshitan.com">source code is on
GitLab</a>.</p>
<h2 id="moving-the-content">Moving the content</h2>
<p>I used <a href="https://wordpress.org/plugins/markdown-on-save/">Markdown on Save</a> with
WordPress and I only had a few posts, so I just manually copied the markup
over. Nothing fancy here.</p>
<h2 id="static-site-tradeoffs">Static Site Tradeoffs</h2>
<p>Because I’m using a static site, there are a few things you don’t just get,
such as search and comments.</p>
<p>Search can be done client side (<a href="http://lunrjs.com/">lunr.js</a><a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a>),
through a third-party (<a href="https://swiftype.com/">Swiftype</a><a href="#fn2" class="footnote-ref" id="fnref2" role="doc-noteref"><sup>2</sup></a>), or
through a server side program. Some more discussion on <a href="http://stackoverflow.com/questions/10131541/how-can-i-add-a-site-search-feature-to-a-jekyll-blog">Stack
Overflow</a>.</p>
<p>A potential downside to the lunr.js approach is that the entire site index must
be loaded into the clients memory. In principle this seems wasteful for every
client to expend the energy to construct the entire search index compared to
every client sharing one on the server. In practice, probably not a big deal
for the scale of this site (extremely small).</p>
<p>I haven’t decided what I want to do about search yet. For now, people can just
use DuckDuckGo/Google to search the site, but I’d like to have a built-in
option as well. I’ll probably do a lunr.js thing or make a simple server side
search daemon.</p>
<p>Comments can also be handled on the client side code and some third-parties
provide easy solutions; some standouts being <a href="https://disqus.com/">Disqus</a> and
<a href="http://www.intensedebate.com/">IntenseDebate</a>. Honestly though, this site is
extremely low traffic and for the one person every five years who would want to
comment, I’d prefer they just <a href="/about/">email me</a>. Less for me to maintain.</p>
<h1 id="server-setup">Server Setup</h1>
<p>I was hosting the old site on <a href="https://www.dreamhost.com/">DreamHost</a> and
I know others have had mixed experiences with them, but their hosting was fine
for me, never had problems. While the hosting was fine, it was shared hosting,
which is pretty restrictive. I wanted more flexibility for my site, with root
access to install whatever I need and dedicated resources so I can plan what
I can/can’t run. So I wanted a VPS. I decided to go with <a href="https://www.digitalocean.com/">Digital
Ocean</a> mostly because of what I think is an
incredible value. I’m using the smallest plan currently (512MB memory, 20GB
disk space, $5/month) as it suits my minimal needs perfectly and is cheap,
cheaper than even the old DreamHost account.</p>
<p>Nothing else too interesting on the server setup, just the basics. Debian, lock
down ssh (disable root, disable password login, etc.), enable dotdeb repo (for
newer nginx), install nginx, configure nginx (I made use of POSIX ACLs for
access to <code>/var/www/</code> and such), moved DNS to Digital Ocean. For some extra
security, I setup and configured <a href="http://www.configserver.com/cp/csf.html">ConfigServer Security &amp; Firewall
(CSF)</a>, which was painless. CSF is
nice for non-sysadmin folks (like me) who don’t want to spend a bunch of time
learning/setting up/maintaining the important, but often impregnible, software
for firewalls, intrusion detection, and/or failed login attempts, as it does it
all (mostly) automatically.</p>
<h1 id="wrap-up">Wrap up</h1>
<p>All and all, pretty painless migration. Playing with Hakyll is a fun way to
learn some Haskell.</p>
<section id="footnotes" class="footnotes footnotes-end-of-document" role="doc-endnotes">
<hr />
<ol>
<li id="fn1"><p><a href="http://10consulting.com/2013/03/06/jekyll-and-lunr-js-static-websites-with-powerful-full-text-search-using-javascript/">Example</a> integrating with Jekyll<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn2"><p><a href="http://paulstamatiou.com/responsive-retina-blog-development-part-1">Example</a> in the search section<a href="#fnref2" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
</ol>
</section>]]></summary>
</entry>
<entry>
    <title>Leaving Wordpress for Hakyll</title>
    <link href="https://doshitan.com/leaving-wordpress-for-hakyll/" />
    <id>https://doshitan.com/leaving-wordpress-for-hakyll/</id>
    <published>2013-08-26T00:00:00Z</published>
    <updated>2013-08-26T00:00:00Z</updated>
    <summary type="html"><![CDATA[<p>So it’s been a while. I haven’t written here in almost a year. A mixture of
being really busy with final year school stuff, an internship as well as
barriers to writing (WordPress) effectively ensured I stayed away.</p>
<h1 id="wordpress-as-a-barrier">WordPress As A Barrier</h1>
<p>WordPress is great for what it is and nowadays you can build just about
anything with it, but for how I think, its work flow presented a problem. It
seems silly, but having to sign in, type inside a rather crummy editor
(compared to what I’m used to), and press buttons was a big hurdle to jump for
me. It always put me off from writing, just that little bit of unpleasantness
that would stop me from starting. As I said, kind of silly, but thems the
rubs.</p>
<p>I’m at a terminal or inside Vim most of the time. If I could publish and
control my website without leaving these environments I would be much more
likely to keep up with blogging. So that’s what I wanted.</p>
<p>There are tools such as
<a href="http://srackham.wordpress.com/blogpost-readme/">blogpost</a> and
<a href="http://wp-cli.org/">WP-CLI</a>, which would provide most of what I was looking
for. But even if I could gloss over the interface with some command line
tools, it would still come down to managing a collection of plugins and
updates that you really ought to stay on top of for security reasons.</p>
<p>So it’s still a bit of a hassle to maintain a WordPress installation even if
I could do most of it from the command line. I wanted something simpler, where
I could just write, publish and get on with life; no managing a database or
being bugged about updates.</p>
<h1 id="hakyll-as-an-enabler">Hakyll As An Enabler</h1>
<p>Given I didn’t really want to deal with a dynamic blog engine, I was looking
for a static site generator. These have been rising in popularity the past few
years with things like <a href="http://jekyllrb.com/">Jekyll</a> and hosting on <a href="http://pages.github.com/">Github
pages</a>. They are much more suited to my mindset.</p>
<p>There are a some good ones out there, but for a variety of reasons I chose
<a href="http://www.jaspervdj.be/hakyll/">Hakyll</a>. This was mostly because I’m
interested in <a href="http://haskell.org">Haskell</a> (the language Hakyll is written
in) and powering my website with it seemed like a good way to sharpen my
skills. It also uses <a href="http://johnmacfarlane.net/pandoc/">pandoc</a> which is
great and provides a lot of flexibility for input formats.</p>
<p>So now when I get the inspiration to write a post I can just pop open a new
buffer, write some stuff, preview the output locally and push it to the server
whenever I feel it’s ready. My content, all of it, is with me on my computer
at all times. I can write and tweak things without an internet connection and
just push everything out when I do. The same could be said with an local
development environment once it is set up, but that’s the point, there is
little to set up. Once Hakyll is installed you can just work. No databases, or
server to have running (well Hakyll uses the <a href="http://hackage.haskell.org/package/snap-server">Snap
server</a> for previewing, but
it’s not always running, it starts when you need it and shuts down when you
don’t).</p>
<p>It is also very nice to not have to worry about constant security updates. The
attack surface for a static site is, in practical terms, nonexistent. Of
course, you do give up a few things, like built-in search and comments, but
client-side/third-party solutions can provide reasonable replacements.</p>
<p>I’m not going to get into that now as this post is just a bit about <em>why</em>
I moved away from WordPress, but I’ve been happy with the switch so far.
I intend to do a more technical post exploring the <em>how</em> of switching over and
the way things are set up soon.</p>]]></summary>
</entry>
<entry>
    <title>GSoC 2012: Final Report</title>
    <link href="https://doshitan.com/gsoc-2012-final-report/" />
    <id>https://doshitan.com/gsoc-2012-final-report/</id>
    <published>2012-08-19T00:00:00Z</published>
    <updated>2012-08-19T00:00:00Z</updated>
    <summary type="html"><![CDATA[<p>The end has come. Work for Google Summer of Code ends tomorrow and it’s been
a fun ride. I’ve learned a lot and it’s always nice to get paid to work on
something you love. I don’t think any of my SoC work will make it into 3.6
(since UI freeze also happens to be tomorrow), which is unfortunate. But, it
also means that the whole search experience in 3.8 should be improved, instead
of incremental updates.</p>
<p>You can find pretty much all the work I’ve done spread across a few bugs:</p>
<ul>
<li><a href="https://bugzilla.gnome.org/show_bug.cgi?id=640966">Bug 640966 - Favorite applications should have priority when searching</a>
<ul>
<li>This is near-ready, just need a decision what exactly should get priority.</li>
</ul></li>
<li><a href="https://bugzilla.gnome.org/show_bug.cgi?id=681797">Bug 681797 - Switch to a List for Search Results UI</a>
<ul>
<li>Also near-ready, just a matter of how to properly handle keyboard
navigation</li>
</ul></li>
<li><a href="https://bugzilla.gnome.org/show_bug.cgi?id=682050">Bug 682050 - Hide overview elements while searching</a>
<ul>
<li>This one’s a bit more tricky. The current patches on the bug work, but
break the behavior of hiding most of the workspace thumbnails when they
aren’t being utilized (when &lt; 2 workspaces are in use). The best fix is
to refactor the overview into a St.BoxLayout or something similar that
is a lot more automatic/flexible in the layout. I’ve started
experimenting with this and have a basic working version that should be
ready for 3.8.</li>
</ul></li>
</ul>
<p>So a number of things are, for practical purposes, done, but not widely tested
enough to go into a stable product, particularly at the last minute. I’m
comfortable with this, I would rather 3.8 have a solid, cohesive experience
than a 3.6 with some piecemeal patches.</p>
<p>Other work I hope to do in the coming months includes sorting remote providers
in the right order, providing the user a way to pick which search providers
they want enabled, and indicate why a result was returned (highlight terms).
With my fall semester also starting tomorrow though, my time for hacking on
the shell will be greatly reduced. Even so, I think I can still get some
things done and at the very least make sure all the work I did this summer is
in proper shape.</p>
<p>Thanks to all the people who helped me get, and get through, GSoC; in
particular Marina, Rui, and Jasper.</p>]]></summary>
</entry>
<entry>
    <title>GSoC 2012: Report 6</title>
    <link href="https://doshitan.com/gsoc-2012-report-6/" />
    <id>https://doshitan.com/gsoc-2012-report-6/</id>
    <published>2012-08-15T00:00:00Z</published>
    <updated>2012-08-15T00:00:00Z</updated>
    <summary type="html"><![CDATA[<p>This report covers the sixth two week block of coding time, July 30 – August
12.</p>
<h1 id="week-11">Week 11</h1>
<p>Started implementing a new layout for the search results. A simpler list
layout that is less image based than the current grid. See the <a href="https://web.archive.org/web/20120819185611/https://live.gnome.org/GnomeShell/Design/Whiteboards/Search">design
page</a>.</p>
<h1 id="week-12">Week 12</h1>
<p>Finished the new list view and general cleanup before review.</p>
<h1 id="looking-forward">Looking Forward</h1>
<p>The goal is to get stuff reviewed and into master.</p>
<p>(Short post this time, gotta get back to work!)</p>]]></summary>
</entry>
<entry>
    <title>GSoC 2012: Report 5</title>
    <link href="https://doshitan.com/gsoc-2012-report-5/" />
    <id>https://doshitan.com/gsoc-2012-report-5/</id>
    <published>2012-07-31T00:00:00Z</published>
    <updated>2012-07-31T00:00:00Z</updated>
    <summary type="html"><![CDATA[<p>This report covers the fifth two week block of coding time, July 16 – July
29. Getting close to the end folks, just a few more weeks.</p>
<h1 id="week-9">Week 9</h1>
<p>Implemented show/hide methods for the Dash and made use of them while
searching. Started work on treating the workspace thumbnails more like the
Dash, i.e., an element added to the overview on its own, not tied to something
else.</p>
<h1 id="week-10">Week 10</h1>
<p>Finished splitting the workspace thumbnails from the window previews. Added
hide/show methods to ThumbnailsBox that slide the thumbnails out of/in to view
and made use of them while searching.</p>
<h1 id="looking-forward">Looking Forward</h1>
<p>I need to package up all the separate work I have been doing and get it
attached to some bugs for proper review.</p>]]></summary>
</entry>

</feed>
