Skip to content

Instantly share code, notes, and snippets.

/*
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
@therealechan
therealechan / deploy_rails_app_to_redhat5.md
Last active August 29, 2015 14:13
Deploy Rails Application to Redhat5

NOTICE: 由于Redhat的yum在线更新是收费的,如果没有注册的话是不能使用的,即不能在线安装软件。

解决办法有两种:

安装apt-get 使用CentOS的源 第一种方法在安装时候需要的依赖太多,水太深。所以只能选择第二种了。下面是详细的过程。

更新yum源

@therealechan
therealechan / nginx_debug.md
Created January 21, 2015 06:42
Nginx Debuging log

Install and configure Nginx as usual, but can't visit website through IP address.

Debugging

First, I went to Nginx access.log and error.log , I found nothing.

Then I try to use curl to test Nginx wheather can receive the outspace requests

$ curl google.com # It returns nothing!
@therealechan
therealechan / creating_ssh_shortcut.md
Last active August 29, 2015 14:13
Creating SSH shortcut

touch a file call config in your ~/.ssh folder, edit like below

Host myserver  
HostName 104.216.186.124  
User deployer  
Port 22

Make sure you have the right permissions

$ chmod 600 ~/.ssh/config
@therealechan
therealechan / install_zsh_to_ubuntu.md
Last active August 29, 2015 14:14
Install and switch zsh on Ubuntu

Perpare:

$ sudo apt-get install git
$ sudo apt-get install curl

Install zsh:

$ sudo apt-get install zsh
/*
HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsBy
@therealechan
therealechan / rake_task_encoding_problem.md
Created March 10, 2015 05:53
invalid byte sequence in US-ASCII (ArgumentError)
rake aborted!
/home/me/.rvm/gems/ruby-1.9.3-p392/gems/rake-10.0.4/lib/rake/trace_output.rb:16:in `block in trace_on': invalid byte sequence in US-ASCII (ArgumentError)

If you got this error

checkout your your custom initializers, your database.yml, etc

add

@therealechan
therealechan / set ubuntu time zone.md
Created March 10, 2015 10:05
Set Ubuntu time zone from command line
$ sudo dpkg-reconfigure tzdata
@therealechan
therealechan / incomplete response received from application.md
Last active August 29, 2015 14:17
incomplete response received from application

遇到 incomplete response received from application

可能是 config/secret.yml 没有配置好.

e.g config/secret.ymlproduction secret key 没有配置好

namespace :figaro do
desc "SCP transfer figaro configuration to the shared folder"
task :setup do
transfer :up, "config/application.yml", "#{shared_path}/application.yml", :via => :scp
end
desc "Symlink application.yml to the release path"
task :finalize do
run "ln -sf #{shared_path}/application.yml #{release_path}/config/application.yml"
end