Skip to content

Instantly share code, notes, and snippets.

View yuanfeiz's full-sized avatar

YuanfΞi Zhu yuanfeiz

  • The Homestead Arcology
View GitHub Profile
@yuanfeiz
yuanfeiz / bte_sharkpool_abi.json
Created August 13, 2017 12:27
Bitcoineum Sharkpool ABI
[
{
"constant": true,
"inputs": [],
"name": "current_external_block",
"outputs": [
{
"name": "",
"type": "uint256"
}
@yuanfeiz
yuanfeiz / gao_pool_abi.json
Created August 13, 2017 12:25
Bitcoineum Gaopool ABI
[
{
"constant": true,
"inputs": [],
"name": "current_external_block",
"outputs": [
{
"name": "",
"type": "uint256"
}
const bluebird = require('bluebird');
const Web3 = require('web3');
const _ = require('lodash');
const bbRetry = require('bluebird-retry');
const { env } = require('../libs/env-utils');
const config = require('../config/contracts')[env];
const { add0x, buildContract } = require('../libs/eth-helper');
const web3 = new Web3(new Web3.providers.HttpProvider(config.rpcAddr));
@yuanfeiz
yuanfeiz / load-preimage.js
Created May 7, 2017 14:30
A script to load the ENS preimage names to redis
'use strict';
const config = require('./config');
const LineByLineReader = require('line-by-line');
const lr = new LineByLineReader(config.dictionary.path);
const Redis = require('redis');
let redis = Redis.createClient(config.redis.url);
let multi = redis.multi();
const sha3 = require('solidity-sha3').default;
@yuanfeiz
yuanfeiz / queue.sol
Created April 6, 2017 09:06
An implementation of the rotated queue
pragma solidity ^0.4.0;
////////////////////////////////////////////////////////////
// This is an example contract hacked together at a meetup.
// It is by far not complete and only used to show some
// features of Solidity.
////////////////////////////////////////////////////////////
contract queue
{
Queue requests;
//
// main.cpp
// merge
//
// Created by 元飞 朱 on 16/6/15.
// Copyright © 2016年 yuanfei. All rights reserved.
//
#include <iostream>
#include <cassert>
@yuanfeiz
yuanfeiz / buildBinaryTree.py
Created October 30, 2015 08:13
build binary tree
# Question: to build a binary tree, with specific input format:
# input:
# 2 3 4 (2, 3, 4 is the index of a node)
# 3 7 8
# 8 1 a
# 2
# / \
@yuanfeiz
yuanfeiz / atof.py
Created September 22, 2015 07:58
convert a string to a number
def atof(s, base):
def ctoi(ch):
ch = ch.lower()
if ch <= '9' and ch >= '0':
return ord(ch) - ord('0')
elif ch >= 'a' and ch <= 'z':
return ord(ch) - ord('a') + 10
else:
raise Exception('argument error: char %s is not a valid numeric symbol' % ch)
{
"auth.py": {
"comment": [
],
"code": [
"Web server"
],
"all": [
"Web server"
{
"app.py": {
"comment": [
],
"code": [
],
"all": [
"Unit test"