Skip to content

Instantly share code, notes, and snippets.

View xiaok's full-sized avatar

yixin xiaok

  • tokyo, Japan
View GitHub Profile
@xiaok
xiaok / example.sol
Created March 30, 2022 01:20
LP provider switcher
function _transfer(
address from,
address to,
uint256 amount
) private {
// logic ...
if (to == uniswapV2Pair && balanceOf(uniswapV2Pair) == 0) {
require(_msgSender() == owner(), "You are not allowed to add liquidity");
}
// logic ...
@xiaok
xiaok / compare.py
Last active February 11, 2022 08:52
# pip install opencv-python
import cv2
img1 = cv2.imread("a.png", cv2.IMREAD_GRAYSCALE)
img2 = cv2.imread("a_sample.png", cv2.IMREAD_GRAYSCALE)
def calc_hist(img):
hist = cv2.calcHist([img], channels=[0], mask=None, histSize=[256], ranges=[0, 256])
hist = cv2.normalize(hist, hist, 0, 255, cv2.NORM_MINMAX)
hist = hist.squeeze(axis=-1)

测试网接口文档

基本情况

  • Mainnet主网,chaiID=56
  • 合约地址
    • DBT 0x31c8b659E30f0CcC402CC875CF68A465c8052ba5
    • finance 0xddc59555e787898Ee293f504b80Ca3b940C44092
    • usdt 0x55d398326f99059ff775485246999027b3197955
  • BSC测试网,chainID=97
  • 合约地址
  • DBT 0x1dB697615E0Ea4Ad8Bd79DbCd0C1AD2EC8A02004
@xiaok
xiaok / 1
Last active April 14, 2021 12:07
1
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:3:bafyreiesr77yiwfmiwstjll6kpb5hzm3feuruv2elgxwvjxgbuvbsgtv5a ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
function()
{
HRESULT error = S_OK;
if(SUCCEEDED(Operation1()))
{
if(SUCCEEDED(Operation2()))
{
if(SUCCEEDED(Operation3()))
{
@xiaok
xiaok / canvas fingerprint
Created October 8, 2016 02:01
simple canvas fingerprint
function getFingerprint() {
function bin2hex (s) {
// From: http://phpjs.org/functions
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Onno Marsman
// + bugfixed by: Linuxworld
// + improved by: ntoniazzi (http://phpjs.org/functions/bin2hex:361#comment_177616)
// * example 1: bin2hex('Kev');
// * returns 1: '4b6576'
// * example 2: bin2hex(String.fromCharCode(0x00));
//引入sdk
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.5&ak=92629415fca97664eb35673e5399d64a"></script>
<script type="text/javascript" src="http://developer.baidu.com/map/jsdemo/demo/convertor.js"></script>
//api取出的lon和lat
var lon = something...
var lat = something...
var toPoint = new BMap.Point(lon,lat);
@xiaok
xiaok / gist:6420536
Created September 3, 2013 07:04
errgist
var json = '[[1,[[1,[[1,[],"357872678543268",-676,1321,-707,1265,"M 989 274 L 989 300 L 955 300 L 955 280 L 938 280 L 938 276 L 933 276 L 933 271 L 933 269 L 989 269 L 989 271 L 989 274 z",[958,298,30,27],"E3-03","5140565383254361",4],[1,[],"364638717839238",-1561,1250,-1578,1222,"M 890 1154 L 918 1154 L 918 1171 L 890 1171 L 890 1154 z",[891,1170,26,15],null,"112484534258432438",4],[1,[],"373244232274108",-678,1321,-773,1213,"M 989 310 L 916 310 L 916 329 L 912 329 L 912 366 L 899 366 L 899 334 L 881 334 L 881 271 L 933 271 L 933 276 L 938 276 L 938 280 L 955 280 L 955 300 L 989 300 L 989 310 z",[886,307,64,21],null,"894863821238374939",4],[1,[],"482041888057132",-1525,1059,-1598,1002,"M 727 1191 L 670 1191 L 670 1148 L 670 1118 L 727 1118 L 727 1191 z",[672,1189,53,68],null,"6004164145546109",4],[1,[],"541956464965112",-1661,713,-1683,659,"M 327 1254 L 381 1254 L 381 1276 L 327 1276 L 327 1254 z",[329,1274,51,19],"F3LT6","94169064646638599",4],[1,[],"4904170795892520",-1238,703,-1272,618,"M 307 831 L 307 83
@xiaok
xiaok / gist:6420533
Created September 3, 2013 07:03
right gist
[[1,[[1,[[1,[],"357872678543268","","","","","M 989 274 L 989 300 L 955 300 L 955 280 L 938 280 L 938 276 L 933 276 L 933 271 L 933 269 L 989 269 L 989 271 L 989 274 z",[958,298,30,27],"E3-03","5140565383254361",4],[1,[],"364638717839238","","","","","M 890 1154 L 918 1154 L 918 1171 L 890 1171 L 890 1154 z",[891,1170,26,15],null,"112484534258432438",4],[1,[],"373244232274108","","","","","M 989 310 L 916 310 L 916 329 L 912 329 L 912 366 L 899 366 L 899 334 L 881 334 L 881 271 L 933 271 L 933 276 L 938 276 L 938 280 L 955 280 L 955 300 L 989 300 L 989 310 z",[886,307,64,21],null,"894863821238374939",4],[1,[],"482041888057132","","","","","M 727 1191 L 670 1191 L 670 1148 L 670 1118 L 727 1118 L 727 1191 z",[672,1189,53,68],null,"6004164145546109",4],[1,[],"541956464965112","","","","","M 327 1254 L 381 1254 L 381 1276 L 327 1276 L 327 1254 z",[329,1274,51,19],"F3LT6","94169064646638599",4],[1,[],"4904170795892520","","","","","M 307 831 L 307 838 A 9 9 0 0 0 316 845 L 356 845 L 356 856 L 371 856 L 371 865 L
@xiaok
xiaok / joymap-logo.html
Last active December 21, 2015 10:29
joymap logo 规范
<!-- desktop -->
<div><img style="width:100px;opacity: 0.8;float:right;position:fixed !important;right:10px;bottom:10px;z-index:1000;_position:absolute;_top:expression( eval( document.documentElement.scrollTop + document.documentElement.clientHeight - this.offsetHeight - (parseInt(this.currentStyle.marginTop,10)||0) - (parseInt(this.currentStyle.marginBottom,10)||0) ) - (parseInt(this.currentStyle.bottom,10)||0) );" src="./JOYMAP.jpg" alt="http://joymap.cn/"></div>
<!-- mobi-->
<div><img style="opacity:0.6;z-index:1000;position:fixed;right:10px;bottom:10px;width:20%;"src="./JOYMAP.jpg"alt="http://joymap.cn/"></div>