Skip to content

Instantly share code, notes, and snippets.

kvh kevinho

Block or report user

Report or block kevinho

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kevinho
kevinho / shuffleBySeed
Created Mar 30, 2020 — forked from fangzhen51236/shuffleBySeed
YouChain可验证发牌demo规则公示
View shuffleBySeed
洗牌随机数生成规则:
洗牌随机数由三个玩家的公钥、预言机随机数、牌局id顺序拼接而成,其中玩家的公钥按照玩家进入牌局的顺序进行拼接;
将拼接后的字符串转为16进制得到该牌局的洗牌随机数;
public static String getRandSeries(String pubKey1, String pubKey2, String pubKey3, String id){
SecureRandom random = new SecureRandom();
String randSeries = byte2HexStr((pubKey1+pubKey2+pubKey3+random.nextInt()+id).getBytes());
return randSeries;
}
View gist:2ac5f45553e600cf1be4cd8f8ee77fb0
https://gist.github.com/kevinho/304a537f98e52ee01b56b4f0cabd3afc
@kevinho
kevinho / README.md
Created Nov 25, 2016 — forked from awmichel/README.md
Docker Machine OSX Autostart
View README.md

Docker Machine OSX Autostart

This is a simple launchd config that will start your default docker-machine on startup. You can customize the machine that is started by updating lines 11 and 16 with the correct machine name.

Install

  1. Copy the file com.docker.machine.default.plist below to ~/Library/LaunchAgents/com.docker.machine.default.plist.
  2. Run the following in a terminal: launchctl load ~/Library/LaunchAgents/com.docker.machine.default.plist
  3. Profit!
@kevinho
kevinho / md5.groovy
Created Jan 18, 2016 — forked from ikarius/md5.groovy
How to generate a MD5 hash in Groovy ...
View md5.groovy
def generateMD5(String s) {
MessageDigest digest = MessageDigest.getInstance("MD5")
digest.update(s.bytes);
new BigInteger(1, digest.digest()).toString(16).padLeft(32, '0')
}
@kevinho
kevinho / espresso_log
Created Jan 18, 2016
log for exception of espesso
View espresso_log
Running tests
Test running started
android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with content description: is "bugtags_fab_des_normal"
View Hierarchy:
+>DecorView{id=-1, visibility=VISIBLE, width=1080, height=1920, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+->LinearLayout{id=-1, visibility=VISIBLE, width=1080, height=1776, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+-->ViewStub{id=16909227, res-name=action_mode_bar_stub, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=tru
@kevinho
kevinho / OomExceptionHandler.java
Created Dec 5, 2015 — forked from pyricau/OomExceptionHandler.java
Dump the heap on OutOfMemoryError crashes in your debug builds.
View OomExceptionHandler.java
import android.content.Context;
import android.os.Debug;
import java.io.File;
public class OomExceptionHandler implements Thread.UncaughtExceptionHandler {
private static final String FILENAME = "out-of-memory.hprof";
public static void install(Context context) {
Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
You can’t perform that action at this time.