Skip to content

Instantly share code, notes, and snippets.

@kevinho
kevinho / bitcoin-address-utxo.html
Created July 12, 2023 02:36 — forked from shesek/bitcoin-address-utxo.html
Bitcoin address UTXO extractor based on Blockstream's API
<!DOCTYPE html>
<meta charset="utf-8">
<title>Bitcoin address UTXO extractor</title>
<style>
table, .csv { display: none }
</style>
<div class="container py-5">
<h2>Bitcoin address UTXO query</h2>
<form class="mt-3">
<div class="form-group">
@kevinho
kevinho / latency.txt
Created September 16, 2020 16:16 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@kevinho
kevinho / shuffleBySeed
Created March 30, 2020 01:15 — forked from fangzhen51236/shuffleBySeed
YouChain可验证发牌demo规则公示
洗牌随机数生成规则:
洗牌随机数由三个玩家的公钥、预言机随机数、牌局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;
}
0x957c2210A92aeDeff6d7c380182FA98a8e62f08A
0xa9c51D0113FCe30aED75CB64365acB0c1f224159
https://gist.github.com/kevinho/304a537f98e52ee01b56b4f0cabd3afc
0xa9c51D0113FCe30aED75CB64365acB0c1f224159
@kevinho
kevinho / README.md
Created November 25, 2016 12:45 — forked from awmichel/README.md
Docker Machine OSX Autostart

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 January 18, 2016 13:01 — forked from ikarius/md5.groovy
How to generate a MD5 hash in 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 January 18, 2016 03:04
log for exception of espesso
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