Skip to content

Instantly share code, notes, and snippets.

@charleehu
charleehu / EquivalentBinaryTrees.go
Last active March 23, 2018 07:00
exercises of Go tour
package main
import (
"golang.org/x/tour/tree"
"fmt"
)
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {
@charleehu
charleehu / tie.html
Last active November 30, 2015 07:39
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我是标题</title>
<style>
body {
padding-top: 2.5em;
background-color: #666;
color: #333;
/**
* DFA敏感词过滤
* <pre>
* 五 = {
* isEnd = 0
* 星 = {
* isEnd = 0
* 红 = {
* isEnd = 0
* 旗 = { isEnd = 1 }
@charleehu
charleehu / TestPay.java
Created November 10, 2014 07:41
MPAY支付DEMO
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
*
* @author <a href="mailto:[email protected]">Xiaowei Hu</a>
* @version 1.0 2012-8-1 下午03:17:19
* @since 1.0
*/
@charleehu
charleehu / JedisProxy.java
Created July 25, 2012 02:06
两种使用jedis的方法
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.concurrent.TimeoutException;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisCommands;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.exceptions.JedisException;
@charleehu
charleehu / build.properties
Created July 3, 2012 06:08
ant script for ios air app package
#Native iOS Extension app
app.rootdir=.
app.sourcedir=${app.rootdir}/src
app.builddir=${app.rootdir}/build
app.releasedir=${app.rootdir}/release
app.extensions_dir=${app.rootdir}/extensions
build.storetype=pkcs12
build.keystore=${app.rootdir}/app_signing/iOS/dev.p12
build.storepass=123456
@charleehu
charleehu / Weight.java
Created May 9, 2012 10:09
Weight algorithm
/**
* $Id: WeightUtil.java 406 2012-08-14 07:44:42Z xiaowei.hu $
* Copyright 2012-2014 Oak Pacific Interactive. All rights reserved.
*/
package com.renren.socialgame.kp.util;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@charleehu
charleehu / Case.java
Created May 5, 2012 11:06
BTrace sample
import java.util.Random;
public class Case1{
public static void main(String[] args) throws Exception{
Random random=new Random();
CaseObject object=new CaseObject();
boolean result=true;
while(result){
result=object.execute(random.nextInt(1000));
Thread.sleep(1000);
@charleehu
charleehu / log4j.properties
Created March 31, 2012 03:53
a bak for log4j.properties
#------------------------------------------------------------------------------
#
# The following properties set the logging levels and log appender. The
# log4j.rootCategory variable defines the default log level and one or more
# appenders. For the console, use 'S'. For the daily rolling file, use 'R'.
# For an HTML formatted log, use 'H'.
#
# To override the default (rootCategory) log level, define a property of the
# form (see below for available values):
#