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
function merge () { | |
var ret = {}; | |
for (var i in arguments) { | |
var m = arguments[i]; | |
for (var j in m) ret[j] = m[j]; | |
} | |
return ret; | |
}; |
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 | |
class REST { | |
public static $headers = array(); | |
public static function exec ($ch) { | |
curl_setopt($ch, CURLOPT_HTTPHEADER, self::$headers); | |
ob_start(); | |
curl_exec($ch); |
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'); | |
/** | |
* 遍历目录里面的所有文件 | |
* | |
* @param {string} dir 目录名 | |
* @param {function} findOne 找到一个文件时的回调 | |
* 格式:function (filename, stats, next) | |
* @param {function} callback 格式:function (err) |
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
# 添加 | |
/sbin/iptables -I INPUT -p tcp --dport 10000 -j ACCEPT | |
/etc/rc.d/init.d/iptables save | |
/etc/init.d/iptables restart | |
# 直接编辑 | |
vim /etc/sysconfig/iptables | |
# 内容 | |
-A INPUT -p tcp -m tcp --dport 20 -j ACCEPT | |
-A INPUT -p tcp -m tcp --dport 21 -j ACCEPT |
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
Test ... | |
time passed: 4807ms, interval: 1ms -- spent: 4806ms, rss: 94.1M (+35.41M) | |
time passed: 8196ms, interval: 1ms -- spent: 3388ms, rss: 104.68M (+10.57M) | |
time passed: 10667ms, interval: 1ms -- spent: 2470ms, rss: 180.91M (+76.23M) | |
time passed: 13473ms, interval: 1ms -- spent: 2805ms, rss: 98.75M (-82.15M) | |
time passed: 17132ms, interval: 2ms -- spent: 3657ms, rss: 99.21M (+0.46M) | |
time passed: 19619ms, interval: 1ms -- spent: 2486ms, rss: 177.95M (+78.73M) | |
time passed: 22538ms, interval: 0ms -- spent: 2919ms, rss: 95.06M (-82.89M) | |
time passed: 25632ms, interval: 1ms -- spent: 3093ms, rss: 97.29M (+2.23M) | |
time passed: 28832ms, interval: 1ms -- spent: 3199ms, rss: 102.23M (+4.94M) |
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'); | |
/** | |
* 遍历目录里面的所有文件 | |
* |
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 老雷<leizongmin@gmail.com> | |
* | |
* | |
* 启动参数: <域名> <子域名最大位数> <并发数> <结果保存到哪个文件> | |
* 如: safe360.com 10 10 fuck.txt | |
*/ |
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
;;;; HTTP代理服务器 | |
;;;; @author 老雷<leizongmin@gmail.com> | |
(ns http-proxy | |
(:require [http])) | |
(defn- ^Object parse-url [^String url] | |
(def i1 (.index-of url "://")) | |
(def i2 (+ i1 3)) | |
(def i3 (.index-of url "/" i2)) |
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
/** | |
* Simple MySQL Pool | |
* | |
* @author 老雷<leizongmin@gmail.com> | |
*/ | |
var util = require('util'); | |
var events = require('events'); | |
var mysql = require('mysql'); | |
var debug = require('debug')('my:mysql'); |
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 http = require('http'); | |
/** | |
* 读取远程文件 | |
* | |
* @param {String} url | |
* @param {Function} cb | |
* - {Error} err | |
* - {Buffer} buf | |
*/ |