Skip to content

Instantly share code, notes, and snippets.

View TheWaWaR's full-sized avatar
🌀
Focusing

LingFeng TheWaWaR

🌀
Focusing
View GitHub Profile
@TheWaWaR
TheWaWaR / flask_dump_request_response.py
Last active March 10, 2024 14:38
Flask dump request and response example
#!/usr/bin/env python
# coding: utf-8
import os
import sys
import json
import uuid
import tempfile
from flask import Flask, request, Response, g
@TheWaWaR
TheWaWaR / reloadlib.py
Last active March 10, 2024 01:32
Python reload shared library test script
#!/usr/bin/env python
#coding: utf-8
import os
import sys
import ctypes
def is_loaded(lib):
libp = os.path.abspath(lib)
ret = os.system("lsof -p %d | grep %s > /dev/null" % (os.getpid(), libp))
@TheWaWaR
TheWaWaR / gunicorn_service.py
Last active October 5, 2023 12:54
Gunicorn service script {Start | Restart | Stop | Reload | Quit}
#!/usr/bin/env python
#coding: utf-8
import os
import imp
import time
import signal
import argparse
import commands
@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
@TheWaWaR
TheWaWaR / gunicorn_config.py
Last active June 28, 2022 11:31
Gunicorn configuration sample
import os
app = '{YOUR-WSGI-APPLICATION}'
# Sample Gunicorn configuration file.
#
# Server socket
#
# bind - The socket to bind.
@TheWaWaR
TheWaWaR / apscheduler-test.py
Last active May 16, 2021 09:14
<Advanced Python Scheduler> date trigger example
# coding: utf-8
import os
import time
from datetime import datetime, timedelta
from pytz import utc, timezone
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
from apscheduler.executors.pool import ThreadPoolExecutor
## 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