Skip to content

Instantly share code, notes, and snippets.

View wudi's full-sized avatar
🎯
Focusing

Di Wu wudi

🎯
Focusing
View GitHub Profile
@wudi
wudi / nginxvarcore.md
Created December 12, 2015 08:52 — forked from esfand/nginxvarcore.md
Nginx Variables

Embedded Variables

The ngx_http_core_module module supports embedded variables with names matching the Apache Server variables. First of all, these are variables representing client request header fields, such as $http_user_agent, $http_cookie, and so on. Also there are other variables:

  • $arg_name
    argument name in the request line
@wudi
wudi / test_json_bug.php
Created November 19, 2015 09:19
Test Json Bug
<?php
/**
* lvcha.
*
* Author: wudi <[email protected]>
* Date: 2015/11/19
*/
class Person implements JsonSerializable
{
@wudi
wudi / homebrew_proxy.txt
Created October 12, 2015 15:18
homebrew proxy 代理
ALL_PROXY=socks5://127.0.0.1:9001 brew upgrade
@wudi
wudi / uri-templates.md
Last active August 29, 2015 14:19
summary Implementations of the URI Template specification
127.0.0.1:12345> TTL key # 尚未过期
(integer) 3
127.0.0.1:12345> TTL key
(integer) 1
127.0.0.1:12345> TTL key # 虽然键已经过期,但因为我阻塞住了主服务器,
(integer) 0 # 而主服务器没办法向从服务器发送 DEL 命令,所以值会一直滞留在从服务器里面。
127.0.0.1:12345> GET key
"value"
127.0.0.1:12345> TTL key
(integer) 0

集群

CLUSTER INFO 打印集群的信息

CLUSTER NODES 列出集群当前已知的所有节点(node),以及这些节点的相关信息。

节点

@wudi
wudi / cls_template.php
Created January 28, 2015 15:24
ECshop preg_replace /e 修饰符修复(本文件可直接替换2.7.3)
<?php
/**
* ECSHOP 模版类
* ============================================================================
* * 版权所有 2005-2012 上海商派网络科技有限公司,并保留所有权利。
* 网站地址: http://www.ecshop.com;
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
* 使用;不允许对程序代码以任何形式任何目的的再发布。
@wudi
wudi / userAgents.js
Created January 12, 2015 02:45
userAgents.js
userAgents = [{'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0'},
{"User-Agent": "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1) Gecko/20090624 Firefox/3.5"},
{'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6'},
{"User-Agent":"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1"},
{"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.11 TaoBrowser/2.0 Safari/536.11"},
{"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.71 Safari/537.1 LBBROWSER"},
{"User-Agent":"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; LBBROWSER)"},
{"User-Agent":"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 732; .NET4.0C; .NET4.0E; LBBROWSER)"},
{"U
<?php
function distance($data1, $data2) {
$num = 0;
for ($i = 0; $i < sizeof($data1); $i++) {
$num += pow($data1[$i] - $data2[$i], 2);
}
return sqrt($num);
}
@wudi
wudi / Imagick.php
Created October 16, 2014 05:10
Imagick图片处理类库
<?php
class Imagick
{
/**
* @var \Imagick
*/
private $image = NULL;
private $type = NULL;