Skip to content

Instantly share code, notes, and snippets.

View sanlee42's full-sized avatar
🎯
Focusing

0xa sanlee42

🎯
Focusing
View GitHub Profile
#!/usr/bin/env python
'''
analyse the user's chrome behavior.
'''
import sqlite3
import urlparse
class AnalyseChrome:
'''
the user's chrome history log is writed by sqllite. and saved default in ~/.config/google-chrome/Default/History at ubuntu.
'''
README.html
#! /bin/env python
def gen_func1(n):
for i in range(n):
callback = lambda : i
yield callback
def gen_func2(n):
for i in range(n):
def genf(i):
return lambda: i
(ns search.core
(:use clojure.test))
(defn binary-search
"binary search"
[coll start end key]
^{:pre [(> start -1) (< end (count coll))]}
(if (> start end)
-1
(let [mid (quot (+ start end) 2)
mvalue (nth coll mid)]
@sanlee42
sanlee42 / latency.txt
Created September 29, 2016 10:46 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
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
package main
import (
"bytes"
"encoding/binary"
"encoding/hex"
"encoding/json"
"fmt"
)

Starcoin EasyGas 是一个结合 Starcoin DAO 进行线上治理的一个应用。用户可以发起投票来决定哪些 Token 可以用作 Gas Fee 的支付。

以下是通过 Starcoin EasyGas 从发起投票到将某个 Token 用于支付 Gas Fee 的一个例子:

  1. 用户发起投票,提议将某个 Token 用作 Gas Fee 的支付方式。
  2. 其他用户可以对该提议进行投票,表决是否支持该提议。
  3. 如果提议获得足够的支持,则该提议将成为决议,并被添加到 Starcoin DAO 的决策记录中。
  4. 当用户在 Starcoin 网络上进行交易时,可以使用被授权的 Token 来支付 Gas Fee。 上述过程可以在 Starcoin 的开发网络(devnet)或 Proxima 网络中进行测试。