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 FindProxyForURL = function(init, profiles) { | |
return function(url, host) { | |
"use strict"; | |
var result = init, scheme = url.substr(0, url.indexOf(":")); | |
do { | |
result = profiles[result]; | |
if (typeof result === "function") result = result(url, host, scheme); | |
} while (typeof result !== "string" || result.charCodeAt(0) === 43); | |
return result; | |
}; |
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 | |
* @param {element} el 目标DOM节点 | |
* @param {number} page 当前页 | |
* @param {number} total 总页数 | |
* @param {function} change 点击翻页回调函数 | |
* | |
* @returns {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
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* Ternary search trie basic implementation. This piece of code was modified by Dimitris Vlachakis | |
* on 18/9/2017. You can find more info about the original work and its authors (Robert Sedgewick | |
* and Kevin Wayne) <a href="http://algs4.cs.princeton.edu/52trie/TST.java.html">here</a>. | |
*/ | |
public class TST<Value> { | |
private int size; // 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
client.admin().indices().prepareCreate(source.toString().toLowerCase()).execute().actionGet(); | |
XContentBuilder xbMapping = XContentFactory.jsonBuilder().startObject().startObject("documents"); | |
xbMapping.startObject(ELASTIC_TTL).field("enabled", true).field("default", (30*60*1000)+"ms").endObject(); | |
xbMapping.startObject("properties"); | |
xbMapping.startObject("content").field("type", "string").endObject(); | |
xbMapping.startObject("insertedDate").field("type", "long").endObject(); | |
xbMapping.endObject(); | |
xbMapping.endObject().endObject(); | |
client.admin().indices().preparePutMapping("documents").setType("documents").setSource(xbMapping).execute().actionGet(); |
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
{ | |
"indices": { | |
"memory": { | |
"index_buffer_size": "30%" | |
} | |
}, | |
"index":{ | |
"number_of_replicas":0, | |
"number_of_shards":10, | |
"translog": { |
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 example; | |
import io.netty.channel.ChannelHandler; | |
import io.netty.channel.ChannelInitializer; | |
import io.netty.channel.socket.SocketChannel; | |
import io.netty.handler.codec.LengthFieldBasedFrameDecoder; | |
import io.netty.handler.codec.LengthFieldPrepender; | |
import io.netty.handler.codec.string.StringDecoder; | |
import io.netty.handler.codec.string.StringEncoder; | |
import io.netty.util.CharsetUtil; |
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
// ==UserScript== | |
// @name geektime copy | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description 让极客时间的内容可以复制! | |
// @author Rand01ph | |
// @match https://time.geekbang.org/column/* | |
// @grant none | |
// @require http://cdn.staticfile.org/jquery/2.1.1/jquery.min.js | |
// ==/UserScript== |
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
#!/usr/bin/env python | |
# coding:utf-8 | |
""" | |
A 'Crawler' for http://msdn.itellyou.cn/ | |
""" | |
import re | |
import urllib | |
import urllib2 |
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
// ==UserScript== | |
// @name CAS Auto Login | |
// @namespace lab.lightsing.me | |
// @version 0.1 | |
// @description CAS Auto Login | |
// @author lightsing | |
// @match https://cas.sustc.edu.cn/* | |
// ==/UserScript== | |
(function() { |
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
// ==UserScript== | |
// @name YoutubeSkipAd | |
// @version 1.6.3 | |
// @description Automatic skip-ad and hide in youtube. | |
// @author FRNathan13 | |
// @include /(http|https):\/\/www.youtube.com\/(.*) | |
// @grant none | |
// ==/UserScript== | |
(function() { |
OlderNewer