Skip to content

Instantly share code, notes, and snippets.

@Chunlin-Li
Chunlin-Li / runService.sh
Created Jul 24, 2017
项目启动脚本 (10.8.8.8 使用)
View runService.sh
#!/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
View index.js
/**
* SMS services.
*/
"use strict";
const http = require("http");
const URL = require("url");
@Chunlin-Li
Chunlin-Li / index.js
Created Mar 20, 2017
co-body v5.0.3 reproduce
View index.js
'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 Aug 1, 2016
Here are some things you can do with Gists in GistBox.
View 2_keyboard_shortcuts.md

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 Jul 23, 2016
webstorm git integration combine multiple commit when push to remote. squash commit into one.
View 1469273091275.md

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

context menu -> git -> repository -> rebase

勾选 interactive

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

from 什么都不选

@Chunlin-Li
Chunlin-Li / cpu.md
Last active Jul 21, 2016
linux 系统下 修改 modify cpu pstate p-state cpufreq cpu freq turbo
View cpu.md
View 1466694521348.md

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

View alternative.yaml
# 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
zlib_async_sync_test
View 1464513169094.js
'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
You can’t perform that action at this time.