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
diff --git a/Vagrantfile b/Vagrantfile | |
index f5f8d5a..db63767 100644 | |
--- a/Vagrantfile | |
+++ b/Vagrantfile | |
@@ -4,8 +4,8 @@ | |
Vagrant.configure("2") do |c| | |
c.vm.define "technekes-dev" do |config| | |
config.vm.box = "precise64" | |
#config.vm.box_url = "http://files.vagrantup.com/precise64_vmware_fusion.box" | |
config.vm.box_url = "http://files.vagrantup.com/precise64.box" |
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
for app in /var/apps/* | |
do | |
dir=$app/releases | |
if [ -d $dir ] | |
then | |
release_count=$(ls -l $dir | sed 1d | wc -l ) | |
echo "$release_count - $dir" | |
if [ $release_count -gt 2 ] | |
then | |
ls -lth $dir | awk '{print $9}' | sed 1d | 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
exec { 'add hashtypes to template1': | |
command => 'sudo -u postgres psql template1 -t -c "CREATE EXTENSION hashtypes"', | |
unless => 'sudo -u postgres psql template1 -t -c "\dx" | grep -q hashtypes', | |
require => Class['postgresql::server'], | |
} | |
# similar for other extensions |
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
role :app, "app4" | |
role :web, "proxy" | |
after "deploy:assets:precompile", "assets:copy_manifest_file" | |
namespace :assets do | |
task :copy_manifest_file, :roles => :web, :except => { :no_release => true } do | |
app_servers = find_servers :roles => :app | |
app_servers.each do |app_server| do |
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
for url in $(cat ~/urls.txt); do curl --write-out "$url | %{http_code} | %{time_total}\n" --silent -o /dev/null $url; done| sed 's/\(^.*\)\|/<li>\1/g' | sed 's/$/<\/li>/g' |
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
class User | |
def self.need_reminder(days_to_remind = 10, organization = nil) | |
reminder_date = expiration_date - days_to_remind | |
if organization | |
where("oranization_id = ? and expiration_date == ?", reminder_date, expiration_date) | |
else | |
where("expiration_date == ?", reminder_date) | |
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
Vagrant.configure("2") do |config| | |
config.vm.define "dev" do |config| | |
config.vm.box = "precise64" | |
config.vm.box_url = "http://files.vagrantup.com/precise64_vmware_fusion.box" | |
config.vm.hostname = "technekes-dev" | |
config.vm.network :public_network | |
config.vm.synced_folder "./apps", "/var/apps" | |
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
describe ::Foo do | |
# TODO: WTF?!? | |
# it { should have_many :bars } |
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
highlight ExtraWhitespace ctermbg=red guibg=red | |
match ExtraWhitespace /\s\+$/ | |
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/ | |
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/ | |
autocmd InsertLeave * match ExtraWhitespace /\s\+$/ | |
autocmd BufWinLeave * call clearmatches() | |
function! TrimWhiteSpace() | |
%s/\s\+$//e | |
endfunction |
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
-- 9.1 | |
-- Terminate connections to a database | |
SELECT | |
pg_terminate_backend(procpid) | |
FROM | |
pg_stat_activity | |
WHERE | |
-- don't kill my own connection! | |
procpid <> pg_backend_pid() | |
-- don't kill the connections to other databases |