🧘♂️
This file contains 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/questions/21767780/how-to-find-size-of-database-schema-table-in-redshift | |
SELECT name AS table_name, ROUND((COUNT(*) / 1024.0),2) as "Size in Gigabytes" | |
FROM stv_blocklist | |
INNER JOIN | |
(SELECT DISTINCT id, name FROM stv_tbl_perm) names | |
ON names.id = stv_blocklist.tbl | |
GROUP BY name | |
ORDER BY "Size in Gigabytes" DESC |
This file contains 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 "rubygems" | |
require "mechanize" | |
require "domain_name" | |
m = Mechanize.new | |
puts "<ul>" | |
DATA.each_line do |line| |
This file contains 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
namespace :deploy do | |
task :default => [:production] | |
desc "check if git is clean" | |
task :check => "assets:check" do | |
unless system("git diff --exit-code") | |
puts "Git not clean. Aborting." | |
`growlnotify -m 'deployment failed'; say 'deployment failed'` | |
abort | |
end |
This file contains 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
alias a='ack' | |
alias a?='alias | grep -i' | |
alias adx='rake db:drop && rake db:create && heroku pg:transfer --from black --to postgres://postgres@localhost/staq_development --confirm staqweb --app staqweb && rails r "User.all.each { |u| u.update_attribute(:password,%q(password)) }" && rake db:test:prepare' | |
alias b='bundle' | |
alias bb='bundle install --binstubs=.bundle/bin --path=.bundle/gems && bundle package --all && reload ; sd' | |
alias bc='bin/console' | |
alias be='bundle exec' | |
alias bea='bundle exec annotate' | |
alias bu='bundle update' | |
alias bus='bundle update staq_extraction' |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.staq.pound</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>sudo</string> | |
<string>/usr/local/sbin/pound</string> |
This file contains 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
Alive 10 | |
# http://lvh.me | |
ListenHTTP | |
Address 127.0.0.1 | |
Port 80 | |
Service | |
BackEnd | |
Address 127.0.0.1 |
This file contains 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
# I learned this from @bkemper, very useful to show what's in a commit about to be pushed to the remote repo | |
# and what's in the commits that are about to be pulled from the remote repo | |
[alias] | |
in = "!f() { [[ -z \"$1\" ]] && B='master' || B=\"$1\"; git log $B..origin/$B; }; f" | |
out = "!f() { [[ -z \"$1\" ]] && B='master' || B=\"$1\"; git log origin/$B..$B; }; f" |
This file contains 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
namespace :assets do | |
task :check do | |
root_dir = File.join(File.dirname(__FILE__),"..","..") | |
assets_last_modified_at = Dir["#{root_dir}/app/assets/**/**"].map { |p| File.mtime(p) }.sort.last | |
assets_last_compiled_at = Dir["#{root_dir}/public/assets/**/**"].map { |p| File.mtime(p) }.sort.last | |
if assets_last_modified_at > assets_last_compiled_at | |
fail "Assets need to precompiled; last asset modified at #{assets_last_modified_at}" | |
end | |
end |
This file contains 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
# Gemfile | |
gem "puma" | |
# Procfile | |
web: bundle exec puma -p $PORT -e $RACK_ENV -C config/puma.rb | |
# add to config block config/environments/production.rb | |
config.threadsafe! | |
# get rid of NewRelic after_fork code, if you were doing this: |
This file contains 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 "dim" | |
AppContainer = Dim::Container.new | |
AppContainer.register(:env) { ENV['ADWORK_ENV'] || "development" } | |
AppContainer.register(:production?) { |c| c.env == 'production' } | |
AppContainer.register(:development?) { |c| c.env == 'development' } | |
AppContainer.register(:test?) { |c| c.env == 'test' } | |
AppContainer.register(:root) { File.expand_path(File.dirname(__FILE__)+"/../..") } | |
AppContainer.register(:logger) do |c| |