Skip to content

Instantly share code, notes, and snippets.

View jin10086's full-sized avatar
🏠
Working from home

gaojin jin10086

🏠
Working from home
View GitHub Profile
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
pragma solidity ^0.5.17;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
@jin10086
jin10086 / Controller.sol
Created August 4, 2020 02:34
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.17+commit.d19bba13.js&optimize=true&gist=
/**
*Submitted for verification at Etherscan.io on 2020-07-26
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint256);
@jin10086
jin10086 / Controller.sol
Created August 4, 2020 02:34
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.17+commit.d19bba13.js&optimize=true&gist=
/**
*Submitted for verification at Etherscan.io on 2020-07-26
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint256);
import requests
import time
from web3.auto import w3
headers = {
"authority": "ethernodes.org",
"accept": "application/json, text/javascript, */*; q=0.01",
"x-requested-with": "XMLHttpRequest",
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36",
"referer": "https://ethernodes.org/nodes",
from hashlib import md5
def Hash(context):
result = md5(bytes(context, "utf8"))
for i in range(0, 10000000):
result = md5(result.digest())
return result.hexdigest()
pragma solidity ^0.5.1;
contract EIP20NonStandardInterface {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
@jin10086
jin10086 / testonerror.hpp
Created November 12, 2019 13:27
测试 触发延时操作
#include <eosio/eosio.hpp>
#include <eosio/asset.hpp>
#include <eosio/singleton.hpp>
#include <eosio/transaction.hpp>
using namespace std;
using namespace eosio;

Keybase proof

I hereby claim:

  • I am jin10086 on github.
  • I am gaojin (https://keybase.io/gaojin) on keybase.
  • I have a public key ASDjynKFLfowWWUgjLoyLDO8XSjQ-k9SL2nPDIBjd_se3go

To claim this, I am signing this object:

import hashlib
def get_winner(min_n, max_n, num_win, key):
res = key
winners = set()
while len(winners) < num_win:
res = hashlib.sha256(res.encode("utf8")).hexdigest()
winners.add(int(res, 16) % (max_n - min_n + 1) + min_n)
return winners