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 / 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'
@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'
# 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
class Person
def self.person
"Person"
end
end
class Person
class << self
def hello
"Hello"
# 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
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];
Mongodb Dynamic querys select
MySQL:
SELECT * FROM user
Mongo:
db.user.find()
MySQL:
SELECT * FROM user WHERE name = 'foobar'
Mongo:
@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
@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