Skip to content

Instantly share code, notes, and snippets.

View asinbow's full-sized avatar

Hao Wang asinbow

  • Flexport
  • Shenzhen, PRC
View GitHub Profile
load("//junit5.bzl", "java_junit5_test")
java_junit5_test(
# ...
main_class = "com.flexport.bazeljunit5.BazelJUnit5ConsoleLauncher",
deps = [
"//bazeljunit5/src/main/java/com/flexport/bazeljunit5",
# ...
]
)
bazel run //*:test "--test_filter=com.package.EnvTest#testEnv"
# or right click on a single test in a `*Test.java` file and and select "Run ..." in your IDE (e.g. IntelliJ IDEA)
@asinbow
asinbow / addon.cc
Created November 16, 2015 03:38 — forked from matzoe/addon.cc
Node.js callback cross threads
// http://nikhilm.github.io/uvbook/threads.html
#include <string>
#include <map>
#include <node.h>
#include <v8.h>
#include <uv.h>
#include <sys/syscall.h>
#include <stdlib.h>
@asinbow
asinbow / gtk_compact_for_eclipse.rc
Created January 18, 2013 05:33
gtk compact for eclipse
gtk_icon_sizes="panel_menu=16,16:panel=16,16:gtk_menu=12,12:gtk_small_toolbar=16,16:gtk_large_toolbar=16,16:gtk_button=16,16:gtk_dialog=16,16:gtk_dnd=16,16"
style"gtkcompact"{
# font_name="Sans9"
GtkButton::default_border={0,0,0,0}
GtkButton::default_outside_border={0,0,0,0}
GtkButton::child_displacement_x=1
GtkButton::child_displacement_y=1
GtkButtonBox::child_min_height=20
GtkButtonBox::child_min_width=80
GtkButtonBox::child_internal_pad_x=0
@asinbow
asinbow / Makefile
Created September 8, 2012 14:44 — forked from border/Makefile
json example in golang
include $(GOROOT)/src/Make.inc
GOFMT=gofmt -spaces=true -tabindent=false -tabwidth=4
all:
$(GC) jsontest.go
$(LD) -o jsontest.out jsontest.$O
format:
$(GOFMT) -w jsontest.go
@asinbow
asinbow / gist:3338259
Created August 13, 2012 08:34
Sequelize ORM operations
var Sequelize = require('sequelize');
var sequelize = new Sequelize('db', 'user', 'pass', {
dialect: 'mysql',
pool: {
maxConnections: 5,
maxIdleTime: 30
}
});
var User = sequelize.define("User", {
@asinbow
asinbow / gist:3329926
Created August 12, 2012 05:27
nodejs socket programming
// server
var net = require('net');
var HOST = '127.0.0.1';
var PORT = 6969;
// Create a server instance, and chain the listen function to it
// The function passed to net.createServer() becomes the event handler for the 'connection' event
// The sock object the callback function receives UNIQUE for each connection
net.createServer(function(sock) {
@asinbow
asinbow / gist:3295564
Created August 8, 2012 14:44
javascript simple class
function Person(id, name) {
this.id = id;
this.name = name;
this.toString = function() {
return "" + this.id + ": " + this.name;
}
var test = function() {
alert(123);
@asinbow
asinbow / gist:2996682
Created June 26, 2012 16:00
scala/java get md5 checksum
"123".getBytes
val md = java.security.MessageDigest.getInstance("MD5")
md.update("d123".getBytes)
md.digest()
val md5 = org.apache.commons.codec.binary.Hex.encodeHex(res)
new String(md5)
@asinbow
asinbow / mongodb replica set & sharding
Created March 29, 2012 02:11
mongodb replica set & sharding
### start server
```sh
sudo mongod --reset --replSet replsetname --dbpath dbfilepath --port serverport --keyFile authkeyfile --auth
```
### show config
```javascript
rs.conf()
```