Skip to content

Instantly share code, notes, and snippets.

View xiongjia's full-sized avatar
🤿
Focusing

Xiong-Jia.Le xiongjia

🤿
Focusing
View GitHub Profile
@xiongjia
xiongjia / dev-env.md
Last active November 18, 2017 15:30
Cheatsheet - DEV Environment #devnotes

开发环境备忘

Java

sdkman

  • 管理多个 JDK, JRE 以及 build tools ( Maven, Gradle, 等) , 还有 Groovy 等
  • Github: https://github.com/sdkman/sdkman-cli
  • Notes:
    • Windows OS 上不太好用, 因为依赖 cygwin 基本可放弃
    • 中国区注意修改 CURL 的设置来适应特殊网络环境
  • curl 的 proxy 可以从 $http_proxy & $https_proxy读入
@xiongjia
xiongjia / .jshintrc
Last active September 14, 2017 07:45
node stream tests : It's a simple protocol parser. I created it for test the NODE Stream module. #devsample
{
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"unused": "vars",
@xiongjia
xiongjia / dump.js
Last active September 14, 2017 07:44
Dump the NODE V8 heap to a file #devsample #v8
/* Dump the NODE V8 heap to a file
* Usage:
* 1. Install the node-heapdump: npm install node-heapdump
* 2. call below code when you need dump the heap.
* require('./dump.js')('test');
*/
'use strict';
var path = require('path'),
util = require('util');
@xiongjia
xiongjia / async_test.js
Last active September 14, 2017 07:44
async test - It's a bad .JS. Don't use this scenario in a real server. #devsample
/* async test - It's a bad .JS. Don't use this scenario in a real server.
* 1. The function1 saved the 'callback' and call it when the 'connect' is emitted
* 2. The function3 will be triggered again when the connect event happended.
*/
'use strict';
var events = require("events"),
servEvt = new events.EventEmitter();
@xiongjia
xiongjia / 0-main.c
Last active September 14, 2017 07:44
Tests for singly linked list #devsample
/**
* Tests for singly linked list
*/
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <assert.h>
/* singly link list node */
@xiongjia
xiongjia / 0-program-options.cpp
Last active September 14, 2017 07:43
Parse the "argv" via the Boost.program_options (get the number, string and array from command line) #devsample #boost
/**
* Parse the "argv" via the Boost.program_options
* (get the number, string and array from command line)
*/
#include <iostream>
#include <string>
#include <vector>
#include <boost/program_options.hpp>
@xiongjia
xiongjia / my_vim_plugin.py
Last active September 14, 2017 07:43
A simple Vim plugin with python #devsample #vim
#!/usr/bin/env python
import sys, os
# The test function for VIM plugin
def my_test(vim, vim_ver):
buf = vim.current.buffer
# append process id & python version info to the buffer
buf.append("VIM process %d; vim version: %s\n" % (os.getpid(), vim_ver))
buf.append("Py version: %s\n" % sys.version_info)
@xiongjia
xiongjia / (README).md
Last active September 14, 2017 07:42
Mock Server #devtools

Mock Server

Installation

  1. Clone this gist to a local folder
  2. Run npm install in the local folder

Usage

  • Launch the server:
    node index.js
  • Launch the server with cluster feature:
@xiongjia
xiongjia / +READEM.md
Last active September 14, 2017 07:42
Fanfou API test #devnotes

Fanfou API 測試

用“飯否“的都是能識得漢語,於是就用漢語寫 README 了。

Files

總共有 2 個文件:

  1. fanfou.py - 裏面有 3 個 Objects: Logger, FanfouOAuth, Fanfou。具體參考 Objects 一節。
  2. fanfou.sample.cfg - 這是一個 sample。可以根據這個 sample 生成具體的 fanfou.cfg。 配置內容是 consumer key&secert,以及 auth_cache 文件名。
  • consumer key&secert 可以上 fanfou app 申請,參考:
@xiongjia
xiongjia / 0_my_lib_test.cxx
Last active September 14, 2017 07:41
A simple sample of Boost unit test #devsample #boost
/**
* A simple sample of Boost unit test
*/
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <string>
#include "my_lib.hxx"