- Find code examples at https://github.com/ckb-cell/rgbpp-sdk/tree/develop/examples/rgbpp
- CKB Scripts (Contracts)
- CKB Bitcoin SPV Type Script: A type script for Bitcoin SPV clients which synchronize Bitcoin state into CKB
import * as web3 from "@solana/web3.js"; | |
////////////////////////////////////////////////// | |
function readBytes(buf: Buffer, offset: number, length: number): Buffer { | |
const end = offset + length; | |
if (buf.byteLength < end) throw new RangeError("range out of bounds"); | |
return buf.subarray(offset, end); | |
} |
Error Code (as uint256 hex number) |
Description |
---|---|
0x00 |
Used for generic compiler inserted panics. |
0x01 |
If you call assert with an argument that evaluates to false . |
0x11 |
If an arithmetic operation results in underflow or overflow outside of an unchecked { ... } block. |
0x12 |
If you divide or modulo by zero (e.g. 5 / 0 or 23 % 0 ) |
0x21 |
If you convert a value that is too big or negative into an enum type. |
0x22 |
If you access a storage byte array that is incorrectly encoded. |
0x31 |
If you call .pop() on an empty array. |
0x32 |
If you access an array, bytesN or an array slice at an out-of-bounds or negative index (i.e. x[i] where i >= x.length or i < 0 ). |
newmtl palette
illum 1
Ka 0.000 0.000 0.000
Kd 1.000 1.000 1.000
Ks 0.000 0.000 0.000
map_Kd monu1.vox.png # 可以换成其他图片。
from operator import mul, add | |
from functools import reduce | |
def chinese_remainder_theorem(tuple): | |
transpose = list(zip(*tuple)) | |
product = reduce(mul, transpose[0]) | |
min_result = reduce(add, [ | |
j * l *(l%i) for i,j in tuple for l in [reduce(mul, [k for k in transpose[0] if k != i])] | |
]) % product | |
print("The value is: %s + n * %s which n = 0..inf" % (min_result, product)) | |
return min_result, product |
🥇 Instead of sending Ether, use the withdrawal pattern
🥈 If you really need to send Ether, use a safe wrapper like OpenZeppelin's Address.sendValue(addr, amount)
🥉 If you really need to send Ether without dependencies, use (bool success, ) = addr.call{value: amount}("")
# From https://stackoverflow.com/a/68876046/1319998, which is itself inspired by https://stackoverflow.com/a/68814418/1319998 | |
from contextlib import contextmanager | |
from collections import namedtuple | |
from ctypes import cdll, byref, string_at, c_char_p, c_int, c_double, c_int64, c_void_p | |
from ctypes.util import find_library | |
from sys import platform | |
def query(db_file, sql, params=()): |
########################################################### | |
# How to NEVER use lambdas. An inneficient and yet educa- # | |
# tonal [sic] guide to the proper misuse of the lambda # | |
# construct in Python 3.x. [DO NOT USE ANY OF THIS EVER] # | |
# original by (and apologies to): e000 (13/6/11) # | |
# now in Python 3 courtesy of: khuxkm (17/9/20) # | |
########################################################### | |
## Part 1. Basic LAMBDA Introduction ## | |
# If you're reading this, you've probably already read e000's |
// these aren't _quite_ functional tests, | |
// and should all be compile_fail, | |
// but may be illustrative | |
#[test] | |
fn concurrent_set() { | |
use std::sync::Arc; | |
let x = Arc::new(Cell::new(42)); | |
let x1 = Arc::clone(&x); | |
std::thread::spawn(move || { |
I use GitHub nearly every day. In general, it's delightful to use and I've been impressed with the rapid pace of improvements, especially as of late.
That said, there's a handful of features that would have a big impact on my day-to-day experience. I'm cataloging them here with the aim of increasing visibility and prompting further discussion.
Disclaimer: It is not my intention that any visual designs be taken literally – I only hope that they may serve as useful source of inspiration.