Skip to content

Instantly share code, notes, and snippets.

@freiden
freiden / rvm logs
Created February 10, 2013 03:37
RVM logs when trying to install ruby
current path: /Users/cfreiden/.rvm/src/ruby-2.0.0-rc2
command(1): make
CC = gcc-4.2
LD = ld
LDSHARED = gcc-4.2 -dynamic -bundle
CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration -pipe
XCFLAGS = -include ruby/config.h -include ruby/missing.h -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -fPIE
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/Users/cfreiden/.rvm/usr/include -I/Users/cfreiden/.rvm/usr/include -I. -I.ext/include/x86_64-darwin10.8.0 -I./include -I.
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/Users/cfreiden/.rvm/usr/lib -L/Users/cfreiden/.rvm/usr/lib -fstack-protector -Wl,-u,_objc_msgSend -pie
SOLIBS =
namespace :secret do
desc "Edit an encrypted data bag item in EDITOR"
task :edit, :data_bag, :bag_item do |t, args|
unless ENV['EDITOR']
puts "No EDITOR found. Try:"
puts "export EDITOR=vim"
puts "or"
puts "export EDITOR='subl -w'"
exit 1
end
#!/bin/bash
# Actual filename: bootstrap/rvm.erb
# vim: set ft=sh
# This script automatically bootstraps the system with everything it needs to run chef-solo.
# Note: This should only do the absolute minimum necessary to get chef-solo (and your recipes)
# working. All else should be done via chef recipes.
#===================================================================================================
# Config
require 'restclient'
# RestClient logs using << which isn't supported by the Rails logger,
# so wrap it up with a little proxy object.
RestClient.log =
Object.new.tap do |proxy|
def proxy.<<(message)
Rails.logger.info message
end
end
@freiden
freiden / foo.rb
Created August 21, 2013 09:08 — forked from h3h/foo.rb
class Foo < ActiveRecord::Base
ALLOWED_HTML_ELEMENTS = %w[
a b br blockquote code em h2 h3 hr i li ol p pre s strong sub sup u ul
]
ALLOWED_EMPTY_HTML_ELEMENTS = %w[br hr]
before_validation :sanitize_html
private
@freiden
freiden / gist:6308681
Created August 22, 2013 15:25
Example logrotate sidekiq
# rotate log files daily, keep 32 days
daily
rotate 32
# create new (empty) log files after rotating old ones
create
compress
#
# = Capistrano database.yml task
#
# Provides a couple of tasks for creating the database.yml
# configuration file dynamically when deploy:setup is run.
#
# Category:: Capistrano
# Package:: Database
# Author:: Simone Carletti <weppos@weppos.net>
# Copyright:: 2007-2010 The Authors
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
task :ask_production_confirmation do
set(:confirmed) do
puts <<-WARN
========================================================================
WARNING: You're about to perform actions on production server(s)
Please confirm that all your intentions are kind and friendly
========================================================================
@freiden
freiden / deploy.rb
Created October 23, 2013 08:58 — forked from thbar/deploy.rb
# cap deploy deploy:db_schema_load
namespace :deploy do
desc "Load the initial schema - it will WIPE your database, use with care"
task :db_schema_load, :roles => :db, :only => { :primary => true } do
puts <<-EOF
************************** WARNING ***************************
If you type [yes], rake db:schema:load will WIPE your database
any other input will cancel the operation.