This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: unicorn | |
# Required-Start: $local_fs $remote_fs | |
# Required-Stop: $local_fs $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: unicorn initscript | |
# Description: unicorn | |
### END INIT INFO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tar | |
=== | |
tar -cvf output.tar file1 file2 folder1/ | |
Restore Tar | |
=========== | |
tar -xvf output.tar | |
options | |
-------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create dump | |
------------ | |
pg_dump database_name > pgdumpfile.sql | |
Create dump and compress | |
------------------------ | |
pg_dump database_name | gzip -c > pgdumpfile.sql.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Installation | |
============ | |
Install PostgreSQL: | |
------------------- | |
- sudo apt-get install postgresql | |
Install GUI Administration application: | |
--------------------------------------- | |
- sudo apt-get install pgadmin3 | |
Install PHP based Web Administration site (like phpMyAdmin for MySQL database): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path('../boot', __FILE__) | |
require 'rails/all' | |
Bundler.require(:default, Rails.env) | |
module TestApplication | |
class Application < Rails::Application | |
#add the lib folder to autoload path | |
config.autoload_paths += %W(#{config.root}/lib/assets/ #{config.root}/lib/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DynamicAttrAccessor | |
def initialize(hash) | |
hash.each do |k,v| | |
if v.is_a?(Hash) | |
set_attr_accessor(k.to_s, self.class.new(v)) | |
else | |
set_attr_accessor(k.to_s, v) | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ostruct' | |
def deep_ostruct(hash) | |
if hash | |
hash.each do |k,v| | |
hash["#{k}"] = deep_ostruct(v) if v.is_a?(Hash) | |
end | |
end | |
OpenStruct.new(hash) | |
end |