Skip to content

Instantly share code, notes, and snippets.

View jaekwon's full-sized avatar

Jae Kwon jaekwon

View GitHub Profile
@jaekwon
jaekwon / gist:76bcb80081ce39b1588d
Created June 29, 2015 20:33
SortString in Golang
package main
import (
"sort"
"testing"
)
// SortString sorts a string
func SortString(w string) string {
wBytes := uint8Slice([]uint8(w))

Keybase proof

I hereby claim:

  • I am jaekwon on github.
  • I am jaekwon (https://keybase.io/jaekwon) on keybase.
  • I have a public key whose fingerprint is F3E6 04B9 02C6 3CC5 EA2E 4FB6 BBCF 2AC7 7899 206D

To claim this, I am signing this object:

@jaekwon
jaekwon / gist:368238e7b4f4ea4925dc
Created May 24, 2015 22:27
Tendermint + GopherJS
39015 default
5353 gopherjs/js
4667 runtime
847 errors
1926 sync/atomic
22451 sync
4968 io
18733 unicode
6980 unicode/utf8
@jaekwon
jaekwon / gist:0f6e5555ab6a592aa4c8
Last active August 29, 2015 14:21
Example of Go composition
// Compare to https://gist.github.com/jaekwon/8025b9f3a482b3219a21
package main
import "fmt"
type Human struct{}
func (h Human) walk() { h.moveFeet() }
func (h Human) moveFeet() { fmt.Println("Human.walkFeet") }
@jaekwon
jaekwon / gist:8025b9f3a482b3219a21
Created May 22, 2015 15:33
Example of Java inheritance that overrides a baseclass's behavior
import java.util.*;
import java.lang.*;
import java.io.*;
class Human {
public Human() {}
public void walk() {
this.moveFeet();
}
public void moveFeet() {
@jaekwon
jaekwon / default.cfg
Created May 5, 2015 01:34
default.cfg
{
"Remotes": [
"http://navytoad.chaintest.net:46662",
"http://whiteferret.chaintest.net:46662",
"http://magentagriffin.chaintest.net:46662",
"http://greensalamander.chaintest.net:46662",
"http://blackshadow.chaintest.net:46662",
"http://pinkpenguin.chaintest.net:46662",
"http://polkapig.chaintest.net:46662"
],
INFO[04-02|19:50:25] Running round action module=consensus height=72872 round=0 step=RoundStepPrecommit roundAction="RoundAction{H:72872 R:0 A:RoundActionCommit}" startTime=2015-04-02T19:50:15-0700
INFO[04-02|19:50:25] Running round action module=consensus height=72872 round=0 step=RoundStepCommit roundAction="RoundAction{H:72872 R:0 A:RoundActionTryFinalize}" startTime=2015-04-02T19:50:15-0700
INFO[04-02|19:50:28] Running round action module=consensus height=72873 round=0 step=RoundStepNewHeight roundAction="RoundAction{H:72873 R:0 A:RoundActionPropose}" startTime=2015-04-02T19:50:28-0700
INFO[04-02|19:50:31] Running round action module=consensus height=72873 round=0 step=RoundStepPropose roundAction="RoundAction{H:72873 R:0 A:RoundActionPrevote}" startTime=2015-04-02T19:50:28-0700
INFO[04-02|19:50:35] Running round action module=consensus height=72873 round=0 step=RoundStepPrevote roundAction="RoundAction{H:7
@jaekwon
jaekwon / gist:1863914d728ef5fbe676
Created March 27, 2015 18:40
Testing ReadBinary from interface reflection type
diff --git a/binary/reflect_test.go b/binary/reflect_test.go
index d8055f5..ac54236 100644
--- a/binary/reflect_test.go
+++ b/binary/reflect_test.go
@@ -2,6 +2,7 @@ package binary
import (
"bytes"
+ "fmt"
"reflect"
@jaekwon
jaekwon / gist:504e1424b08494cf23b2
Created February 17, 2015 23:13
PoC7/8 Opcodes
0x00 STOP 0x30 ADDRESS 0x60 PUSH1 0x80 DUP1 0xA0 LOG0
0x01 ADD 0x31 BALANCE 0x61 PUSH2 0x81 DUP2 0xA1 LOG1
0x02 MUL 0x32 ORIGIN 0x62 PUSH3 0x82 DUP3 0xA2 LOG2
0x03 SUB 0x33 CALLER 0x63 PUSH4 0x83 DUP4 0xA3 LOG3
0x04 DIV 0x34 CALLVALUE 0x64 PUSH5 0x84 DUP5 0xA4 LOG4
0x05 SDIV 0x35 CALLDATALOAD 0x65 PUSH6 0x85 DUP6
0x06 MOD 0x36 CALLDATASIZE 0x66 PUSH7 0x86 DUP7 0xF0 CREATE
0x07 SMOD 0x37 CALLDATACOPY 0x67 PUSH8 0x87 DUP8 0xF1 CALL
0x08 ADDMOD 0x38 CODESIZE 0x68 PUSH9 0x88 DUP9 0xF2 CALLCODE
0x09 MULMOD 0x39 CODECOPY 0x69 PUSH10 0x89 DUP10 0xF3 RETURN
@jaekwon
jaekwon / gist:b80fe2bcc1d077e3c40d
Created January 6, 2015 21:28
test genesis.json for Tendermint
{
"Accounts": [
{
"Address": "6070ff17c39b2b0a64ca2bc431328037fa0f4760",
"Amount": 200000000
}
],
"Validators": [
{
"PubKey": "01206bd490c212e701a2136eeea04f06fa4f287ee47e2b7a9b5d62edd84cd6ad9753",