SELECT
*,
CONCAT(CONCAT('KILL ', id), ';') AS KILL_SQL,
CONCAT(CONCAT('CALL mysql.rds_kill(', id), ');') AS KILL_SQL_FOR_RDS
FROM
INFORMATION_SCHEMA.PROCESSLIST
WHERE
db = 'your_db'
AND info LIKE '%probrem_query%'
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
# gem install rspec | |
# rspec calculator.rb | |
require "rspec" | |
class Calculator | |
def sum(value1, value2) | |
value1 + value2 | |
end | |
end |
%cat /usr/local/bin/rubymine
#!/bin/sh
open -na /Applications/RubyMine.app --args "$@"
chmod +x/usr/local/bin/rubymine
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
# ruby extract_sql.rb app.rb | |
require 'ripper' | |
$SQL_TEXTS = [] | |
class ExtractSql < Ripper::Filter | |
def on_tstring_content(tok, _) | |
text = tok.strip.upcase | |
$SQL_TEXTS << text if text.index('SELECT') || text.index('UPDATE') || text.index('INSERT') || text.index('DELETE') |
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
# gem 'parser' | |
# bundle exec ruby-rewrite -l method_rewriter.rb -m app.rb | |
class MethodRewriter < Parser::TreeRewriter | |
def on_def(node) | |
padding = ' ' * (node.location.column + 2) | |
insert_start(node: node, args: node.children[1].location.expression, code: node.children[2], padding: padding) | |
insert_after(node.children.last.location.expression, "\n#{padding}#{puts_end}") | |
super |
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
# bundle exec ruby-rewrite -l method_rewriter.rb -m app.rb | |
class MethodRewriter < Parser::TreeRewriter | |
def on_def(node) | |
padding = ' ' * (node.location.column + 2) | |
insert_start(node: node, args: node.children[1].location.expression, code: node.children[2], padding: padding) | |
insert_after(node.children.last.location.expression, "\n#{padding}#{puts_end}") | |
super | |
end |
let texts = [];
$$('.js-commits-list-item clipboard-copy').forEach(function (e, i){ texts.push("git cherry-pick " + e.value) })
copy(texts.join('\n'));
クリップボードに下記が入る
git cherry-pick fab98cd67eebcd95a6c7e305873ddc49485cf6dx
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
linters: | |
LineLength: | |
enabled: false | |
SpaceInsideHashAttributes: | |
enabled: false | |
ViewLength: | |
enabled: false | |
InlineStyles: | |
enabled: false | |
ClassesBeforeIds: |
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
module Mysql2 | |
class Client | |
orig_query = instance_method(:query) | |
define_method(:query) do |sql, options = {}| | |
Rails.logger.info("[#{Time.current}] SQL:[#{sql}]") | |
orig_query.bind(self).call(sql, options) | |
end | |
end | |
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
require "octokit" | |
require "json" | |
class GithubPullRequest | |
def initialize(access_token: ENV["GITHUB_TOKEN"], repository:) | |
@client = Octokit::Client.new(access_token: access_token) | |
@repository = repository | |
end | |
def update_description!(rspec_examples:, pull_request_number:, ci_build_url:) |
NewerOlder