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 / 0-read-ini.cpp
Last active April 18, 2019 06:46
Parse the UTF8 ".ini" file via the Boost property_tree #devsample #boost
/**
* 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 November 29, 2022 18:44
A simple sample for access the MS UIAutomation in PowerShell. #devsample #win
#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 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 申請,參考: