This is a picture of me, Andrew Forward Deliver Early; Often.

Test-driven development, infrastructure as code, manage, design, development, automate and continuous everything. I don't often blog, but when I do, I reach for Markdown.

Installing a specific version of DBT (using Python / PIP)

A nice little script for getting the extract correct DBT installed on your system.

python -m pip install --upgrade pip setuptools wheel --no-cache-dir
python -m pip install --upgrade dbt-core==1.5.3

(Note that you might need to call python3)

Read article Installing a specific version of DBT (using Python / PIP)

Spacecat

Learning to draw is a slow process, but it is about the journey right!

Spacecat

Read article Spacecat

A new blog for 2023

It has been 2 years since I re-worked my personal website anunknown.dev, and the previous version was on cloud hardware and I have recently been using fly.io for small project development, so I decided for a re-work.

Read article A new blog for 2023

Automating 1Password CLI with --session

In a our previous post, we looked at generating a 1password session without requiring user input. Today we will look at generating a one-time (30-minute) token on your local machine and only sharing that with your build servers.

op get item db_password --session $(cat opsession)
Read article Automating 1Password CLI with --session

I don't like the name *unit tests*.

I think it leads to arguing along the lines of hey this isn't a unit test.

I prefer to focus on three qualities of good automated tests

  • Fast (or non-slow)
  • Sturdy (or non-brittle)
  • Isolated (or non-coupled)
Read article I don't like the name *unit tests*.

Generating Globally Unique IDs

Imagine you are building a system to assign unique numbers to each resource that you manage. You want the IDs to be guaranteed unique i.e. no UUIDs. Since these ids are globally unique, each id can only be given out at most once.

Here is a summary of my solution.

def handle_call(:get_id, _from, %{node_id: node_id, counter: counter} = state) do
  <<id::size(64)>> = <<node_id::10, timestamp()::47, counter::7>>
  {:reply, id, %{state | counter: counter + 1}}
end
Read article Generating Globally Unique IDs

The Code I Didn't Write

I enjoy reading job listings. There's the "what's trending" angle to see the types of skills that appear to be in bemand. There's the pyschological angle where we as the reader get a peak at what a company values (or doesn't value) when it comes to hiring and employees.

Read article The Code I Didn't Write

Connecting to AWS using SAML

In this article we will connect to our AWS account using SAML, this will allow us to run AWS CLI commands using the same authentication as you use in the browser.

Once complete, you will be able to run

saml2aws login -a 10xdev

An and then have a (configurable) 12 hour session to from the command line.

Read article Connecting to AWS using SAML

HackerRank Template in Elixir

Here's a template for answering HackerRank in Elixir. This is based on the Two Character question

defmodule Solution do
  def go() do
    num = input(:int)
    text = input(:string)
    IO.puts("INPUTS #{num} and #{text}")
  end

  def input(:string), do: IO.read(:line) |> String.trim()
  def input(:int), do: input(:string) |> String.to_integer()
end

# Now run your code
Solution.go()

Now go forth and HackerRank!!!

Read article HackerRank Template in Elixir

Getting Started With ChefDK

I am getting back into Chef, and the landscape seems to have changed quite a bit in the last 10 years. I am going to documenting the journey in a series of bite sized articles.

Official install docs are here. So follow them, and read along.

Read article Getting Started With ChefDK

LiveView storing Session Data on Redirect

This article is based on a very early version of LiveView and is here for historical purposes only.

How can you have your LiveView login form update the user's session across pages?

Adding authenticated user to flash

Read article LiveView storing Session Data on Redirect

Run Custom JS on LivePage Reload

This article is based on a very early version of LiveView and is no longer the right way to run Custom JS code.

In your LiveView LEEX, you can add a script tag and append a @tick to the id. This will force for the MorphDOM differ to always re-render (aka re-run) that code on the client.

Create a script with tick ID

Read article Run Custom JS on LivePage Reload

Kent Beck's "Beauty In Code"

Highlights of Kent Beck's 'Beauty In Code'

We are first teased that the talk was intended to be about "the use of symmetry in coding", as I believe symmetry is a great way to help drive you towards cohesion and aligning the abstractions.

Read article Kent Beck's "Beauty In Code"

Setting up Mailgun on Digital Ocean

Not having to manage an email server is awesome, thank you Mailgun. I am currently integrating with Digital Ocean and ran into some documentation confusion with DNS records, especially when trying to configure for a subdomain.

This article combines a few sources to finally get a working solution for sending/receiving emails on Digital Ocean via Mailgun.

Read article Setting up Mailgun on Digital Ocean

Continuous Testing with Elixir

There is great power in having your tests always run, all the time when writing code, it stops the minor interruptions.

$ mix test.watch

Running tests...
..................................................
..................................................
....
Finished in 0.04 seconds (0.04s on load, 0.00s on tests)
104 tests, 0 failures
Randomized with seed 386800
Read article Continuous Testing with Elixir

Simple encryption in Elixir

Of course you don't know anyone that actually stores user passwords in plaintext, or database passwords directly in a repository, so this is more for those theoretical developers to provide them with just a little bit more security; without adding much more complexity.

# Encrypt a password and store it in pwd
iex> pwd = Safetybox.encrypt("helloworld")
"fc5e038d38a57032085441e7fe7010b0"

# Later on, you can validate the user provided password
# against the encrypted stored password
# Oopses, not the same
iex> Safetybox.is_decrypted("goodbyeworld", pwd)
false

# Ok, validated!
iex> Safetybox.is_decrypted("helloworld", pwd)
true
Read article Simple encryption in Elixir

A simple web crawler in Golang

An exploration of the Go language (golang) to build a simple webcrawler, all code is available on Github. This application was written as an exploration of the language and demonstration of the various features of the language; it is not feature complete but should be complex enough to provide some examples of using Go's various concurrent features, tied together in a simple command line and web interface.

List

Read article A simple web crawler in Golang