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_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 / 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 / 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 / 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 / nginx.sh
Created August 15, 2010 10:23
/etc/init.d/nginx
# /etc/init.d/nginx
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
NSURL *url = [NSURL URLWithString:@"http://api.woyiwang.com:4001/test_post_login"];
NSString *body = [NSString stringWithFormat: @"param1=%@&param2=%@",value1,value2];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody: [body dataUsingEncoding: NSUTF8StringEncoding]];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
# using rvm with ruby-1.8.7-p249
# latest version 2.7.7 2010-06-17
brew install libxml2
brew link libxml2
# latest version 1.13.1
brew install libiconv
brew link libiconv
class Person
def self.person
"Person"
end
end
class Person
class << self
def hello
"Hello"
# remove all existed ruby
rm -rf /usr/lib/ruby
wget http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2010.02.tar.gz
tar xzvf ruby-enterprise-1.8.7-2010.02.tar.gz
./ruby-enterprise-1.8.7-2010.02/installer
# custom the location of ruby installation: /usr/lib/ruby
# ruby, passenger, rake, ri, rdoc, rubygem, rack, rails ... will be installed
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active May 16, 2024 16:51
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh