Skip to content

Instantly share code, notes, and snippets.

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

robbin han robbinhan

🏠
Working from home
View GitHub Profile
@robbinhan
robbinhan / pptpd.sh
Created November 30, 2012 13:02 — forked from alvin2ye/pptpd.sh
Automaticlly install pptpd on Amazon EC2 Amazon Linux
# Automaticlly install pptpd on Amazon EC2 Amazon Linux
#
# Ripped from http://blog.diahosting.com/linux-tutorial/pptpd/
# pptpd source rpm packing by it's authors
#
# WARNING:
# first ms-dns setting to 172.16.0.23, 172.16.0.23 was showing on my
# /etc/resolv.conf, I'm not sure this is the same on all Amazon AWS zones.
#
# You need to adjust your "Security Groups" which you are using too.
@robbinhan
robbinhan / crc32.c
Created March 18, 2012 06:43
php crc32算法
char *p;
int len, nr;
php_uint32 crcinit = 0;
register php_uint32 crc;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &p, &nr) == FAILURE) {
return;
}
crc = crcinit^0xFFFFFFFF;
@robbinhan
robbinhan / array.c
Created March 17, 2012 05:15
php的array_chunk源码中模除的巧妙用法
/* If reached the chunk size, add it to the result array, and reset the
* pointer. */
if (!(++current % size)) {
add_next_index_zval(return_value, chunk);
chunk = NULL;
}