Pluggable Authentication With PAM

Authentication and authorization is one of foundational aspects of any security system. However writing an authentication and authorization system can be anything but: There are complex, ever-changing requirements, not to mention differences for differing interfaces it can quickly become daunting. However, there already exists a system on Linux and Unix that allows for dynamic and complex authentication: PAM. PAM Modules and Authentication Types Fundamentally, PAM is a collection of modules that provide several methods....

May 14, 2017 · 3 min · 444 words · Robert Underwood

Resource Acquisition is Initialization and SDL

Recently, I was working on a project for 2D Game Development where I had to use SDL 2.0. SDL 2.0 is a family of media libraries designed for writing cross platform games in C. However it can be difficult to remember where various resources are allocated and deallocated. Resource Acquisition is Initialization (RAII) is a common pattern in C++ programming that solves this problem. So I wrote a series of wrappers for SDL 2....

May 8, 2017 · 3 min · 564 words · Robert Underwood

Smart Pool

Object Pools are a commonly used pattern used in operating systems, game, and high performance computing development. However just as it can be easy to forget to return a pointer to memory, it can be easy to forget to return the memory to the pool. In this article, I layout a class that I recently used to automatically manage memory from a pool. The template pool class has 4 parts: an onEmpty policy, an allocation policy, a reset policy, and an object proxy....

April 30, 2017 · 3 min · 581 words · Robert Underwood

Surprisingly Functional

Functional programming is a surprisingly useful programming paradigm. The best aspects of functional programming have this odd habit of showing in places you would never expect. The Shell and Endomorphisms Arguably one of the most powerful features of the Unix shell is the pipe. It is one of the core building blocks of the Unix philosophy of many small tools working together each doing one thing well. However, long before Unix, the idea of the endomorphisms was developed....

February 23, 2017 · 3 min · 632 words · Robert Underwood

Faster than light

Ansible is probably my favorite provisioning and configuration management tool. Its syntax is concise, expressive, and elegant. Unlike other tools in its category, it has excellent documentation with working examples and intuitive naming. Learning it use it effectively can help you be a more productive developer. Speeding Up Ansible Anyone that has used ansible for more than a few hosts with more than a few tasks knows that by default it can be really slow....

January 29, 2017 · 3 min · 580 words · Robert Underwood

LLVM Tooling for C++

C++ is a both a fantastic language and a mess. It supports at least 4 programming paradigms (procedural, functional, object-oriented, template meta-programming). In some senses, many languages give you one great way to do things: C++ gives you every way and trusts you to use them well. With this flexibility comes problems that C++ seems to have beyond what other languages experience. Therefore, having effective tooling to develop and use C++ is essential....

January 22, 2017 · 3 min · 627 words · Robert Underwood

Interpreters Made Easy

The Interpreter pattern from the “Design Patterns: Elements of Reusable Object Oriented Software” can potentially be a very powerful pattern. It allows you to use a domain specific language to represent a complex computational situation. However, writing interpreters in practice can be tricky and time consuming. It really helps to know something about some fundamental parsing algorithms and techniques. The most naive approach to writing an interpret involves manually matching each possible next phrase and creating an if else soup to match each possible outcome....

January 15, 2017 · 3 min · 580 words · Robert Underwood

Poor Man's Parallelism

I really like orchestration tools such as Ansible or SaltStack. They can make running tasks on a group of machines a breeze. But sometimes you can’t or don’t want to install these tools on a machine. In cases like these, it is helpful to know how to parallelize some tasks in the shell. You can do this via Unix/shell job control: cmd="systemctl enable --now docker.service" hosts=(host{1..4}) for host in ${hosts[@]} do ssh & $host $cmd done However from experience, this can be very error prone....

January 8, 2017 · 3 min · 462 words · Robert Underwood