Skip to content

Instantly share code, notes, and snippets.

View liuqinh2s's full-sized avatar

刘钦 liuqinh2s

View GitHub Profile
@liuqinh2s
liuqinh2s / 0_reuse_code.js
Last active August 29, 2015 13:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@liuqinh2s
liuqinh2s / BSNode.cpp
Last active June 11, 2016 03:18
DataStructure
template <class T>
class BSTNode{
public:
T value;
BSTNode *left;
BSTNode *right;
BSTNode(T value1, BSTNode *l, BSTNode *r):
value(value1),left(l),right(r) {}
};
template <class T>
class BSTree {
private:
BSTNode<T> *mRoot;
public:
BSTree();
~BSTree();
// 前序遍历"二叉树"
int KMP(Str str, Str substr, int next[]){
int i=0,j=0;
while(i<str.length && j<substr.length){
if(j==-1||str.ch[i] == substr.ch[j]){
++i;
++j;
}
else{
j=next[j];
}
@liuqinh2s
liuqinh2s / ArrayInterface.cpp
Created December 27, 2016 02:12
数组的转换接口,比如我们经常要用到[[7,0],[4,4],[7,1],[5,0],[6,1],[5,2]],怎么把这一串字符串,传值给一个vector<pair<int, int>>& people;呢。这或许要用到字符串解析的代码,解析出来后还要一个一个传值,做轮子,不做白手起家的傻逼。
void form_fun(string s, vector<pair<int, int>>& people){
if(s.at(0)=='[' && s.at(1)=='[' && s.at(s.size()-2)==']' && s.at(s.size()-1)==']'){
pair<int,int> p;
for(int i=0;i<s.size();i++){
while(i<s.size() && (s.at(i)>'9' || s.at(i)<'0'))
i++;
if(i<s.size() && s.at(i)<='9' && s.at(i)>='0'){
string buffer="";
buffer += s.at(i);
while(i<s.size() && s.at(i+1)<='9' && s.at(i+1)>='0'){
@liuqinh2s
liuqinh2s / crossList.cpp
Created December 29, 2016 07:47
十字链表,交换上下左右任意
#include <stdio.h>
#include <malloc.h>
struct NODE {
char data;
struct NODE *U;//上
struct NODE *R;//右
struct NODE *D;//下
struct NODE *L;//左
} *B,*q;
struct NODE *m[10];
@liuqinh2s
liuqinh2s / gist:c37080c69a3a72438f0943f1e7306297
Created January 8, 2017 01:26 — forked from scturtle/gist:3060332
python 3 语法变化
idString=`ipfs id`
str="ID\": \""
subIdStr=${idString#*$str}
str1="\","
subIdStr1=${subIdStr%%$str1*}
echo $subIdStr1
sed -i "" "/root: / s/\/ipns\/$subIdStr1\//\//" _config.yml
sed -i "" "/url: / s/http:\/\/ipfs.io\/ipns\/$subIdStr1/http:\/\/liuqinh2s.github.io/" _config.yml
hexo clean
hexo g -d
while(True):
# 日线
tradeDayLineURL = "https://www.aex.com/trade/getTradeDayLine.php?coinname=BTS&mk_type=bitcny"
tradeDayLineResponse = requests.post(tradeDayLineURL, headers=headers)
while tradeDayLineResponse.status_code!=200:
tradeDayLineResponse = requests.post(tradeDayLineURL, headers=headers)
dayContent = json.loads(tradeDayLineResponse.text)
dayListContent = list(dayContent)
dayLength = dayListContent.__len__()
# print(dayLength)
Function endFunction(path, number)
File.Write(path, number)
EndScript
End Function
// 转账按钮界面的所有操作都包装在这个函数里
Function transfer(jpgStorePath, pngStorePath, path, number, itemNumber)
// 有没有头像的转账按钮位置不同,所以只能通过颜色来判断位置
Dim transferPointX, transferPointY