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 / 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
Mongodb Dynamic querys select
MySQL:
SELECT * FROM user
Mongo:
db.user.find()
MySQL:
SELECT * FROM user WHERE name = 'foobar'
Mongo:
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
@marshluca
marshluca / ShareKit_Spanish.h
Created September 13, 2010 08:51
ShareKit_Spanish.h
// PLEASE SEE INSTALL/CONFIG INSTRUCTIONS:
// http://getsharekit.com/install
// App Description
// These values are used by any service that shows 'shared from XYZ'
@marshluca
marshluca / ShareKit_Portuguese.h
Created September 13, 2010 09:23
ShareKit_Portuguese.h
// PLEASE SEE INSTALL/CONFIG INSTRUCTIONS:
// http://getsharekit.com/install
// App Description
// These values are used by any service that shows 'shared from XYZ'
http://api.t.sina.com.cn/oauth/authorize?oauth_token=871de25c7f1d923e7b0a56bee795d869&oauth_token_secret=36ffdca3c6ca0496ac88808270ecce88&oauth_callback=http://www.dianping.com/ThirdPart.v?do=r
Consumer (key:1860579545, secret:d62c11d9ddaa25d55fc59b1835e73619)
1.没有授权,进行授权
RequestToken (secret: bf307a4e119addd45645a4ccdda12b3c, token: b4da5eba67b73aec6ee5b9e7230a526d)
AccessToken (secret: bf307a4e119addd45645a4ccdda12b3c, token: 38372a1b37859d2ca39d85f24e62a597)
2.解除授权,重新授权
RequestToken (secret: 8cb67ae3bbd96ca9e68a0a3a3b0c5461, token: e0258140e68375428239e828b6ef7449)