Skip to content

Instantly share code, notes, and snippets.

View invalidusrname's full-sized avatar
🤷‍♀️

Matt invalidusrname

🤷‍♀️
View GitHub Profile
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"
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
@invalidusrname
invalidusrname / pg_extensions.pp
Created June 18, 2013 19:04
adding postgres extensions to template1
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
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
@invalidusrname
invalidusrname / curling.log
Last active April 3, 2019 21:07
curling some stuff
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'
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
@invalidusrname
invalidusrname / Vagrantfile
Last active April 3, 2019 20:25
technekes devbox
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
@invalidusrname
invalidusrname / wtf_spec.rb
Created February 22, 2013 16:16
wtf spec is the best spec
describe ::Foo do
# TODO: WTF?!?
# it { should have_many :bars }
@invalidusrname
invalidusrname / vimrc
Created February 1, 2013 15:55
Trims whitespace in vim for ruby and puppet files
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
@invalidusrname
invalidusrname / killing_pids_in_pg.sql
Last active April 3, 2019 20:59
Kills active connections to a postgres database
-- 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