Skip to content

Instantly share code, notes, and snippets.

View TheWaWaR's full-sized avatar
🌀
Focusing

LingFeng TheWaWaR

🌀
Focusing
View GitHub Profile
@TheWaWaR
TheWaWaR / Cargo.toml
Last active October 31, 2022 02:35
Rust ckb-sdk simple transfer tutorial
[package]
name = "ckb-sdk-transfer-tutorial"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = { version = "3.1.9", features = ["derive"] }
secp256k1 = { version = "0.20", features = ["recovery"] }
@TheWaWaR
TheWaWaR / upgrade-zig.sh
Last active October 5, 2022 14:09
Download zig binary extract it and link the executable file
set -e
DEFAULT_ZIG_DIR="$HOME/local/opt"
DEFAULT_BIN_DIR="$HOME/local/bin"
URL="${1}"
ZIG_DIR="${2:-$DEFAULT_ZIG_DIR}"
BIN_DIR="${3:-$DEFAULT_BIN_DIR}"
function error() {
@TheWaWaR
TheWaWaR / README.md
Created September 2, 2022 08:26 — forked from josephg/README.md
Getting Zig compiling to WASM

In case anyone else wants to play with Zig on webassembly, here's what you need to do to make it work on a mac today.

1. Get LLVM 7 compiled with webassembly support.

You'll need LLVM to output to the WASM target. This has just been added by default in trunk, so if LLVM >7 is available, you might be able to just brew install llvm.

If you have wasm support already you should see:

$ llc --version
@TheWaWaR
TheWaWaR / README.md
Created September 2, 2022 08:26 — forked from josephg/README.md
Getting Zig compiling to WASM

In case anyone else wants to play with Zig on webassembly, here's what you need to do to make it work on a mac today.

1. Get LLVM 7 compiled with webassembly support.

You'll need LLVM to output to the WASM target. This has just been added by default in trunk, so if LLVM >7 is available, you might be able to just brew install llvm.

If you have wasm support already you should see:

$ llc --version
## Build the contract
make all-via-docer
# - build/script-binary
# - build/script-binary.debug
## Deploy to CKB
depoly-to-ckb build/script-binary
## Error when send a transaction
ckb-cli tx send --tx-file xx.json
import sha3
import hashlib
import scrypt
from binascii import unhexlify, hexlify
from Crypto.Cipher import AES
from Crypto.Util import Counter
data = {
"address": "178ca94d1dece58a1c16bcb6e0eab8f440e60a01",
"crypto": {
@TheWaWaR
TheWaWaR / test-nat-traversal.sh
Created July 18, 2018 04:54
p2p NAT 穿透测试
git clone https://github.com/ustulation/p2p.git
cd p2p
RUST_LOG=p2p=trace cargo run --example tcp_rendezvous_connect -- --relay=104.238.181.214:20445 --traversal-server=104.238.181.214:20444 --traversal-server-key='{"sign":[38,31,210,213,23,70,235,152,27,52,173,110,168,154,2,231,79,98,56,132,188,50,18,23,133,239,161,29,151,53,9,242],"encrypt":[46,187,107,223,180,184,89,175,25,132,66,215,35,80,48,201,22,163,10,236,226,125,210,228,238,209,140,29,182,108,45,82]}' this-is-20445
@TheWaWaR
TheWaWaR / cita_install_develop_mac.sh
Created February 8, 2018 08:10
Install cita development environment on mac
brew install zeromq libsodium gperftools
sudo pip install ethereum==2.2.0 pysodium toml
wget https://github.com/ethereum/solidity/releases/download/v0.4.19/solc-static-linux
chmod +x solc-static-linux
sudo mv solc-static-linux /usr/local/bin/solc
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2017-12-05
@TheWaWaR
TheWaWaR / argparse_helper.py
Last active December 31, 2017 10:25
An argparse helper
#!/usr/bin/env python
# coding: utf-8
"""
A simple argparse helper.
Features:
=========
* Make nesting commands more elegant and easy to write.
* Without lose argparse's ability (means you can refactor current code)
@TheWaWaR
TheWaWaR / csharp-json-serialize.cs
Last active December 19, 2017 13:47
C# Json.Net serialize Dictionary<string, object>. You can run it on: http://rextester.com/JOT81793
//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;