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
update table_name set data = (jsonb_set(to_jsonb(data), '{foo,bar,baz}', '1', false))::json where data->'foo'->'bar'->>'baz' = '0'; |
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
Sidekiq::RetrySet.new.clear | |
Sidekiq::ScheduledSet.new.clear | |
Sidekiq::Stats.new.reset | |
Sidekiq::DeadSet.new.clear | |
Sidekiq::Stats.new.queues.each do |queue_name, count| | |
next if count == 0 | |
Sidekiq::Queue.new(queue_name).clear | |
end |
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
def unmask_authenticity_token(authenticity_token) | |
# this must be the same as ActionController::RequestForgeryProtection::AUTHENTICITY_TOKEN_LENGTH | |
token_length = 32 | |
masked_token = Base64.strict_decode64(authenticity_token) | |
one_time_pad = masked_token[0...token_length] | |
encrypted_csrf_token = masked_token[token_length..-1] | |
bytes = encrypted_csrf_token.bytes |