Skip to content

Instantly share code, notes, and snippets.

@yanxi-me
yanxi-me / README.md
Last active Feb 26, 2020
常见 cleos 命令
View README.md

修改 active 权限

cleosm set account permission eos_account active '{"threshold":1, "keys":[{"key":"EOS_PUB_KEY","weight":1}], "waits": []}'
View Cox.col
pragma solidity ^0.4.17;
import './SafeMath.sol';
import './Holder.sol';
import './Round.sol';
import './Dealer.sol';
import './Ownable.sol';
contract Cox is Ownable {
using SafeMath for uint256;
View press.one
{"sig":"35c640339ab161757a3168d2edc9e90e7cd61b03e5720f27306a46ebf8f2b46796843240b3df3bd5cf3ce70c54f3461d6482df44d91aa5ff03948dc8dc40c8660","msghash":"485ee80e08f0aef1c9a6319825dcf2a05f3e7708e75c89fc0c52a33883611802"}
@yanxi-me
yanxi-me / README.md
Last active Apr 11, 2018
add Git hook for standard style check
View README.md

运行方法:

./pre-commit.sh # 安装 pre-commit

git commit ... # 自动检查代码是否符合 standard js 标准

CHECK=0 git commit ... # 不检查代码
View gist:1f950b19f60138aeb433
assert = require 'assert'
_ = require 'lodash'
formatJsonByValue = (obj) ->
return obj unless _.isArray(obj) or _.isObject(obj)
Object.keys(obj).sort().reduce (pre, key) ->
pre + formatJsonByValue obj[key]
, ''
# Test
View readme.md

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser
@yanxi-me
yanxi-me / build-region.js
Last active Aug 29, 2015
根据 ECShop 数据库生成 region.js
View build-region.js
/*
* Author: qiri.com <yanxi@yanxi.com>
* build region.js by ECShop v2.7.3 DB
* change db config, then run:
* $ wget https://gist.github.com/yanxi-com/9089459/raw/build-region.js
* $ node build-region.js > region.js
*/
var mysql = require('mysql');
var _ = require('underscore');
@yanxi-me
yanxi-me / gist:9034648
Created Feb 16, 2014
通过 node-http-proxy 获取 request 和 response
View gist:9034648
var httpProxy = require('http-proxy');
var zlib = require('zlib');
var _ = require('underscore');
var express = require('express');
var http = require('http');
var path = require('path');
var ejs = require('ejs');
var request = require('request');
var app = express();
@yanxi-me
yanxi-me / gist:8886981
Last active Aug 29, 2015
生成 SSL 证书
View gist:8886981
# http://blog.didierstevens.com/2008/12/30/howto-make-your-own-cert-with-openssl/
openssl genrsa -out ca.key 2048
openssl req -new -x509 -days 3650 -key ca.key -out ca.crt
openssl genrsa -out server.key 2048
openssl req -new -key server.key -out server.csr # common name 要匹配服务器域名 nchat.qiri.com
openssl x509 -req -days 3650 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt
@yanxi-me
yanxi-me / gist:8754172
Last active Aug 29, 2015
4张牌算24
View gist:8754172
/*
* Author: <yanxi@yanxi.com>
* $ curl https://gist.github.com/yanxi-com/8754172/raw/gistfile1.js > 24.js
* $ npm install underscore
* $ node 24.js 8 8 9 7
*/
var _ = require('underscore');
function add(a, b) {
You can’t perform that action at this time.