Skip to content

Instantly share code, notes, and snippets.

View allaire's full-sized avatar

Mathieu Allaire allaire

View GitHub Profile
node.default["postgresql"]["config"]["wal_level"] = "replica"
node.default["postgresql"]["config"]["max_wal_senders"] = 6
node.default["postgresql"]["config"]["wal_keep_segments"] = 120
node.default["postgresql"]["config"]["hot_standby"] = "on"
@allaire
allaire / curl-style.sh
Created March 2, 2017 14:07
Curl large style
~ $ curl -vv https://www.agendrix.com/wp-content/themes/agendrix/style.min.css\?ver\=1486665895
* Trying 162.216.18.169...
* TCP_NODELAY set
* Connected to www.agendrix.com (162.216.18.169) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate: *.agendrix.com
* Server certificate: COMODO RSA Domain Validation Secure Server CA
* Server certificate: COMODO RSA Certification Authority
> GET /wp-content/themes/agendrix/style.min.css?ver=1486665895 HTTP/1.1
> Host: www.agendrix.com
INFO global: Vagrant version: 1.7.2
INFO global: Ruby version: 2.0.0
INFO global: RubyGems version: 2.0.14
INFO global: VAGRANT_EXECUTABLE="/opt/vagrant/bin/../embedded/gems/gems/vagrant-1.7.2/bin/vagrant"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/opt/vagrant/bin/../embedded"
INFO global: VAGRANT_INSTALLER_VERSION="2"
INFO global: VAGRANT_DETECTED_OS="Darwin"
INFO global: VAGRANT_INSTALLER_ENV="1"
INFO global: VAGRANT_INTERNAL_BUNDLERIZED="1"
INFO global: VAGRANT_LOG="debug"
@allaire
allaire / Configs
Last active August 29, 2015 14:09
# in application.rb
config.i18n.load_path += Dir["#{Rails.root.to_s}/config/locales/**/*.{rb,yml}"]
-------------------------------------------------------------------------------------
# i18n-tasks finds and manages missing and unused translations https://github.com/glebm/i18n-tasks
base_locale: fr
# locales: [en, fr ]
export PATH="$HOME/.bin:/usr/local/bin:$PATH"
# Homebrew rbenv
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
# Chefdk PATH
PATH=$HOME/.chefdk/gem/ruby/2.1.0/bin:/opt/chefdk/bin:$PATH
@allaire
allaire / monkey.rb
Last active August 29, 2015 14:05
Simple Form - Placeholders fallback on labels
# Monkeypatch placeholders to use labels as a fallback instead
module SimpleForm
module Components
module Placeholders
def placeholder_text
placeholder = options[:placeholder]
placeholder.is_a?(String) ? placeholder : (translate_from_namespace(:placeholders).present? ? translate_from_namespace(:placeholders) : translate_from_namespace(:labels))
end
end
end
@allaire
allaire / test.rb
Last active August 29, 2015 14:03
# https://github.com/oortcloud/meteorite#note
$ sudo -H npm install -g meteorite
In chef?
Does not work correctly (missing root privileges):
execute 'install_meteorite' do
user 'myuser'
@allaire
allaire / puma.rake
Created May 27, 2014 00:44
Puma with foreman upstart
namespace :load do
task :defaults do
set :puma_init_name, "#{fetch(:application)}-web"
set :puma_pid_path, "#{shared_path}/tmp/pids/puma.pid"
end
end
namespace :puma do
desc "Start puma workers"
task :start do
@allaire
allaire / upload_erb.rb
Last active March 28, 2018 21:53
Capistrano 3 upload file from erb template
def template(from, to, options = {})
template_path = File.expand_path("../../templates/#{from}", __FILE__)
template = ERB.new(File.new(template_path).read).result(binding)
upload! StringIO.new(template), to, mode: 0644 # Otherwise it's set to 0640, which is not readable by other users (https://github.com/net-ssh/net-scp/blob/master/lib/net/scp/upload.rb#L63)
sudo "chown root:root #{to}" if options[:as_root]
end
start on runlevel [2345]
stop on runlevel [06]
setuid deployer
setgid sysadmin
respawn
respawn limit 3 30
script