Engineering Principals I Borrowed from a Cocktail Book

I’ve recently been reading the book Liquid Intelligence by Dave Arnold. It’s an excellent book that you should read if you have any interest in cocktails. In the first section of the book, he has a set of principles that he applies to making cocktails that I’ve slightly adapted for technology and engineering and posted below.

  • Use new techniques and technologies only when they make the application better.
  • Strive to make an amazing application with fewer rather than more components.
  • Don’t expect a user to know how you made an application in order to enjoy it.
  • Gauge success by whether your user keeps using your application, not whether they think the application is “interesting”.
  • Build and follow your tastes.

I like these because they aren’t absolutes but a good set of guidelines to help inform you and shape your direction. It’s a good set of bullet points that I will keep in mind when building new systems.

Introducing Varna: Cheap, Easy & Quick AWS CloudTrail Monitoring

Varna is a tool that is meant to monitor AWS CloudTrail logs with support for custom rules while remaining easy to deploy and cheap to run. Varna uses Event Query Language (EQL) as its query language of choice for writing rules in. EQL has some nice advantages over existing languages in the support for sequences of events which can be invaluable for security rules which may have preconditions. In addition, EQL has a rich library of functions that make it well suited for complex rules.

Varna is an AWS Lambda and a DynamoDB table that are meant to be quick to deploy and minimally invasive. The code is actually small enough that it can be reviewed by hand in a couple of hours. Varna uses Zappa to handle the bundling and deployment of Varna. This means that Varna can be deployed in under 5 minutes with very little changes to an existing AWS account.

Varna uses the CloudTrail logs that are written to an S3 bucket as the primary source of events. This means the only state that Varna maintains is a DynamoDB table of alerts that have been raised from triggering the rules. This means that Varna is cheap to run because it has minimal fixed costs.

Varna has several features that make it attractive for usage as an AWS account security tool. Varna uses signals from the S3 bucket where CloudTrail log files are being dropped to process log files as quickly as possible. This allows Varna to quickly process rules over new events as they happen and then deliver notifications to the administrator. Varna sends alerts via two methods, email or slack. In addition, Varna will deliver a periodic alert at a user defined interval to remind them about alerts they may have missed.

Varna also includes past search. This can frequently be used to shed light on what was happening around an event. Both the web interface and the command line script allow the administrator to run EQL queries over previous time windows. In the latest release, Varna can also be protected to only allow access by specific users via authentication.

Varna comes with a small suite of preexisting EQL analytics. These are meant to be tuned to an individual account and may not be suitable for any individual account. All of these are meant to be high signal alerts that indicate potentially dangerous actions that can be undertaken in an AWS account. Combined with the built in notification methods, this can be a quick means of detecting suspicious behavior for a cheap monthly cost while maintain rich customization.

You can check out Varna at

2019 Book Review

A full list of books that I read this year are below but I wanted to really highlight four books I read this year that are excellent.

The Death and Life of the Great Lakes by Dan Egan

This was my top pick of the year, it’s a wonderful book by Dan Egan about the ecological history of the Great Lakes. It’s well told and remains clear but contains all the details you want to know about the story. The authors personal passion also plays into the story and it serves highlight the role that the lake plays on the communities that surround it.

When Einstein Walked with Gödel: Excursions to the Edge of Thought by Jim Holt

Not every essay in this book is going to make you set it down and think after you read it but quite a few will such that it takes a while to read this book. This book wanders all over the map but contains a number of scientific essays that drive insightful points home. This is such an excellently curated collection of essays that it’s a recommend read for almost any individual who has an interest in modern science.

Fentanyl, Inc.: How Rogue Chemists Are Creating the Deadliest Wave of the Opioid Epidemic by Ben Westhoff

Ben Westhoff is a gifted writer who has a talent for getting incredible sources to talk to him about the subject material and this book is no exception. The background is well covered and detailed while not becoming tedious. This is the best written history of both the drug crisis but also covered the very important aspects of how internet and shipping has changed the nature of the industry dramatically.

Exhalation by Ted Chiang

This book is an excellent collection of short science fiction stories. The stories are thoughtful stories and I’m reluctant to write more because I think they should be approached with no connotations. The book is very short and is an enjoyable afternoon read.

Full List of 2019 Books

  • May We Suggest: Restaurant Menus and the Art of Persuasion
  • Dreamland: The True Tale of America’s Opiate Epidemic
  • The Black Swan
  • The Trade: My Journey into the Labyrinth of Political Kidnapping
  • Zeitoun - Dave Eggers
  • Adam Smith: Father of Economics
  • Who Gets What—and why
  • Thinking in Systems: A Primer
  • The Innovator’s Dilemma: When New Technologies Cause Great Firms to Fail
  • The Grasshopper
  • On Scandinavia: The almost nearly perfect people by Michael Booth
  • The Feather Thief
  • Prohibition: A Concise History
  • The Death and Life of the Great Lakes
  • When Einstein Walked with Gödel: Excursions to the Edge of Thought
  • Big Dead Place: Inside the Strange and Menacing World of Antarctica
  • An Economist Walks into a Brothel, and Other Unexpected Places to Understand Risk
  • Randomistas: How Radical Researchers Are Changing Our World
  • Extreme Makeover: A Novel by Dan Wells
  • Stubborn Attachments: A Vision for a Society of Free, Prosperous, and Responsible Individuals
  • Building Successful Online Communities: Evidence-Based Social Design
  • The Dawn of Eurasia: On the Trail of the New World Order
  • How Asia Works
  • On Freedom by Cass Sunstein
  • Opt Art: From Mathematical Optimization to Visual Design
  • Fentanyl, Inc.: How Rogue Chemists Are Creating the Deadliest Wave of the Opioid Epidemic
  • Open Borders: The Science and Ethics of Immigration
  • The Fifth Season / The Obelisk Gate / The Stone Sky by N. K. Jemisin
  • The Craft Sequence By Max Gladstone
  • Axiomatic By Greg Egan
  • Exhalation by Ted Chiang
  • Broken Stars by Ted Liu

Returning Records Efficiently in OCaml

One of my coworkers recently taught me this great syntactic trick for saving records in OCaml. Frequently I have a record with 4-6 fields that is managing the state of a process or request and I want to write a function to update only one of those fields. Let’s assuming the following is our record.

type test_record = {
  field1 : int;
  field2 : string;
  field3 : int option;
  field4 : string list;

Now we want to update an instance of this to set field1 to a new value. Here is the quick way to update a single field.

let update_one_thing (r : test_record) =
  let field1 = do_something_here r.field1 in
  { r with field1 }

I find this much easier to read and write than the other method. I don’t know why I don’t see this in more code so hopefully more people start to use it.

Hello World

I suppose this is a bit of a test and attempt to start writing more blogs again. I’ve had a blog for a while but it has to be manually deployed via cli tools which is slightly a pain. My hope is that this blog which can be edited online will inspire me to write more posts. I’ll try and drop everything here from tool releases, quick tips for stuff I’m working, or maybe more long form thoughts on how computers were absolutely and completely a mistake.