Skip to content

Instantly share code, notes, and snippets.

@EvanYellow
EvanYellow / ajaxrequest.js
Last active December 25, 2015 14:08
d3 keyword
//<script type="text/javascript" src="${resroot}/javascripts/lib/d3.v3.min.js"></script>
//<script type="text/javascript" src="${resroot}/javascripts/lib/d3.layout.cloud.js"></script>
/**
* EX: arr = [{"text":123,"size":12}]
* */
var arr = [];
var fill = d3.scale.category20();
d3.layout.cloud().size([700, 250])
.words(arr)
.rotate(function() { return Math.ceil(Math.random()*40)-20; })
scan 'test', {COLUMNS => ['F'],FILTER => "(SingleColumnValueFilter('F','u',=,'regexstring:http:.*pdf',true,true)) AND (SingleColumnValueFilter('F','s',=,'binary:2',true,true))"}
/** This is a fairly well optimized object which alows
* access to binary files from JScript on a Windows
* operating system.
*
* A the end of the file is small set of tests to show how it
* is used. You will require ADODB 2.5 or higher installed.
* this will be so on most 2000 machines and all XP or higher
* machines.
*
* CopyRight: Dr Alexander J Turner - all rights reserved.
@EvanYellow
EvanYellow / TestRedisPrefix.java
Last active December 29, 2015 01:39
prefix search base redis
package com.xxx.xxx;
import org.junit.Test;
import redis.clients.jedis.Jedis;
import java.util.*;
/**
* User: evanhuang
*/
@EvanYellow
EvanYellow / NetworkUtils.java
Created December 9, 2013 12:08
es select intf
/**
* Returns the first non-loopback address on any interface on the current host.
*
* @param ip_version Constraint on IP version of address to be returned, 4 or 6
*/
public static InetAddress getFirstNonLoopbackAddress(StackType ip_version) throws SocketException {
InetAddress address = null;
Enumeration intfs = NetworkInterface.getNetworkInterfaces();
@EvanYellow
EvanYellow / NetworkService.java
Created December 9, 2013 16:17
es select itf 2
public InetAddress resolveInetAddress(String host, String defaultValue1, String defaultValue2) throws UnknownHostException, IOException {
if (host == null) {
host = defaultValue1;
}
if (host == null) {
host = defaultValue2;
}
if (host == null) {
for (CustomNameResolver customNameResolver : customNameResolvers) {
InetAddress inetAddress = customNameResolver.resolveDefault();
@EvanYellow
EvanYellow / ajaxrequest.js
Created January 2, 2014 05:19
force graph
function renderConfidants(dom){
var data = JSON.parse(currentProfile.confidants);
if($.isEmptyObject(data)){
return;
}
var formatData = {"nodes":[], "links":[]};
formatData.nodes.push({
"type" : 3,
"img_href" : 'http://tp2.sinaimg.cn/' + currentProfile.uid + '/50/0/0',
"width": 50,
public void getOneUserMention(String userId, long lastMsgTime, String nickname) {
if (sinaToken == null) {
LOG.info(userId + ", userMention get token null!");
return;
}
if (!isOwnToken) {
LOG.info(userId + ", userMention no ownToken, exit!");
return;
}
try {