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
# log the default values: | |
echo "speed_limit_max: `cat /proc/sys/dev/raid/speed_limit_max`" #=> 200000 | |
echo "speed_limit_min: `cat /proc/sys/dev/raid/speed_limit_min`" #=> 10000 | |
echo "stripe_cache_size: `/sys/block/md2/md/stripe_cache_size`" #=> 256 | |
# update to use more RAM (Stripe Cache Size) and higher lower bound (speed_limit_min) | |
echo 100000 > /proc/sys/dev/raid/speed_limit_min | |
# This will result in more memory usage. bumping to 32768 resulted in ~512MB RAM increase. | |
echo 32768 > /sys/block/md2/md/stripe_cache_size |
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
#!/usr/bin/env sh | |
echo "Creating a self-signed certificate..." | |
openssl req -new -newkey rsa:2048 -sha1 -days 3650 -nodes -x509 -subj "/C=US/ST=Georgia/L=Atlanta/O=BNR/CN=localhost.ssl" -keyout config/server.key -out config/server.crt | |
if ! grep -q "\blocalhost\.ssl\b" /private/etc/hosts; then | |
echo "Adding localhost.ssl to your hosts file..." | |
echo "127.0.0.1 localhost.ssl" | sudo tee -a /private/etc/hosts | |
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
# 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
module Root | |
FOO = 'Ayyyy!' | |
end | |
module Root::NotNested | |
def self.speak | |
puts FOO | |
end | |
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
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
select fund_sums.total, fund_products.name | |
from ( | |
select sum(allocation_amount) total, fund_product_id | |
from transactions | |
where transactions.investor_id = 490 | |
group by fund_product_id | |
) fund_sums | |
left join fund_products on fund_sums.fund_product_id = fund_products.id |