Skip to content

Instantly share code, notes, and snippets.

View thogg4's full-sized avatar

Tim Hogg thogg4

  • Test Double
  • North Carolina
  • X @thogg4
View GitHub Profile
@thogg4
thogg4 / cloud-config
Last active April 3, 2016 22:22 — forked from ibuildthecloud/yaml
cloud-config for rancher-agent
#cloud-config
ssh_authorized_keys:
- ssh-rsa AAAA...
rancher:
services:
register:
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
image: rancher/agent:v0.11.0
======= Prolbem =================================================================================================================
I have installed : ruby-2.0.0,postgres-9.2 , now in rails app when I execute:
rake db:create , command I get:
PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT: Use the same encoding as in the template database, or use template0 as template.
: CREATE DATABASE "my_db_name" ENCODING = 'unicode'.......
bin/rake:16:in `load'
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
#!/bin/bash
# Install rbenv
# https://github.com/sstephenson/rbenv
cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> .bash_profile
echo 'eval "$(rbenv init -)"' >> .bash_profile
module ConditionalValidations
attr_accessor :validated_fields
def field_is_required?(field)
if !validated_fields.blank?
validated_fields.include?(field)
end
end
def conditionally_validate(attribute, options=nil)
# Public: Returns an Array of States (for use in Select Tags)
#
# short - (bool) If you want the function to return State Abreviations or full state names.
#
# Returns array.
def state_list(short=false)
if short
return ['AL','AK','AZ','AR','CA','CO','CT','DE','FL','GA','HI','ID','IL','IN','IA','KS','KY','LA','ME','MD','MA','MI','MN','MS','MO','MT','NE','NV','NH','NJ','NM','NY','NC','ND','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VT','VA','WA','WV','WI','WY']
else
return ['Alabama','Alaska','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','Florida','Georgia','Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Maryland','Massachusetts','Michigan','Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York','North Carolina','North Dakota','Ohio','Oklahoma','Oregon','Pennsylvania','Rhode Island','South Carolina','South Dakota','Tennessee','Texas','Utah','Vermont','Virginia','Wash