Fortune Cookie: 2018-09-04

Adventure is
worthwhile in itself.
LEARN CHINESE - Good luck
好(hǎo)運(yùn)
Lucky Numbers 25, 55, 8, 17, 54, 1

Commentary: Many things have intrinsic value; adventure included. Many things have extrinsic value; aphorisms included.

Grenadine

In my ongoing quest to make delicious alcoholic beverages, I have increasingly found myself digging into my ingredients. Syrups, as a class of ingredient, have received a decent amount of my attention. As an aside, if you're buying simple syrup, you are doing a lot of things wrong. In my experience, it is decidedly tricky to find decent grenadine, where decent is defined as being made with real pomegranate and without high fructose corn syrup or food coloring. So, I've started to make my own:

Grenadine

A pomegranate syrup that adds a sweet tartness to drinks and a distinctive red color. Noteable in small quantities in a great many drinks and also as the second ingredient in a Shirley Temple, a drink the actress was apparently never fond of.

Ingredients

  • 1 cup fresh Pomegranate Juice (~2 large pomegranates)
  • 1 oz Pomegranate Molasses
  • 1 1/2 cup White Sugar
  • 1/16 tsp Xanthan Gum (optional)
  • 1/2 tsp Orange Blossom Water
  • 1 oz over-proof grain neutral spirit (Everclear or vodka)

Read more…

Bash history synchronization

Bash is my go to shell. I've tried fish; I've heard about zsh; but Bash is my go to.

I really like command history (pressing up arrow or Ctrl+R) and there are a few specific behaviors that I want in my history:

  1. If I have multiple terminals open, I want history shared across them.
  2. If I run the same command multiple times, it should be in my history once.
  3. My history should stick around forever.
  4. The last command, I entered should be the first thing I see when I press up arrow.
  5. Race conditions of long-running commands shouldn't erase history entries.

Turns out all of this is a little tricky with bash, but I've mostly managed it:

Read more…

Slowcooker Yogurt

Some jars of homemade yogurt

I have a 14 month old daughter, a wife that likes yogurt with granola, and I kind of like the stuff too. Needless to say, we go through a lot of yogurt in my house. Specifically, we go through a lot of plain, whole milk, greek yogurt.

We were recently visiting my wife's aunt and uncle (my daughter's graunt and gruncle), and we had yogurt most mornings. They use an EasiYo to make their yogurt, which piqued my curiosity.

Fancy yogurt is pretty expensive at the store, upwards of $7 or $8 per 32oz container. Yogurt is just fermented milk and I've fermented plenty of things before. I should be able to make yogurt, right?

So, how about EasiYo? Turns out it's not that much cheaper.

We can do better, let's ask the Internet.

Turns out it's pretty straightforward; I just finished our second batch yesterday. It also turns out to be really good, and it's less than $2 per 32oz (milk choice depending).

Read more…

Let's Encrypt on App Engine

UPDATE: As of September, 2017, Google App Engine will manage SSL certificates for you.


Let's Encrypt is a fantastically convenient way to get SSL certificates for your website without paying a bunch of money or resorting to a self-signed certificate. It's also pretty easy to set up.

Easy as it is to set up, the instructions don't really explain much about setup for App Engine. It turns out to be pretty straightforward.

Read more…

Internet Time Now script

On account of being mentioned by Reply All, I've been listening to back episodes of [TLDR]. Listening to #15 - Internet Time caught my attention and made me aware of Swatch Internet Time. It's kind of impractical but also kind of fun, especially as I've been a little annoyed at recording times across timezones for something meant to persist, like this blog.

For fun, I whipped up a quick python implementation:

import datetime
import decimal

def decimal_time(ts):
    mus_ts = (ts.hour * 3600 + ts.minute * 60 + ts.second) * 1000000 + ts.microsecond
    mus_day = 24 * 3600 * 1000000
    dec_time = decimal.Decimal(mus_ts) / decimal.Decimal(mus_day)
    return dec_time * 1000

def internet_time_now(precision=0):
    precision = int(max(0, min(25, precision)))
    precision = 0 if precision < 1 else int(precision)
    format_len = 3 if precision < 1 else 4 + precision
    format_str = '@{{:0{l:d}.0{p:d}f}}'.format(l=format_len, p=precision)
    it_utc_p1 = datetime.datetime.utcnow() + datetime.timedelta(hours=1)
    return format_str.format(decimal_time(it_utc_p1))

Or, if you don't care about precision:

import datetime

def decimal_time(ts):
    s_ts = ts.hour * 3600 + ts.minute * 60 + ts.second
    s_day = 24 * 3600
    return int(1000 * s_ts / s_day)

def internet_time_now():
    it_utc_p1 = datetime.datetime.utcnow() + datetime.timedelta(hours=1)
    return '@{:03d}'.format(decimal_time(it_utc_p1))

Fixing Nikola Footnote Locations

Personally, I prefer to intersperse my footnote declarations with the text that is being footnoted when writing my. For example:[1]

[1] This is just an example.
I might want to write something[#]_ where there's a footnote there.

.. [#] I put the footnote definition here.

And then I continue on with the rest of my writing.

Wherever they are declared, I prefer to have all of my footnotes appear at the end of my posts. By default, Nikola puts the footnotes in wherever they are declared. A simple snippet of javascript can be used to fix the locations of footnotes:

$(document).ready(function() {
    $('.footnote').each(function(i, el) {
        $(el).appendTo(
            $(el).closest('.entry-content,.entry-summary'));
    });
});

Simply wrap in a <script> tag and include in the BODY_END section of conf.py or add it to your theme.

A Fresh Start

It has been a very long time since I've done any serious work on my website. Now, that changes.

I've migrated all of gwax\.(com|org|net) to Google Cloud infrastructure.

Now, I'm embarking on a thorough site rewrite using Nikola for the static site management.

Bonus: free blogging feature that I probably won't use very much.

Entries from before this point have been dredged from my archives.

American Theism and the Treaty of Tripoli

In modern American political discourse, a great many individuals have been making the claim that America was founded by Christians as a nation built upon Christian morality. Somehow, mind-bogglingly, these claims are made in spite of the existence of the Establishment Clause of the First Amendment to the United States Constitution:

Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof

I was recently pointed to a new argument against the Christian Nation idea in the form of the Treaty of Tripoli, which contains, as Article 11, the text:

As the Government of the United States of America is not, in any sense, founded on the Christian religion,—as it has in itself no character of enmity against the laws, religion, or tranquility, of Mussulmen,—and as the said States never entered into any war or act of hostility against any Mahometan nation, it is declared by the parties that no pretext arising from religious opinions shall ever produce an interruption of the harmony existing between the two countries.

Not that the wingnuts that would make such absurd claims would listen to reason but the Treaty of Tripoli was unanimously ratified by the US Senate and signed into law by John Adams in 1797. That the Treaty of Tripoli dates to 21 years after US independence and 9 years after the US Constitution makes it a pretty clear indicator of both national sentiment and the intent of the founding fathers, what with them still being around and all.

Maybe I should start taking a more militantly atheistic stance to my personal philosophy.