Category Blogumentation

Performing a No-Op with chef-client using JSON

How to perform a chef-client run without executing anything.

Using git worktree to have multiple branches checked out at once

How to use git worktree to check out multiple Git branches from the same repo at once.

Using Git refs to check out GitHub Pull Requests, from your local repo

How to pull the Git refs for Pull Requests to your GitHub repo.

Using Git refs to check out GitLab Merge Requests, from your local repo

How to pull the Git refs for Merge Requests to your GitLab repo.

Using Git refs to help track your GitLab Environments, from your local repo

How to pull the Git refs that GitLab Environments exposes in your GitLab repo.

Performing Code Review on Your own Merge/Pull Requests

Why the first step to getting others to review your code is to review it yourself.

Automating Promotion of Jekyll Posts from Draft to Post

The handy script I've created to automate publishing a draft in Jekyll, with handy Zsh + Bash autocomplete.

Pretty Printing JSON using Node.JS on the Command Line

Using Node.JS's JSON module to pretty print JSON objects from the command line.

Converting X.509 and PKCS#8 .pem file to a JWKS (in Node.JS)

Converting X.509 and PKCS#8 files to JWKS format, using the node-jose library.

Using git commit --fixup= to track changes that need to be applied on top of another commit

Using git commit --fixup= and git rebase --autosquash to easily track and squash fix commits.

TYKJS Middleware Gotcha When Base 64 Decoding Data

How to workaround the Failed to base64 decode: illegal base64 data at input byte error when trying to use b64dec in TYKJS middleware.

Unit Testing Your TYK (TYKJS) Middleware

Writing unit tests (in this case using Jasmine) for the TYK API Gateway's JavaScript middleware functionality.

How to run tests from the ChefDK in Docker

How to get up and running with the ChefDK to perform common tests, such as unit tests and linting.

Using Fake Cookbooks for Writing ChefSpec Tests for your Custom Chef Resources

A directory structure I've found quite useful for writing ChefSpec tests for custom resources, by creating a fake cookbook within the cookbook you're testing.

Creating a versionable, self-contained (fat-/uber-) JAR for Gatling tests

Why you'd want a fat JAR for your Gatling tests and how you'd achieve it.

Tweaking Gatling HighCharts Response Time Bounds

How to configure the bounds that Gatling marks your response times within for console output and graphing purposes.

Setting your default AWS profile for the AWS CLI and SDKs

Setting the default AWS profile when working with multiple profiles and the AWS CLI / SDKs.

Chef 14 Upgrade: Custom Resource Properties are Silently Coerced to Hash if they are a nil

Finding out that a nil gets silently coerced to an empty Hash if given to a custom resource's property of type Hash.

Chef 14: ChefSpec Coverage Reporting Deprecation

Noting the deprecation of using ChefSpec::Coverage.start! when using Chef 14 and above.

Chef 14 Upgrade: Change in ValidationFailed error messages when setting required properties

The updated error message returned by a Chef ValidationFailed error, when you're specifying which properties are required on a custom resource.

Viewing X.509 DER Certificate Details with OpenSSL

How to convert an X.509 DER file to a human-readable format using openssl commands.

Viewing X.509 PEM Certificate Details with OpenSSL

How to convert an X.509 PEM file to a human-readable format using openssl commands.

Backporting/Replaying Changes Using git cherry-pick

Using git cherry-pick to make it easier to backport or replay Git commits across different versions of your codebase.

Showing response headers with curl -i

Showing just response headers when curling a resource, using curl -i.

Safely Force Pushing with Git using --force-with-lease=ref

How git push --force-with-lease=ref can save you from overriding others' changes on shared Git branches.

My editorial workflow for blog posts

Taking you through the journey I go on when writing blog posts, from ideation to publishing the post.

Viewing Git history of a file in git log while ignoring file renames

How to track changes to files in Git without pesky file renames getting in the way, using git log --follow.

Test-Driven Chef Cookbook Development Using ChefSpec (and a sprinkling of InSpec)

Using the example of deploying and running a Java JAR file as a way to show the lifecycle of a fully test-driven Chef cookbook.

Pretty Printing JSON Web Tokens (JWTs) on the Command Line using Ruby

How to easily introspect and pretty print a JWT on the command line using Ruby's standard library, or using the ruby-jwt external library.

Using chef-shell to interactively debug attributes and recipes

How to use chef-shell to see attribute config and recipes, with and without a Chef Server.

Creating a versionable, self-contained (fat-/uber-) JAR for Cucumber tests

Why you'd want a fat JAR and how you'd achieve it.

My Path from School to University to Work

