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
SELECT | |
r.trx_id as waiting_trx_id, | |
r.trx_mysql_thread_id as waiting_thread, | |
r.trx_query as waiting_query, | |
b.trx_id as blocking_trx_id, | |
b.trx_mysql_thread_id as blocking_thread, | |
b.trx_query as blocking_query, | |
bp.host as blocking_host, | |
rp.host as waiting_host, | |
bp.command as blocking_command, |
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
aws-vault exec customer -- aws rds describe-db-log-files --db-instance-identifier market-database-clustercluster-16apkpdp1bgkx-us-east-1a --region us-east-1 --query 'DescribeDBLogFiles[].LogFileName' --output text | tr '\t' '\n' | grep slowquery | while read file; do aws-vault exec customer -- aws rds download-db-log-file-portion --db-instance-identifier market-database-clustercluster-16apkpdp1bgkx-us-east-1a --region us-east-1 --log-file-name $file --output text >> slowlogs.log; done |
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
#!/usr/bin/env ruby | |
`for i in market*.sh.erb; do echo $i; git log --format="%ad%x09%h%x09%s" --date=iso -- $i; done > history1.log` | |
lines = File.readlines('history1.log') | |
commits_by_file = lines.reduce(['', Hash.new([])]) { |(current_file, commits_by_file), line| line.include?("\t") ? [current_file, commits_by_file.merge(current_file => (commits_by_file[current_file] + [line]))] : [line, commits_by_file] }.last | |
commits_by_file_parsed = Hash[commits_by_file.map{|file, commits| [file, commits.map{|c|c.split("\t")}.map{|s|{:date => s[0], :sha => s[1], :msg => s[2]}}]}] | |
flat_commits = commits_by_file_parsed.flat_map{|file, commits| commits.map {|commit| commit.merge(:file => file)}} | |
commits = flat_commits.reduce({}) { |mem, commit| new_commit = mem[commit[:sha]] ? mem[commit[:sha]].merge(:files => (mem[commit[:sha]][:files] + [commit[:file]])) : commit.select{|k| k != :file}.merge(:files => [commit[:file]]); mem.merge(commit[:sha] => new_commit) }.values.sort_by{|c| c[:date]} | |
files = commits_by_file.keys |
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
#!/usr/bin/env ruby | |
require 'aws-sdk' | |
require 'forwardable' | |
DEFAULT_REGION = "us-east-1".freeze | |
STACK_NAMES = ['market-dj'].freeze | |
class Instance | |
extend Forwardable |
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
// Based on http://stackoverflow.com/a/10520017/1307721 | |
// which wouldn't work for my use-case on my Mac because metaKey would always be true, for some reason | |
// Adapted to override metaKey to false | |
Podium = {}; | |
Podium.keydown = function(k) { | |
var oEvent = document.createEvent('KeyboardEvent'); | |
// Chromium Hack | |
Object.defineProperty(oEvent, 'keyCode', { | |
get : function() { |
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
aws ec2 describe-instances --region us-east-1 --query 'Reservations[].Instances[].[ Tags[?Key==`Name`].Value | [0], PrivateIpAddress, PublicIpAddress ]' --output text | sort |
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
mark="# DOCKER_MACHINE:" && sudo sed -i '' "/$mark/d" /etc/hosts && docker-machine ls -q | while read m; do echo "$(docker-machine ip $m) $m.docker ${mark} $m" | sudo tee -a /etc/hosts; done |
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
multicom () { | |
echo Usage: multicom command arg1 arg2 arg3 arg4... | |
echo e.g. multicom "ssh %s" web1 web2 web3 | |
echo | |
read -r -d '' code <<-APPLESCRIPT | |
activate application "iTerm" | |
tell application "System Events" to keystroke "n" using command down | |
APPLESCRIPT |
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
// Based on http://stackoverflow.com/a/10520017/1307721 and http://stackoverflow.com/a/16022728/1307721 | |
Podium = {}; | |
Podium.keydown = function(k) { | |
var oEvent = document.createEvent('KeyboardEvent'); | |
// Chromium Hack | |
Object.defineProperty(oEvent, 'keyCode', { | |
get : function() { |
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
# Identify the revision of kernel running: | |
uname -r | |
# Identify installed kernel packages: | |
dpkg --get-selections | awk '((/^linux-/) && (/[0-9]./)) {print $1}' | |
# Reboot box if not running the latest installed kernel. | |
sudo reboot | |
# Remove kernel packages (being careful not to uninstall the currently running kernel). |