Configure VS Code to run OCAML a Mac OSX

August 30, 2020

Let’s get up and running with OCaml and VS Code on a Mac.

VS Code up and running with OCaml

Automating 1Password CLI with –session

August 28, 2020

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)

Bootstrapping 1Password CLI using Expect

August 27, 2020

Did you know 1Password has a CLI tool? In this article we will write a small script using expect called opsession to better manage secrets in our automation pipeline. Using opsession you can then use 1password op commands like

op get item db_password --session $(opsession)

Without having any user intervention.

Verifying .pkg files on a Mac (using Go)

August 22, 2020

I have been looking at using 1Password’s CLI tool to better manage secrets on the terminal. 1Password strongly recommends you verify your download.

Verify Mac Package fingerprint

I decided to write a small shapkgsum script in golang to make that verification easier to automate.

I don’t like the name unit tests.

Jul 10, 2020

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)

Generating Globally Unique IDs

May 29, 2020

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}}

git rebase -i HEAD\~25

Oct 11, 2019

Andrew Forward's talk on git rebase -i HEAD~25 at WebCamp Zagreb

WebCamp Zagreb 2019 was great. Here’s areview of my talk on time travel and git rebase.

Thank you to the organizing committee of Web Camp Zagreb, everything was amazing.

The Code I Didn’t Write

July 6, 2019

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.

Installing Packer For Image Creation

June 19, 2019

After you install Golang, it’s easy to install Packer from source.

mkdir -p ~/src && \
  cd ~/src && \
  git clone && \
  cd packer && \
  make dev

LiveView Talk at Empex 2019

May 18, 2019

My talk at Empex 2019 is Live(View). Click on Read More to get the links to related articles and GitHub Repos.

Andrew Forward's talk on LiveView at Empex 2019

Connecting to AWS using SAML

May 29, 2019

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.

Phoenix LiveView Examples

May 29, 2019 (originally posted May 18)

LiveView for Phoenix on Elixir is definitely scratching an itch in the world of rich client apps, without having to go full-on client-side framework. Here’s a list of open source projects, some with online demos and other where you can (easily) run the code locally.

Screenshot Description References
Empex Display Manipulating a SVG graphic for the 2019 Empex NY conference Empex SVG Demo <br> Empex SVG Source

HackerRank Template in Elixir

May 27, 2019

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}")

  def input(:string), do: |> String.trim()
  def input(:int), do: input(:string) |> String.to_integer()

# Now run your code

Now go forth and HackerRank!!!

Getting Started With ChefDK

May 22, 2019

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.

LiveView storing Session Data on Redirect

May 21, 2019

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

Adding authenticated user to flash

Run Custom JS on LivePage Reload

May 20, 2019

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

Falco “From 0% to 100% tested code”

May 15, 2019

Highlights of Llewellyn Falco - From 0% to Cleanly Refactored 100% tested code

Gives you some legacy code to practice.

The video goes through the Gilded Rose Kata to add the following feature.

Oh, the API Clients You’ll Build (in Elixir)

November 27, 2017

Oh, the API Clients You’ll Build (in Elixir)

Today we are going explore how to write API clients in the Elixir language. This is a follow-up article to my presentation at OpenCamps 2017.

Yet Another Digital Ocean API client in Elixir

July 28, 2017

Want to automate your infrastructure leveraging the awesome Digital Ocean API V2, then the shell is your friend. Here we will learn about how to access the API from the command line using Elixir’s Escript tooling.

doex API for digital ocean on hex

Setting up Mailgun on Digital Ocean

Dec 3, 2015

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.

Continuous Testing with Elixir

Dec 2, 2015

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

$ mix

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

Simple encryption in Elixir

October 24, 2015

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")

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

# Ok, validated!
iex> Safetybox.is_decrypted("helloworld", pwd)

A simple web crawler in Golang

June 7, 2014

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.


Running OCAML on UOttawa VCL

August 30, 2020

Let’s get up and running with OCaml and the Ontario Reasearch & Education VCL Cloud. Visit the VCL Cloud and create a new reservation for CentOS7Basev3_EmacsOpam. Once ready, then you can SSH into your devbox and access OCaml.

Login Instructions