Skip to content

Instantly share code, notes, and snippets.

View CN6033's full-sized avatar

HUANG SHITAO CN6033

View GitHub Profile
@CN6033
CN6033 / bankList.php
Created September 6, 2017 10:26
根据卡号知道银行卡基本信息。
<?php
$bankList = [
'621098' => '邮储银行-绿卡通-借记卡',
'622150' => '邮储银行-绿卡银联标准卡-借记卡',
'622151' => '邮储银行-绿卡银联标准卡-借记卡',
'622181' => '邮储银行-绿卡专用卡-借记卡',
'622188' => '邮储银行-绿卡银联标准卡-借记卡',
'955100' => '邮储银行-绿卡(银联卡)-借记卡',
'621095' => '邮储银行-绿卡VIP卡-借记卡',
'620062' => '邮储银行-银联标准卡-借记卡',
@CN6033
CN6033 / fix2json.java
Created March 7, 2017 04:01
FIX message to JSON convertor
import com.google.common.collect.ImmutableSet;
import com.google.common.reflect.ClassPath;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import quickfix.FieldNotFound;
import quickfix.Message;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.HashMap;
@CN6033
CN6033 / gist:339d07635f4e920015b3
Created January 13, 2016 06:00
Maven profiles
<profiles>
<profile>
<id>dev</id>
<properties>
<package.environment>develop</package.environment>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
public class SingletonExample {
// Inner class not loaded until some thread reference one of its fileds or methods
private static final class InnerSingleton {
private static final SingletonExample s = new SingletonExample();
}
public static SingletonExample getInstance() {
return InnerSingleton.s;
}
__author__ = "Huang Shitao"
__email__ = "huangshitao@outlook.com"
__license__ = "None"
import re
import sys
def process_log(log):
pattern = (r''
'([^ ]*) - ' #remote_addr
@CN6033
CN6033 / strlen.c
Created March 17, 2015 12:48
How strlen() function works.
size_t strlen(char const * s)
{
size_t len = 0;
while(*s++) {
len++;
}
return len;
}
@CN6033
CN6033 / tlv.c
Created November 9, 2014 06:47
Type-Length-Value
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct TLV {
int type;
int length;
char value[0];
}TLV;
bool Is_exist_loop(struct Node *head)
{
struct Node *slow = head;
struct Node *fast = head;
while (fast && fast->next) {
slow = slow->next;
fast = fast->next->next;
if (fast == slow) {
break;
#define Element_type int
void Swap(Element_type *, Element_type*);
/*
Unstable sort!
*/
void Quick_sort(Element_type array[], int left, int right)
@CN6033
CN6033 / merge_sort.c
Created March 7, 2014 00:59
Merge sort in C.
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define Element_type int
static void Msort(Element_type [], Element_type [], int start, int end);
static void Merge(Element_type [], Element_type [], int left_pos, int right_pos, int right_end);
void Merge_sort(Element_type array[], int size)