Skip to content

Instantly share code, notes, and snippets.

View shafreeck's full-sized avatar

Shafreeck shafreeck

  • Alibaba Cloud
  • Beijing
View GitHub Profile
// test about the reverse iter
package main
import (
"context"
"flag"
"log"
"strings"
"github.com/pingcap/tidb/kv"
sds sdscatescape(sds s, const char *p, size_t len) {
s = sdscatlen(s,"\"",1);
while(len--) {
switch(*p) {
case '\\':
case '"':
s = sdscatprintf(s,"\\%c",*p);
break;
case '\n': s = sdscatlen(s,"\\n",2); break;
case '\r': s = sdscatlen(s,"\\r",2); break;
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int kmp(const char *s, const char *sub){
int ls = strlen(s);
int lsub = strlen(sub);
char *next = malloc(lsub);
/*Build the next array*/
SELECT [QunNum], [QQNum], [Age], [Gender], [Auth], [Nick] FROM [GroupData1].[dbo].[Group1];
SELECT [QunNum], [QQNum], [Age], [Gender], [Auth], [Nick] FROM [GroupData1].[dbo].[Group2];
SELECT [QunNum], [QQNum], [Age], [Gender], [Auth], [Nick] FROM [GroupData1].[dbo].[Group3];
SELECT [QunNum], [QQNum], [Age], [Gender], [Auth], [Nick] FROM [GroupData1].[dbo].[Group4];
SELECT [QunNum], [QQNum], [Age], [Gender], [Auth], [Nick] FROM [GroupData1].[dbo].[Group5];
SELECT [QunNum], [QQNum], [Age], [Gender], [Auth], [Nick] FROM [GroupData1].[dbo].[Group6];
SELECT [QunNum], [QQNum], [Age], [Gender], [Auth], [Nick] FROM [GroupData1].[dbo].[Group7];
SELECT [QunNum], [QQNum], [Age], [Gender], [Auth], [Nick] FROM [GroupData1].[dbo].[Group8];
SELECT [QunNum], [QQNum], [Age], [Gender], [Auth], [Nick] FROM [GroupData1].[dbo].[Group9];
SELECT [QunNum], [QQNum], [Age], [Gender], [Auth], [Nick] FROM [GroupData1].[dbo].[Group10];
@shafreeck
shafreeck / gist:1392764
Created November 25, 2011 03:38
debug info of pon to VPN
pppd options in effect:
debug # (from command line)
nodetach # (from command line)
logfd 2 # (from command line)
dump # (from command line)
noauth # (from /etc/ppp/peers/Sina)
name yongquan@staff.sina.com.cn # (from /etc/ppp/peers/Sina)
remotename Sina # (from /etc/ppp/peers/Sina)
# (from /etc/ppp/peers/Sina)
pty pptp vpn.sina.com --nolaunchpppd # (from /etc/ppp/peers/Sina)
@shafreeck
shafreeck / to min
Created December 17, 2010 14:57
code example to min
set<int>::iterator it1 = s1.begin();
set<int>::iterator it2 = s2.begin();
while(it1 != s1.end() && it2 != s2.end())
{
if(*it1 < *it2)
{
result.push_back(*it1);
++it1;
}
@shafreeck
shafreeck / Makefile
Created December 17, 2010 07:38
Makefile example
all:hello test1 test2 test3
hello:hello.o
g++ -o hello hello.o
hello.o:hello.cc
g++ -c -o hello.o hello.cc
clean:
rm *.o hello
install:
cp hello /usr/local/bin
@shafreeck
shafreeck / TODO list
Created October 20, 2010 13:59
需要实现的功能
1. 解决命名冲突的问题,不同的日志,如果用了相同的名字,如何解决?协商?
2. 日志请求改为异步,为了便于调试,现在用的是同步机制
3. 探索双server模式,避免单点故障