Skip to content

Instantly share code, notes, and snippets.

View caok's full-sized avatar

Clark caok

View GitHub Profile
@caok
caok / .gitconfig
Last active December 15, 2015 15:49
[user]
name = xxxx
email = [email protected]
[alias]
co = checkout
ci = commit -a -v
st = status
br = branch
throw = reset --hard HEAD
throwh = reset --hard HEAD^
<meta name="author" content="{{ site.author }}">
{% capture description %}{% if page.description %}{{ page.description }}{% elsif site.description %}{{ site.description }}{%else%}{{ content | raw_content }}{% endif %}{% endcapture %}
<meta name="description" content="{{ description | strip_html | condense_spaces | truncate:150 }}">
{% if page.keywords %}<meta name="keywords" content="{{ page.keywords }}">{%else%}<meta name="keywords" content="{{ site.keywords }}">{% endif %}
base: &base
adapter: sqlite3
timeout: 5000
development:
database: <%= shared_path %>/db/development.sqlite3
<<: *base
test:
database: <%= shared_path %>/db/test.sqlite3
<<: *base
production:
server {
listen 80 default;
server_name example.com;
client_max_body_size 4G;
keepalive_timeout 5;
root /u/app/fruitwood/current/public;
try_files $uri/index.html $uri.html $uri @unicorn;
location @unicorn {
@caok
caok / installation.sh
Created December 5, 2012 02:41 — forked from mikhailov/installation.sh
nginx+passenger (real production config)
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776
$ cd /usr/src
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
@caok
caok / README.md
Created December 5, 2012 02:40 — forked from elvuel/README.md
RVM + Puma + Ubuntu

Running Puma on Nginx

I use the latest Puma v1.4.0 from rubygems.

Make sure you have nginx installed with these options:

>/opt/nginx/sbin/nginx -V
nginx version: nginx/1.0.15

built by gcc 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)

@caok
caok / network.sh
Created November 30, 2012 05:59
通过shell 脚本查看服务器的时时流量
#!/bin/bash
ETH=$1
ETH=${ETH:-eth0}
IP=`ifconfig $ETH|awk -F '[ :]+' '/inet addr/{print $4}'`
while true;do
let I+=1
NOW=`date +"%F %T"`
TX1=`ifconfig $ETH|grep bytes|awk -F '[ :]+' '{print $9}'`
@caok
caok / gist:4083224
Last active September 20, 2016 02:51
Jruby商业应用环境构筑

Jruby商业应用环境构筑

配置jruby环境

更新源

sudo apt-get update

安装系统包

sudo apt-get -y install git-core curl zsh exuberant-ctags vim autoconf automake openssl \
@caok
caok / mail_backup.rb
Created November 13, 2012 13:41
发送ip地址和指定文件到某邮箱
#!/usr/bin/env ruby
#
# ARGV[0] - msg
# ARGV[1] - mailto
# ARGV[2] - filename
require 'open-uri'
require 'rubygems'
require 'action_mailer'
@caok
caok / mailip.rb
Created November 13, 2012 13:39
mailip
#!/usr/bin/env ruby
#
# ARGV[0] - msg
# ARGV[1] - mailto
require 'open-uri'
require 'rubygems'
require 'action_mailer'
ActionMailer::Base.smtp_settings = {