Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Xiong-Jia.Le xiongjia

🎯
Focusing
View GitHub Profile
@xiongjia
xiongjia / 0-read-ini.cpp
Last active Apr 18, 2019
Parse the UTF8 ".ini" file via the Boost property_tree #devsample #boost
View 0-read-ini.cpp
/**
* Parse the UTF8 ".ini" file via the Boost property_tree
*/
#include <string>
#include <fstream>
#if defined(__APPLE__)
# include <codecvt>
#endif /* defined(__APPLE__) */
@xiongjia
xiongjia / uia-sample.ps1
Last active May 7, 2022
A simple sample for access the MS UIAutomation in PowerShell. #devsample #win
View uia-sample.ps1
#REQUIRES -Version 3.0
# This is a simple sample for access the MS UIAutomation in PowerShell.
# In this sample:
# 1. Load the MS UIA via System.Reflection.Assembly
# 2. Launch the AUT ( calc.exe )
# 3. Find the AutomationElement via the AUT Process Id
# 4. Find buttons via 'ClassName' and 'Name' property
# 5. Click the '1', '+', '1', '=' buttons.
# At last, we will get '2' in the result of calc App.
@xiongjia
xiongjia / .jshintrc
Last active Sep 14, 2017
node stream tests : It's a simple protocol parser. I created it for test the NODE Stream module. #devsample
View .jshintrc
{
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"unused": "vars",
@xiongjia
xiongjia / dump.js
Last active Sep 14, 2017
Dump the NODE V8 heap to a file #devsample #v8
View dump.js
/* 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 Sep 14, 2017
async test - It's a bad .JS. Don't use this scenario in a real server. #devsample
View async_test.js
/* 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 Sep 14, 2017
Tests for singly linked list #devsample
View 0-main.c
/**
* 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 Sep 14, 2017
Parse the "argv" via the Boost.program_options (get the number, string and array from command line) #devsample #boost
View 0-program-options.cpp
/**
* 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 Sep 14, 2017
A simple Vim plugin with python #devsample #vim
View my_vim_plugin.py
#!/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 Sep 14, 2017
Mock Server #devtools
View (README).md

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 Sep 14, 2017
Fanfou API test #devnotes
View +READEM.md

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 申請,參考: