Skip to content

Instantly share code, notes, and snippets.

View johnthethird's full-sized avatar

John Lynch johnthethird

View GitHub Profile
@johnthethird
johnthethird / save_restore_dependencies.sql
Created January 30, 2018 22:42 — forked from mateuszwenus/save_restore_dependencies.sql
PostgreSQL: How to handle table and view dependencies
create table deps_saved_ddl
(
deps_id serial primary key,
deps_view_schema varchar(255),
deps_view_name varchar(255),
deps_ddl_to_run text
);
create or replace function deps_save_and_drop_dependencies(p_view_schema varchar, p_view_name varchar) returns void as
$$
@johnthethird
johnthethird / Gemfile
Last active August 29, 2015 14:13 — forked from bf4/Gemfile
gem 'lograge' # more readable logs
gem 'logstash-event' # for logstash json format
gem 'mono_logger' # threadsafe logging
#!/usr/bin/env python
# Quick and dirty demonstration of CVE-2014-0160 by
# Jared Stafford (jspenguin@jspenguin.org)
# Modified so that it finds cookies
import sys
import struct
import socket
import time
import select
@johnthethird
johnthethird / new_bashrc.sh
Created August 11, 2012 14:09 — forked from josephwecker/new_bashrc.sh
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful.
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
# Are you tired of trying to remember how darwin/mac-osx treat them differently from linux?
# Are you tired of not having your ~/.bash* stuff work the way you expect?
#
# Symlink all of the following to this file:
# * ~/.bashrc
@johnthethird
johnthethird / parallel_asset_compiler.rb
Created August 3, 2012 16:05 — forked from brentd/parallel_asset_compiler.rb
Parallelize assets:precompile
require 'parallel' # gem install parallel (https://github.com/grosser/parallel)
# Monkey patch to Sprockets::StaticCompiler, a class provided by actionpack
# that's used by the assets:precompile task. This patch uses the Parallel gem
# to parallelize asset compilation in the simplest way possible.
#
# Parallel wraps Process.fork to handle things like inter-process communication
# via pipes and determining the maximum number of processes to run based on
# your system's total logical processors. So far only tested on MRI 1.9.3 on OS X.
module Sprockets
######################
#
# ActiveRecord's ConnectionPool in Rails 3.2.3 allows threads to 'steal'
# connections from each other, so some threads get starved out.
#
# This monkey patch uses an implementation from https://github.com/rails/rails/pull/6492
# that ensures 'fair' queue in ConnectionPool.
#
# It's actually a weird hybrid which ALSO maintains the clear_stale_cached_connections!
# behavior to reclaim leaked orphaned connections, and calls that method
@johnthethird
johnthethird / customdomain.rb
Created September 23, 2011 22:23 — forked from dwabnitz/customdomain.rb
rack middleware to resolve a custom domain to an original subdomain in a multi-tenant application
require 'net/dns/resolver'
# Custom Domain
#
# Require net-dns gem
#
# A Rack middleware to to resolve the custom domain to original subdomain
# for your multi telent application.
#
# It's all transperant to your application, it performs cname lookup and
@johnthethird
johnthethird / cap_notify.rb
Created May 4, 2011 20:02 — forked from rtekie/cap_notify.rb
Capistrano deployment email notifier for Rails 3
=begin
Capistrano deployment email notifier for Rails 3
Do you need to send email notifications after application deployments?
Christopher Sexton developed a Simple Capistrano email notifier for rails. You can find details at http://www.codeography.com/2010/03/24/simple-capistrano-email-notifier-for-rails.html.
Here is Rails 3 port of the notifier.
The notifier sends an email after application deployment has been completed.
#!/bin/bash
echo "Automated VPS Setup for Ubuntu 10.04 LTS (Lucid) - Rails with Nginx"
echo "-------------------------------------------------------------------"
echo "Set Hostname"
echo "------------"
echo "mail.redecoletiva.com.br" | sudo tee /etc/hostname
Rails CMS alternatives
======================
Note: project activity was checked on 11/26/09 for most of these projects, and the "last update" field has not been kept up to date since then.
Active projects:
---------------
adva-cms
repo: http://github.com/svenfuchs/adva_cms/
site: http://adva-cms.org/
Last update: 11/24/09