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
class ApplicationController < ActionController::Base | |
# ... | |
private | |
def append_info_to_payload(payload) | |
super | |
payload[:user_id] = current_user&.id | |
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
events: | |
ignore: | |
- !ruby/regexp '/(send_file|redirect_to|halted_callback|unpermitted_parameters)\.action_controller/' | |
- !ruby/regexp '/(write_fragment|read_fragment|expire_fragment|exist_fragment\?)\.action_controller/' | |
- !ruby/regexp '/cache_(read|generate|fetch_hit|write|increment|decrement|delete|cleanup|prune|exist\?)\.active_support/' | |
- !ruby/regexp '/cache_(read_multi|write_multi|delete_multi\?)\.active_support/' | |
- !ruby/regexp '/^render_(template|partial|collection)\.action_view/' | |
- !ruby/regexp '/sql.active_record/' | |
- !ruby/regexp '/process.action_mailer/' | |
- !ruby/regexp '/(service_upload|service_download)\.active_storage/' |
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
# config/initializers/honeybadger.rb | |
Honeybadger.configure do |config| | |
config.before_event do |event| | |
if (environment = ENV["HONEYBADGER_ENV"].presence || ENV["RAILS_ENV"].presence) | |
event[:environment] = environment | |
end | |
event[:user] = { name: Current.user.name, email: Current.user.email } if Current.user | |
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
# config/initializers/honeybadger.rb | |
Honeybadger.configure do |config| | |
config.before_event do |event| | |
# DB-backed job backends can generate a lot of useless queries | |
if event.event_type == "sql.active_record" && event[:query]&.match?(/good_job|solid_queue/) | |
event.halt! | |
end | |
# Truncate long queries | |
if event.event_type == "sql.active_record" && event[:query].present? |
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
const path = require("path"); | |
const esbuild = require("esbuild"); | |
esbuild | |
.build({ | |
entryPoints: ["application.js"], | |
bundle: true, | |
outdir: path.join(process.cwd(), "app/assets/builds"), | |
absWorkingDir: path.join(process.cwd(), "app/assets/packs"), | |
minify: process.env.RAILS_ENV == "production", |
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
#!/bin/bash | |
if [ "$UID" == "0" ]; then | |
sudo_cmd='' | |
else | |
sudo_cmd='sudo' | |
fi | |
bash -c "$(curl -sL https://setup.vector.dev)" |
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
[api] | |
enabled = true | |
address = "0.0.0.0:8686" | |
[sources.fly_log_metrics] | |
type = "internal_metrics" | |
[sources.sandwich] | |
type = "nats" | |
url = "nats://[fdaa::3]:4223" |
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 "aws-sdk-cloudwatch" | |
require "descriptive_statistics/safe" | |
class CloudWatchMetricsMiddleware | |
def initialize(app, opts = {}) | |
@app = app | |
@client = Aws::CloudWatch::Client.new(region: opts[:region] || "us-east-1") | |
@counts = Queue.new | |
@timings = Queue.new | |
@mutex = Mutex.new |
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 "json" | |
require "rest-client" | |
require "honeybadger" | |
def command_parser(message) | |
case message | |
when /shirt/i | |
response = RestClient.post("https://#{ENV["PRINTFECTION_TOKEN"]}:@api.printfection.com/v2/orders", | |
JSON.dump({campaign_id: ENV["PRINTFECTION_SHIRT_CAMPAIGN"]}), | |
{content_type: :json, accept: :json}) |
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
#!/bin/bash | |
curl https://github.com/stympy.keys > /root/.ssh/authorized_keys |
NewerOlder