Bash Parsing environment variables with JQ JQ provides this nifty env input that enables you to reference environment variables using the JQ style query syntax. # prints all envs in JSON format jq -n env And you can use piping
Bash Bash capture STDOUT to variable without redirecting Capture CLI to a variable in a bash script without redirecting STDOUT. OUTPUT=$(command --foo "${BAR}" | tee >(cat - >&2))
Bash Search JSON array with JQ JQ is a powerful command-line JSON processing tool. It's super fast (C), provides solid documentation, and is easy to use. In this example, given a JSON object from a file, curl response; we
Bash Iterating over an array of bash variables I had a requirement for a bash script to check for required variables before running a function. Rather than creating a conditional block for each required variable (or in my case, needing to
Ansible Using Ansible templates to maintain partial file blocks Ansible provides some excellent utilities for maintaining single lines and partial blocks of text. Both modules have support for handling template and fact variables, and a variety of options to support your use
Git Delete multiple git branches matching a prefix Important: this is a potentially destructive command. Please proceed cautiously and at your own risk. I'll sometimes leave local git branches around a bit longer than I should. And, depending on your workflow,
Gearman Install PHP 7 on Ubuntu 14.04 with Gearman support PHP 7 has been out long enough now that it has seen a couple of patch releases, which is about the time I will start evaluating an upgrade. PHP 7 can have some
Bash Bash completion for Consul nodes on Ubuntu After making the jump to Ubuntu as my preferred distribution, I've admittedly become addicted to bash completions (aka autocomplete, tab completion, typeahead). Bash completions provide immediate hints for common commands, and even the
SSL OpenSSL CSR generation in a single command If you need to generate a CSR, OpenSSL has a helpful prompt interface for completing the required fields one at a time. However, if you are using automation, collecting STDIN is not always
Nginx Transport security for HTTP/2 protocol with Nginx With Google sunsetting the SPDY protocol, and broad support for HTTP/2 shipping with most modern browsers, I began investigating moving our SPDY support over to HTTP/2. Nginx recently released official support
Ansible Meaningful hostnames with Ansible Like anyone who spends a good deal of time in a terminal window, switching between machine instances is fairly commonplace. I keep a persistent tmux session open to manage a handful of connections.
PHP Globally install Composer on OS X 10.11 El Capitan Update: this also works as expected with macOS Sierra. The El Capitan release of OS X introduces a more strict security model around the concept of root level access to the underpinnings of
PHP Alias a version for Composer I previously published instructions on using a specific commit hash for Composer. This is a quick and useful way for referencing the most recent version of our work during the development process. In
AWS Multiple SSL domains on AWS ELB with Nginx Is it possible to serve multiple domains (each with a unique SSL certificate) via HTTPS behind a single load balancer on AWS? Yes you can; with TCP and Proxy Protocol. Proxy Protocol allows
JavaScript Logging client-side JavaScript errors JavaScript interaction is not usually an option for most modern websites (try accessing some of your favorite sites with JavaScript disabled). Given the matrix of browsers, devices, software versions and extensions, exhaustive testing
PHP GZIP BSON in MongoDB with PHP or Node.js I recently needed to store a large number of files (300M, 3-4TB GZIP) on a distributed number of systems, while maintaining index information about each file in MongoDB. Accessing and modify large blocks
PHP PHP 5.6 on Ubuntu 14.04 with PPA PHP 5.6 has been in the wild for about a month now. As of October, the major version has received its first patch release 5.6.1 to address several bugs detailed
Apache Removing response headers with Apache Some applications will set erroneous headers that have little to no value to the client. In some cases the header may even pose a security risk by exposing environment/version information. In the
PHP First look: Ubuntu Server 14.04 LTS I'm always excited to kick the tires of a new supported release (LTS) of Ubuntu. In most cases I will be using the LTS image for 2-3 years to come, possibly longer. Stateless
Apache Limiting access to ProxyPass Apache resources The Apache Directory directive allows you to limit access to particular routes, ports, etc. for virtual hosts. However when we are proxying requests, directory path permissions are irrelevant. To limit access to proxied
PHP Using a specific commit hash for Composer The way Composer handles versioning with package links is incredibly flexible for managing dependencies in the various stages of development. If we are releasing updates to a shared library or service, we may
PHP PHP one-line optimizations with Apache on Ubuntu There are a couple changes I immediately make to the default php.ini configuration when setting up an application server. Before making any modifications, we should backup the package maintainer's version of the
Apache Enabling http proxy module in Apache on Ubuntu The Apache proxy module is disabled by default in Ubuntu. Having unused modules enabled has both performance and security implications. That said, in this example we are using: Apache 2.2 Ubuntu 12.