Skip to content

Instantly share code, notes, and snippets.

travis_fold:start:worker_info
Worker information
hostname: 7d4318a6-17d9-4ec3-8b04-c2f086958916@1.worker-com-79d58db94b-twptq.macstadium-prod-1
version: v6.2.0 https://github.com/travis-ci/worker/tree/5e5476e01646095f48eec13196fdb3faf8f5cbf7
instance: 28eb05c9-5652-4326-8c0f-124bd022a535 travis-ci-macos10.13-xcode9.4.1-19-1576204381 (via amqp)
startup: 1m14.132745988s
travis_fold:end:worker_info
travis_time:start:06795887
travis_time:end:06795887:start=1596555768714776000,finish=1596555769359196000,duration=644420000,event=no_world_writable_dirs
travis_time:start:28309ac0

KVStore 杂谈

Secondary Index

RDBMS and SQL

Employees table structure:

RPC

RPC 调用使用了 method missing 自动生成,统一返回结果是 Hash,而不是定义的 Class Type。优点:ckb 新加或者调整 rpc 方法,sdk 不需要跟随升级,缺点:需要查看 ckb 文档调用,ruby doc 无法生成文档,IDE 无自动提示。

RPC 参数做了 Integer 到 Hex 自动转化,方便调用(特别是分页参数这种)

调用方式和之前一样:

rpc = CKB::RPC.new
@quake
quake / README.md
Last active February 26, 2020 09:37

在本篇文档里,我们会使用 mruby 来作为编程语言演示如何在 CKB 实现一个最基础 UDT (User Defined Token) 合约

Dev Chain

首先我们需要启动一个本地的开发链来方便调试

配置矿工信息

我们先用 ckb-cli 命令生成一个新账户用于挖矿,运行 ckb-cli,然后输入

account new
fn foo(foo: u32) -> u32 {
println!("foo {}", foo);
foo + 1
}
#[derive(Debug)]
struct Bar {
bar1: u32,
bar2: u32,
bar3: u32,
@quake
quake / error.md
Last active August 12, 2019 14:49
2019-08-12 14:38:12.928 +00:00 NetworkRuntime-0 ERROR panic  thread 'NetworkRuntime-0' panicked at 'please check if reach a deadlock': src/libcore/option.rs:1036stack backtrace:
   0: ckb_logger::setup_panic_logger::{{closure}}::h37ba76f9d9060c7e (0x55e53e65775f)
             at util/logger/src/lib.rs:277
   1: std::panicking::rust_panic_with_hook::h057ff03eb4c8000f (0x55e53e75fb09)
             at src/libstd/panicking.rs:478
   2: std::panicking::continue_panic_fmt::ha6d6ae144369025b (0x55e53e75f5a2)
             at src/libstd/panicking.rs:381
   3: rust_begin_unwind (0x55e53e75f486)
             at src/libstd/panicking.rs:308
[dev-dependencies]
tokio-core = "0.1"
libp2p-tcp-transport = { path = "../tcp-transport"}
libp2p-peerstore = { path = "../peerstore"}
multiplex = { path = "../multiplex-rs" }
rand = "0.4"
env_logger = "0.5.4"
struct ContainerFoo(i32, i32);
struct ContainerBar(i64, i64);
trait Contains {
type A;
type B;
fn contains(&self, &Self::A, &Self::B) -> bool;
}
/*
破解 http://geetest.com/tryit/
打开浏览器在console里面运行如下代码
加载jquery模拟drag脚本,考虑到滑块大小,第一次直接拖动到50px,后续每秒钟拖动8px
从人工拖动的结果可以看出,该验证码方式位置误差在+/- 5px左右,所以50px+8px这样简单粗暴的2行代码就可以有30%的成功率
破解失败情况是在滑块缺口位置偏右了,导致尝试太多
加上图像识别滑块缺口位置,就可以轻松100%地破解
*/
function d(first) {
@quake
quake / gist:7972812
Created December 15, 2013 13:06
ActiveRecord输出上周被点击最多的文章标题
Blog.where(created_at: 1.week.ago.beginning_of_week..1.week.ago.end_of_week).order(view_counts: :desc).first.subject