Skip to content

Instantly share code, notes, and snippets.

View caok's full-sized avatar

Clark caok

View GitHub Profile
@caok
caok / gist:4065758
Created November 13, 2012 13:27
Deploy from a git tag with capistrano
ref: http://nathanhoad.net/deploy-from-a-git-tag-with-capistrano
Deploy from a Git tag with Capistrano
Are you using Capistrano and Git and want to easily deploy from Git tags? It couldn't be simpler
Using Git, tag a new release:
git tag -a 09.10.02.01 -m "Tagging a release"
You can use git tag to list your tags:
@caok
caok / backup_mysql.sh
Last active October 12, 2015 17:58
mysql数据库备份crontab(10 3 * * * sh backup_mysql.sh) 数据导入: mysql -u username -p project_name < mysql-2012-12-17.sql
#!/bin/bash
HOST=127.0.0.1
USER=root
PASS=root
# DB="db1 db2 ..."
DB="erp"
DATE=$(date "+%Y-%m-%d")
BACKDIR=/home/rails/backup
@caok
caok / gist:4065776
Created November 13, 2012 13:32
mysql配置
配置外部访问帐号密码
本地登录mysql
mysql -u root -p
执行
grant all on *.* to rails@'client_ip' identified by 'password' with grant option;
例子:所有局域网客户端都可访问
grant all on *.* to root@'192.168.0.%' identified by 'root' with grant option;
例子:为boyu数据库设置用户boyu
@caok
caok / kirk
Created November 13, 2012 13:34
/etc/init.d/kirk启动文件
#!/bin/sh -e
# kirk rails app
#
# start service for rails app
set -e
USER=rails
NAME=kirk
HOME=/home/$USER
@caok
caok / kirkfile
Created November 13, 2012 13:34
/etc/kirkfile文件
# Set the log level to ALL.
log :level => :all
rack "/u/apps/erp/current/config.ru" do
# Set the host and / or port that this rack application will
# be available on. This defaults to "0.0.0.0:9090"
listen 10000
# Set the host names that this rack application wll be available
# on. This defaults to "*"
@caok
caok / rails
Created November 13, 2012 13:36
rails-for-apache
<VirtualHost *:80>
ServerName boyu
ServerAlias boyu
# Point this to your public folder of project
DocumentRoot /u/apps/boyu/current/public
ErrorDocument 503 /system/maintenance.html
RewriteEngine On
@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 = {
@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 / 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 / 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}'`