This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 使用方法: | |
* step(function (data, next) { | |
* // step 1, do somethings... | |
* next(null, data); | |
* }, function (data, next) { | |
* // step 2, do somethings... | |
* next(null, data); | |
* }, function (err, data) { | |
* // callback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var path = require('path'); | |
var THREAD = require('os').cpus().length; | |
var expand = function (file, callback) { | |
fs.stat(file, function (err, stats) { | |
if (err) | |
return callback(err); | |
if (!stats.isDirectory()) { | |
return callback(null, stats.size); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"runtime" | |
"time" | |
"os" | |
"io/ioutil" | |
"net/http" | |
"strconv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 被加载的模块 | |
*/ | |
console.log('require file: random=' + random); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//author: Sun, Junyi (weibo.com/treapdb) | |
//usage: node --nouse-idle-notification --expose-gc --max-old-space-size=8192 memcached.js | |
var config ={ | |
port: 11211, | |
max_memory: 100 // default 100M bytes | |
} | |
var net = require('net'); | |
var LRU = function (max) { // this LRU implementaion is based on https://github.com/chriso/lru |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var crypto = require('crypto'); | |
/** | |
* 32位MD5加密 | |
* | |
* @param {string} text 文本 | |
* @return {string} | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*! | |
* PHP基础操作类库 | |
* | |
* @author 老雷 <[email protected]> | |
* @date 2012-08-23 12:43:45 | |
*/ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 生成缩略图 | |
*/ | |
function makethumb ($srcFile, $dstFile, $dstW, $dstH) { | |
$dstW = intval($dstW); | |
$dstH = intval($dstH); | |
if($dstW == 0 && $dstH == 0) | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 生成用于title的URL | |
* | |
* @param {string} title | |
* @return {string} | |
*/ | |
function titleUrl (title) { | |
if (typeof(title) !== 'string') return false; | |
return title.trim().replace(/[^0-9a-zA-Z \-]/g, '').replace(/[ ]+/g, '-').replace(/[\-]+/g, '-').toLowerCase(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
openssl genrsa -out ca-key.pem 2048 | |
openssl req -new -out ca-req.csr -key ca-key.pem | |
openssl x509 -req -in ca-req.csr -out ca-cert.pem -signkey ca-key.pem -days 7300 | |
openssl pkcs12 -export -in ca-cert.pem -out ca-cert.p12 -inkey ca-key.pem |
OlderNewer