Skip to content

Instantly share code, notes, and snippets.

View yanxi123-com's full-sized avatar

阎曦 yanxi123-com

View GitHub Profile
@yanxi123-com
yanxi123-com / README.md
Last active February 26, 2020 06:33
常见 cleos 命令

修改 active 权限

cleosm set account permission eos_account active '{"threshold":1, "keys":[{"key":"EOS_PUB_KEY","weight":1}], "waits": []}'
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;
{"sig":"35c640339ab161757a3168d2edc9e90e7cd61b03e5720f27306a46ebf8f2b46796843240b3df3bd5cf3ce70c54f3461d6482df44d91aa5ff03948dc8dc40c8660","msghash":"485ee80e08f0aef1c9a6319825dcf2a05f3e7708e75c89fc0c52a33883611802"}
@yanxi123-com
yanxi123-com / README.md
Last active April 11, 2018 18:14
add Git hook for standard style check

运行方法:

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

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

CHECK=0 git commit ... # 不检查代码
@yanxi123-com
yanxi123-com / gist:1f950b19f60138aeb433
Last active August 29, 2015 14:17
formatJsonByValue
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

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

@yanxi123-com
yanxi123-com / build-region.js
Last active August 29, 2015 13:56
根据 ECShop 数据库生成 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');
@yanxi123-com
yanxi123-com / gist:9034648
Created February 16, 2014 14:01
通过 node-http-proxy 获取 request 和 response
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();
@yanxi123-com
yanxi123-com / gist:8886981
Last active August 29, 2015 13:56
生成 SSL 证书
# 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
@yanxi123-com
yanxi123-com / gist:8754172
Last active August 29, 2015 13:55
4张牌算24
/*
* 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) {