Skip to content

Instantly share code, notes, and snippets.

View marshluca's full-sized avatar
🏠
Working from home

Lucas Zhang marshluca

🏠
Working from home
View GitHub Profile
@marshluca
marshluca / server.conf
Created August 15, 2010 03:14
configure file on ec2
EC2 softwares configure file:
1.Mysql
/etc/mysql/my.cnf
sudo /etc/init.d/mysql start|stop|restart
2.MongoDB
/etc/init.d/MongoDB
sudo /etc/init.d/MongoDB start|stop|restart
sudo mongod --dbpath /mnt/mongo/data/ --logpath /mnt/mongo/log/mongodb.log --fork --logappend
@marshluca
marshluca / my.cnf
Created August 14, 2010 07:46
change the directory of mysql data
更换mysql的数据库目录,需要将原来的db数据copy到目标目录,然后做如下更改:
/etc/mysql/my.cnf
# * Basic Settings
#
#
# * IMPORTANT
# If you make changes to these settings and your system uses apparmor, you may
@marshluca
marshluca / mysql.log
Created August 14, 2010 04:54
MySQL Log 说明
MySQL Log 的配置
MySQL内置4种Log:
Error Log, General Query Log, Binary Log, Slow Query Log
1. Error Log
错误日志, 记录MySQL启动、运行、停止过程中出现的错误信息
2. General Query Log
记录MySQL客户端连接、查询的细节, 调试的时候很有用, 正式运行的时候最好关闭否则会带来大量磁盘IO
@marshluca
marshluca / server_configure.log
Created August 13, 2010 04:14
Ruby on rails Configure
# ruby developer packages
sudo apt-get install ruby1.8 ri1.8 rdoc1.8 irb1.8
sudo apt-get install libreadline-ruby1.8 libruby1.8 libopenssl-ruby
# hpricot requirements
sudo apt-get install ruby1.8-dev
sudo gem install hpricot
# nokogiri requirements
@marshluca
marshluca / MongoDB.sh
Created August 13, 2010 04:09
MongoDB init script
#!/bin/sh
#
# init.d script with LSB support.
#
# Copyright (c) 2007 Javier Fernandez-Sanguino <[email protected]>
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2,
# or (at your option) any later version.
@marshluca
marshluca / ruby_constant.rb
Created August 12, 2010 01:52
constant in Rails
Loading development environment (Rails 2.3.8)
>> Rails.env
=> "development"
>> RAILS_ENV
=> "development"
>> RUBY_VERSION
=> "1.8.7"
@marshluca
marshluca / compute.rb
Created August 8, 2010 12:54
pass ball in ruby
# ruby
def compute(current,remain)
result = 0
if remain == 0
result = current == 'a' ? 1 : 0
else
for n in ['a','b','c','d']
result += compute(n,remain-1) if n != current
end
@toastdriven
toastdriven / rebuild_environment.sh
Last active December 3, 2019 19:12
Rebuild Environment
brew install git
brew update
brew install readline
brew link readline
brew install python
brew install postgres
brew install tmux
brew install pip
brew install nginx
brew install libevent
@marshluca
marshluca / new_tweet.m
Created July 31, 2010 02:22
Post like the new tweet view in twitter for iPhone
#import "PostViewController.h"
#import "WoyiAppDelegate.h"
#import "ImagePickerController.h"
@implementation PostViewController
#pragma mark -
#pragma mark Initialization
@marshluca
marshluca / renren_api.rb
Created June 4, 2010 08:05
使用json,net/http解析人人API
require "net/http"
require "json"
USER = '[email protected]'
PASS = '123456'
API_URL = "http://api.renren.com/restserver.do"
def base_params
{
"api_key" => "f2570a570d56439784bfb69dbda699d1",