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 [com.ning.compress.lzf LZFInputStream LZFOutputStream]) | |
(import [java.io.FileInputStream FileOutputStream]) | |
(require '[clojure.java.io :as io]) | |
(with-open [in (FileInputStream. "D:/tmp/dd.txt") | |
out (LZFOutputStream. (FileOutputStream. "D:/tmp/dd.lzf"))] | |
(io/copy in out)) | |
(with-open [in (LZFInputStream. (FileInputStream. "D:/tmp/dd.lzf")) | |
out (FileOutputStream. "D:/tmp/ddd.txt")] |
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 static List<byte[]> grouped(final byte[] input, final int length) { | |
if (length <= 0) { | |
throw new IllegalArgumentException("length must gt 0"); | |
} | |
List<byte[]> ret = new ArrayList<byte[]>(); | |
int r = input.length / length; | |
int from = 0; | |
int to = 0; | |
for (int i = 0; i < r; i++) { |
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
mvn install:install-file -DgroupId=org.aopalliance -DartifactId=com.springsource.org.aopalliance -Dversion=1.0.0 -Dfile=com.springsource.org.aopalliance-1.0.0.jar -Dpackaging=jar |
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 controllers | |
import ( | |
"fmt" | |
"time" | |
"github.com/astaxie/beego" | |
"github.com/astaxie/beego/context" | |
) |
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
$ cd /lib/x86_64-linux-gnu | |
$ sudo ln -s libudev.so.1 libudev.so.0 | |
edit /usr/bin/google-chrome, add line: | |
export LD_LIBRARY_PATH=/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH #Above The Non-last line |
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" | |
"reflect" | |
) | |
type IHello interface { | |
Hello() | |
} |
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 "reflect";func main(){ var a interface{} = 1;if a == nil { println("nil")};if a != nil { println(reflect.ValueOf(a).Int()) } ;} | |
//output: | |
1 |
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 appBootstrap() { | |
tryOverrideVarFromEnv(&beego.RunMode, "RunMode") | |
tryOverrideVarFromEnv(&beego.HttpPort, "HttpPort") | |
} | |
func tryOverrideVarFromEnv(target interface{}, key string) { | |
v := os.Getenv(key) | |
if v != "" { | |
switch t := target.(type) { | |
case *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
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
var a []int = nil | |
fmt.Printf("len[a]:%v\n", len(a)) // len[a]:0 | |
var b []int = []int{} |
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 "fmt" | |
func main() { | |
var s string = "" | |
var s1 string | |
fmt.Printf("len(s):%v\n", len(s)) // len(s):0 | |
fmt.Printf("len(s1):%v\n", len(s1)) //len(s1):0 |