This file contains hidden or 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
parse @message /Query_time:\s*(?<Query_time>[0-9]+(?:\.[0-9]+)?)\s*Lock_time:\s*(?<Lock_time>[0-9]+(?:\.[0-9]+)?)[\s\S]*?;/ | |
| parse @message /SET timestamp=\d+;\n(?<RawQuery>[^;]*)/ | |
| stats count() as QueryCount, avg(Query_time) as AvgQueryTime, avg(Query_time) as AvgLockTime by RawQuery | |
| sort AvgQueryTime desc | |
| limit 20 |
This file contains hidden or 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
<!-- Delete coupons from staging test merchant --> | |
select coupons.id, coupons.code, request_token | |
from coupons | |
left join coupon_codes on coupon_codes.code = coupons.code | |
left join discounts on discounts.id = coupons.discounts_id | |
where reason = 5 and coupon_codes.merchant_token = 'ML0T5T2PZE4EK'; | |
sq mysql run coupons staging --metacluster coupons-staging-aurora-005 --db coupons_0_staging --cname rw | |
delete d |
This file contains hidden or 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
# Kill background process (using ctrl + z) | |
ps -eaf | grep <CMD> | |
This file contains hidden or 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
### | |
# Print id, deliveries, created_at in table | |
# | |
ActiveRecord::Base.logger.silence do | |
Promotion.where(theme_campaign: ThemeCampaign.recurring_lapsed_style).each do |p| | |
delivery_campaign = p.delivery_campaigns.first | |
processed = delivery_campaign.sms_deliveries.processed | |
link_window_start = processed.order(created_at: :asc).first&.created_at | |
link_window_end = processed.order(delivered_at: :desc).first&.delivered_at |
This file contains hidden or 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 | |
# https://adventofcode.com/2021 | |
module AdvantOfCode2021 | |
URL = 'https://adventofcode.com/2021/day/%d/input' | |
COOKIE = 'Nope' | |
def parse_reading(day) | |
day_url = URL % day | |
HTTParty.get(day_url, headers: { 'Cookie' => COOKIE }).body.split("\n") |
This file contains hidden or 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
# https://adventofcode.com/2021 | |
module AdventOfCode2021 | |
URL = 'https://adventofcode.com/2021/day/%d/input' | |
COOKIE = 'NOPE' | |
def parse_reading(day) | |
day_url = URL % day | |
HTTParty.get(day_url, headers: { 'Cookie' => COOKIE }).body.split("\n") | |
end |