This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BASE_ENV_VAR="value for base" | |
# Set a value specific to you in your .env.local | |
OTHER_ENV_VAR= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if grep 'pam_tid.so' /etc/pam.d/sudo --silent; then | |
echo "TouchID is already enabled ✅" | |
else | |
echo "Enabling TouchID for sudo 🪪"; | |
sudo sed -i -e '1s;^;auth sufficient pam_tid.so\n;' /etc/pam.d/sudo | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Example | |
class Config | |
def initialize(host_env: ENV, rails_env: Rails.env) | |
@host_env = host_env.to_hash | |
@rails_env = rails_env | |
end | |
def admin_qa_tooling_enabled? | |
coerce_boolean(host_env.fetch("ADMIN_QA_TOOLING", "false")) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'active_support' | |
require 'active_support/core_ext/object/blank' | |
require 'active_support/core_ext/time' | |
class DateRange | |
attr_reader :start, :stop | |
def initialize(start: nil, stop: nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# So… uuuh… what had happend was - I'd changed our `.rspec` config so that we | |
# could have isolated specs. The only real change was to not auto-require | |
# `rails_helper` in the `.rspec` config. Instead we auto-require `spec_helper`, | |
# and then files that need `rails_helper` (to boot rails) will have to add | |
# `require 'rails_helper'`. | |
# | |
# I didn’t think much of it b/c I’d noted that the specs I’d been looking at | |
# were already doing `require 'rails_helper'`, so it should be a no-op for | |
# them. It turns out, 700 or so other spec files ARE NOT already requiring | |
# `rails_helper`. So… what does one do when confronted with needing to in-place |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Telemetry.configure do |c| | |
c.component = ENV.fetch("COMPONENT_NAME") | |
c.environment = ENV.fetch("APP_ENV") | |
c.deployment_environment = ENV.fetch("DEPLOYMENT_ENVIRONMENT") | |
c.honeycomb_api_key = ENV.fetch("HONEYCOMB_API_KEY", nil) | |
c.honeycomb_dataset = ENV.fetch("HONEYCOMB_DATASET", nil) | |
# This is delegating through to `OpenTelemetry::SDK::Configurator#use_all` | |
c.use_all("OpenTelemetry::Instrumentation::Sidekiq" => {span_naming: :job_class}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Observability | |
gem "opentelemetry-sdk" | |
gem "opentelemetry-exporter-otlp" | |
gem "opentelemetry-instrumentation-all" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# shellcheck disable=SC2059 | |
set -euo pipefail | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
NO_COLOR='\033[0m' | |
CLEAR_LINE='\r\033[K' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "ostruct" | |
# A wrapper around a single ERB template that will bind the given Hash of values, | |
# making them available as local variables w/in the template. | |
class ErbNow < OpenStruct | |
# Render a given ERB +template+ string, binding the entries in the given +attrs+ Hash | |
# as local variables in the template, with the key as the variable name. | |
# | |
# @example | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# shellcheck disable=SC2059 | |
set -euo pipefail | |
# Toggle all currently 'Active' network servcies (e.g., Wi-Fi, Ethernet | |
# connections, etc...) to "restart" them. We'll ignore any already 'Disabled' | |
# services, and toggle all of the others to 'Disabled' and then back to | |
# 'Enabled'. This has been found helpful when your VPN won't re-connect after | |
# undocking and re-docking your MacBook, for example. |
NewerOlder