A look back at my journey up to now, the choices I've made, and what advice I have for others who are embarking on their own journeys into tech.

Pretty Printing JSON on the Command Line with Ruby

Using Ruby's JSON module to pretty print JSON objects from the command line.

Merging multiple repositories into a monorepo, while preserving history, using git subtree

How to merge multiple repositories, with their history, into a single repository, using the git subtree add command.

Better Git Diff Outputs with Git Submodules

How to get nicer diffs when working with submodules.

Sharing Multiple SSH Sessions over the Same Network Socket

Reusing network sockets for speed and reduction of authentication handshakes with OpenSSH.

Beware: deleteing a file in Chef doesn't actually delete it

Why you should explicitly add backup false when deleteing a file through Chef, to avoid leaving potentially sensitive files still on the box.

Executing an Interactive Python Shell (REPL) for a Script

Using python -i to get an interactive REPL after running a Python source file.

Running docker login as another user in Chef

Hitting the error permission denied while trying to connect to the Docker daemon socket when trying to run docker login as a non-root user in Chef.

Chef 13 Upgrade: knife-cookbook-doc Rubocop Updates

Disabling the Missing space after # and Do not use block comments errors for your knife-cookbook-doc formatted comments.

Chef 13 Upgrade: Deprecation of Namespace Collisions in Custom Resources

Preparing for breaking changes in Chef 14 by renaming property_name to new_resource.property_name in Custom Resources.

Chef 13 Upgrade: knife-cookbook-doc gem upgrade

Fixing odd Logger entries in autogenerated knife-cookbook-doc README.mds for Chef 13.

Testing Chef's ruby_blocks with ChefSpec

Testing implementation of a ruby_block in ChefSpec, to ensure that the code executes as expected.

Verify a Ruby Class Method is Called with Arguments in Rspec, Without Doubles or Mocks

Rspec code to verify that a Ruby Class Method is called from another method, without needing to mock anything.

Chef 13 Upgrade: Lessons Learnt and Documented for Posterity

Notes on the main problems encountered when upgrading from Chef 12 to Chef 13, both with ChefSpec and Rubocop.

Chef 13 Upgrade: Rubocop Changes for Testing render_file with ChefSpec and a with_content Block

How to resolve the Parenthesize the param render_file Rubocop error when upgrading your cookbook to Chef 13.

Chef 13 Upgrade: Rubocop Changes for Word Array Literals (%w)

A one-liner shell command to fix Rubocop errors %w-literals should be delimited by [ and ].

Chef 13 Upgrade: Rubocop Changes for lazy Parameters

How to resolve the Parenthesize the param lazy Rubocop error when upgrading your cookbook to Chef 13.

Chef 13 Upgrade: Testing ruby_blocks with ChefSpec

Replace your block.old_run_action with block.block.call to trigger ruby_blocks within ChefSpec 7 and Chef 13.

Emoji Support in Dunst

How to see Emoji when using the Dunst notification system.

SSLError When Running Berkshelf Behind a Proxy

Getting around the pesky OpenSSL::SSL::SSLError SSLv2/v3 read server hello A error when running Berkshelf behind a proxy.

Running service resources in Kitchen-Docker

How to get up and running with service resources when running Test Kitchen with the Docker driver, in this example for use with GitLab CI.

Trusting Self-Signed Certificates from the Chef Development Kit

How to get the ChefDK (and associated tools) to trust internal / self-signed certificates, in an easy oneliner.

Getting around Permission Denied when running ChefSpec

How to handle getting an EACCES when trying to run ChefSpec on a recipe.

Testing include_recipes with Chef and ChefSpec

How to best test include_recipes within your Chef recipes, as well as how to ensure that you aren't running any dependent recipes in your tests.

Converting YAML to JSON and vice versa (Part 1 - Ruby)

Coerce YAML to JSON and vice versa, from the comfort of your Gem-studded command line.

Clean up your Git branches

Remove any merged local or branches from your local Git repository.

Pretty Printing JSON on the Command Line with Python

Using Python's JSON module to pretty print JSON objects from the command line.

Viewing your diff while writing your commits with git commit --verbose

Making it easier to write commit messages by having the diff in your editor.

Extracting SSL/TLS Certificate Chains Using OpenSSL

A quick one-liner to get you the full certificate chain in .pem format.

glances, a top and htop replacement

I share the tool I have been using for system utilisation and monitoring, glances.

Saving Repetition with Git Commit Templates

Speed up your commit message writing by providing a template for when you run git commit.

Cleaning Up Your LaTeX Build Output with latexrun

A tool to help reduce the amount of unnecessary output when building LaTeX files.