Skip to content

Instantly share code, notes, and snippets.

@bayendor
bayendor / unused_index.sql
Last active Aug 29, 2015 — forked from jberkus/gist:6b1bcaf7724dfc2a54f3
Finding Unused Indexes Query
View unused_index.sql
WITH table_scans as (
SELECT relid,
tables.idx_scan + tables.seq_scan as all_scans,
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
pg_relation_size(relid) as table_size
FROM pg_stat_user_tables as tables
),
all_writes as (
SELECT sum(writes) as total_writes
FROM table_scans
View inject_spec.rb
require 'rspec'
def sum(numbers)
numbers.inject(0) { |sum, number| sum + number }
end
def product(numbers)
numbers.inject(1) { |sum, number| sum * number }
end
View deploy.rake
namespace :deploy do
desc "Deploys app to Github & production."
task all: :environment do
if system("rake test:all") == false
puts "The tests fail."
break
end
puts "The tests passed."
@bayendor
bayendor / docker
Last active Oct 6, 2015 — forked from chernjie/logrotate.d-docker
Logrotate docker logs, copy this file to /etc/logrotate.d/docker
View docker
/data/docker/containers/*/*-json.log {
daily
rotate 7
size 100M
compress
delaycompress
missingok
}