Skip to content

Instantly share code, notes, and snippets.

@Chunlin-Li
Chunlin-Li / 20180529.md
Last active June 21, 2018 02:19
MarketManagmentAPI
@Chunlin-Li
Chunlin-Li / runService.sh
Created July 24, 2017 06:25
项目启动脚本 (10.8.8.8 使用)
#!/usr/bin/env bash
ProjectName="sundries" # 项目名称
Port=3030 # 服务监听端口 , 通过设置 NODE_PORT 环境变量实现
CleanNodeModules=true # 是否每次都清除 node_modules
NodeVersion=8.1.2 # node 版本, 需确保 nvm 有该版本
Restart=true # 是否每次都重启服务
if [[ -e $1 ]]; then
@Chunlin-Li
Chunlin-Li / index.js
Last active April 28, 2017 09:32
test
/**
* SMS services.
*/
"use strict";
const http = require("http");
const URL = require("url");
@Chunlin-Li
Chunlin-Li / index.js
Created March 20, 2017 12:08
co-body v5.0.3 reproduce
'use strict';
var koa = require('koa');
var bodyParse = require('koa-bodyparser');
var app = new koa();
app.use(function *(next) {
let bodyData = [];
this.req.on('data', (chunk) => {
@Chunlin-Li
Chunlin-Li / 2_keyboard_shortcuts.md
Last active August 1, 2016 04:40
Here are some things you can do with Gists in GistBox.

Create documentation for your projects. Like so:


Most popular keyboard shortcuts within GistBox

  • Up/Down - Previous/Next Gist
  • Ctrl+e - Edit a selected Gist
  • Ctrl+s - Save Gist
@Chunlin-Li
Chunlin-Li / 1469273091275.md
Last active July 23, 2016 11:49
webstorm git integration combine multiple commit when push to remote. squash commit into one.

当前分支上, 本地已经有多个 commit 了. 此时想将这些零散的 commit 合并成一个.

context menu -> git -> repository -> rebase

勾选 interactive

onto 选定的是 remote 上对应当前本地分支的分支. 如 refs/remotes/origin/master

from 什么都不选

@Chunlin-Li
Chunlin-Li / cpu.md
Last active July 21, 2016 17:37
linux 系统下 修改 modify cpu pstate p-state cpufreq cpu freq turbo
@Chunlin-Li
Chunlin-Li / 1466694521348.md
Last active June 23, 2016 15:53
send udp packet

echo -n "test message" | nc -4u -w1 [host] [udp port]

@Chunlin-Li
Chunlin-Li / alternative.yaml
Created June 22, 2016 06:36
rime fcitx config
# Rime alternative settings
# encoding: utf-8
#
# difference from default settings:
# 1. ascii-style punctuation in half-shape mode
# 2. [ ] as paging keys
#
# save this file as:
# (Linux) ~/.config/ibus/rime/alternative.yaml
# (Mac OS) ~/Library/Rime/alternative.yaml
@Chunlin-Li
Chunlin-Li / 1464513169094.js
Created May 29, 2016 09:13
zlib_async_sync_test
'use strict';
const zlib = require('zlib');
const orgStr = 'Node is similar in design to, and influenced by, systems like Ruby\'s Event Machine or Python\'s Twisted. Node takes the event model a bit further, it presents an event loop as a runtime construct instead of as a library. In other systems there is always a blocking call to start the event-loop. Typically behavior is defined through callbacks at the beginning of a script and at the end starts a server through a blocking call like EventMachine::run(). In Node there is no such start-the-event-loop call. Node simply enters the event loop after executing the input script. Node exits the event loop when there are no more callbacks to perform. This behavior is like browser JavaScript — the event loop is hidden from the user.HTTP is a first class citizen in Node, designed with streaming and low latency in mind. This makes Node well suited for the foundation of a web library or framework.Just because Node is designed without threads, doesn\'t mean you canno