Skip to content

Instantly share code, notes, and snippets.

View khotyn's full-sized avatar
😌
Focusing

Khotyn Huang khotyn

😌
Focusing
View GitHub Profile
@khotyn
khotyn / test.sh
Last active August 29, 2015 14:09
Bash wired bug
#/bin/bash
function f() {
local v=()
echo ${#v[@]}
}
f
@khotyn
khotyn / 0_reuse_code.js
Created June 15, 2014 15:37
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@khotyn
khotyn / DefaultTest.java
Last active January 3, 2016 18:29
Java 8 中的接口的 default 关键字测试
package com.khotyn.java8;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/**
* 测试 Java 8 中的接口的 default 功能
*
@khotyn
khotyn / 台湾环岛骑行准备.md
Created October 21, 2013 13:20
台湾环岛骑行准备

台湾环岛骑行准备

@khotyn
khotyn / AgentInstall.java
Created December 6, 2012 14:45
Adding an annotation to a class then redefine it
package com.khotyn.test;
import java.lang.instrument.Instrumentation;
public class AgentInstall {
public static void premain(String agentArgs, Instrumentation inst) {
InstrumentationHolder.setInstrumentation(inst);
}
}
@khotyn
khotyn / CircularArray.java
Created October 18, 2012 14:00
一个无限容量的用于 Work Steeling 的 DEQueue 的实现
package com.khotyn.test;
/**
* Created with IntelliJ IDEA.
* User: khotyn
* Date: 12-10-18
* Time: 下午9:14
* To change this template use File | Settings | File Templates.
*/
public class CircularArray {
@khotyn
khotyn / ConditionalExpressionTest.java
Created September 4, 2012 13:20
Conditional Expression Type Oddity
/**
* Conditional Expression Test. The result is
*
* <pre>
* 114.0
* class java.lang.Double
* </pre>
*
* So why the result is 114.0, the ASCII value of <code>'r'</code>? First, the
* <code>new Double(0)</code> is convert to primary type <code>double</code>,
@khotyn
khotyn / IntegerTest.java
Created September 4, 2012 13:01
Integer Caching
/**
* {@link Integer} will cache the integers between -128 and 127 (inclusive). See
* {@link Integer#valueOf(int)} for detail implementation.
*
* @author khotyn
*
*/
public class IntegerTest {
public static void main(String[] args) {
@khotyn
khotyn / varamyr.py
Created June 12, 2012 12:31
A simple tool named Varamyr written in Python to add some css to the epub file so books written in Chinese can be read in Nook.
from xml.dom.minidom import getDOMImplementation, parse, parseString
import zipfile
import sys
font = """\n<style type='text/css'>\n
@page {\n
margin-bottom: 5pt;\n
margin-top: 5pt\n
}\n
@font-face {\n
@khotyn
khotyn / gist:2851303
Created June 1, 2012 11:12 — forked from zythum/gist:2848881
google收录的敏感词