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 / test_json_bug.php
Created November 19, 2015 09:19
Test Json Bug
<?php
/**
* lvcha.
*
* Author: wudi <wudi23@baidu.com>
* Date: 2015/11/19
*/
class Person implements JsonSerializable
{
@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 / html-include-replace.php
Last active December 24, 2015 03:18
html-include-replace.php
#!/usr/bin/env php
<?php
/**
* Auth: Eagle.Wu
* Usage:
* 1、 /bin/sh file.php /dir
* 2、 cd /dir && /bin/sh file.php
* 3、 cp file.php /usr/local/bin/file && chmod +x /usr/local/bin/file && && file /dir
@wudi
wudi / eagle-lambda-mod.itermcolors
Created January 11, 2016 15:26
eagle-lambda-mod.itermcolors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.0</real>
<key>Green Component</key>
<real>0.0</real>
@wudi
wudi / compare.c
Created January 13, 2016 03:13
nagative or positive
//ref: http://stackoverflow.com/questions/33882676/why-intunsigned-intintv
int compare(int x)
{
return -(int)(
(unsigned int)( (int) x ) >> ( sizeof(int) * CHAR_BIT - 1 )
);
}
//equal to
int compare(int x)
@wudi
wudi / tieba_list_pics.js
Last active January 27, 2016 07:49
Show 贴吧图片
javascript:!function() { document.getElementsByTagName('body')[0].scrollTop = 0; $('.search_bright').remove(); $('#com_userbar').remove(); $('#tbui_aside_float_bar').remove(); var posts_urls = []; var posts_title = []; var nodes = $('.j_thread_list .threadlist_title .j_th_tit'); $(nodes).each(function(e){ posts_urls.push($(nodes[e]).attr('href')); posts_title.push($(nodes[e]).text()); }); console.log(posts_urls); $('#pending').remove(); $('html>body').prepend('<center id="pending"><h1 style="color:red;">处理中...</h1></center>'); function loadCss(css_url) { var link = document.createElement('link'); link.type = 'text/css'; link.rel = 'stylesheet'; link.href = css_url; document.getElementsByTagName("head")[0].appendChild(link); } loadCss('//apps.bdimg.com/libs/jqueryui/1.10.4/css/jquery-ui.min.css'); loadCss('//blueimp.github.io/Gallery/css/blueimp-gallery.min.css'); $.getScript('//apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.js'); $.getScript('//7xiam0.com1.z0.glb.clouddn.com/jquery.blueimp-gallery.min.js'); va
.
├── README.md
├── bin
├── composer.json
├── composer.lock
├── shell
│   ├── README.md
│   ├── access.log
│   ├── build_sql.php
│   ├── com_center
@wudi
wudi / Makefile.golang
Created June 13, 2016 03:29 — forked from dnishimura/Makefile.golang
Makefile for Golang projects
# Makefile for a go project
#
# Author: Jon Eisen
# site: joneisen.me
#
# Targets:
# all: Builds the code
# build: Builds the code
# fmt: Formats the source files
# clean: cleans the code
@wudi
wudi / QingCloudDoc2ThriftIDL.js
Last active June 14, 2016 07:22
QingCloudDoc2ThriftIDL
var typeConvert = function(t){
switch(t) {
case "String":
case "TimeStamp":
return "string";
case "Integer":
return "i32";
case "Array":
return "list<string>";
default:
@wudi
wudi / concurrent_download.go
Last active July 8, 2016 13:23
concurrent_download
package main
import (
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"time"
)