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 main | |
import ( | |
iconv "github.com/djimenez/iconv-go" | |
"io/ioutil" | |
"log" | |
"net/http" |
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 org.nutz.lang.util; | |
import java.io.BufferedInputStream; | |
import java.io.DataInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.lang.reflect.Constructor; | |
import java.lang.reflect.Method; | |
import java.util.ArrayList; | |
import java.util.HashMap; |
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 ddns | |
import ( | |
"log" | |
"net" | |
"sync" | |
) | |
var ( | |
dnsLock = &sync.Mutex{} |
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
LOCAL_PATH := $(call my-dir) | |
include $(CLEAR_VARS) | |
# NDK 7d支持硬浮点的直接编译 | |
#APP_ABI := armeabi-v7a-hard | |
LOCAL_MODULE := liblive555 | |
LOCAL_ARM_MODE := arm |
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
func PathExist(_path string) bool { | |
_, err := os.Stat(_path) | |
if err != nil && err.Error() == os.ErrNotExist.Error() { | |
return false | |
} | |
return true | |
} | |
// golang新版本的应该 | |
func PathExist(_path string) bool { |
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
-- from http://stackoverflow.com/questions/132397/get-back-the-output-of-os-execute-in-lua | |
function os.capture(cmd, raw) | |
local f = assert(io.popen(cmd, 'r')) | |
local s = assert(f:read('*a')) | |
f:close() | |
if raw then return s end | |
s = string.gsub(s, '^%s+', '') | |
s = string.gsub(s, '%s+$', '') | |
s = string.gsub(s, '[\n\r]+', ' ') |
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 main | |
import ( | |
"log" | |
"net/http" | |
"syscall" | |
"unsafe" | |
) | |
func main() { |
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
@SuppressWarnings("unchecked") | |
public static <T> T insertOrUpdate(Dao dao, T obj) { | |
if (obj == null) | |
return null; | |
Entity<T> en = (Entity<T>) dao.getEntity(obj.getClass()); | |
if (en.getPkType() == PkType.UNKNOWN) | |
throw new IllegalArgumentException("no support , without pks"); | |
boolean doInsert = false; | |
switch (en.getPkType()) { | |
case ID: |
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
//from http://0x55aa.sinaapp.com/%E7%AE%97%E6%B3%95-%E7%BC%96%E7%A8%8B/676.html?1348618006 | |
package main | |
import ( | |
"fmt" | |
"os" | |
"errors" | |
"strings" | |
) | |
//no tag |
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
public class JSON2Java { | |
private static final ScriptEngine jsonParser; | |
static { | |
try { | |
String init = read(JSON2Java.class.getResource("json2java.js")); | |
ScriptEngine engine = new ScriptEngineManager().getEngineByName("JavaScript"); | |
engine.eval(init); | |
jsonParser = engine; |
NewerOlder