Skip to content

Instantly share code, notes, and snippets.

View niujiabenben's full-sized avatar

niujiabenben niujiabenben

View GitHub Profile
@niujiabenben
niujiabenben / lmdb.cpp
Last active January 3, 2020 10:39
lmdb使用示例
#include <lmdb.h>
#include "common.h"
#include "util.h"
#include "timer.h"
int main(int argc, char *argv[]) {
google::InitGoogleLogging(argv[0]);
google::LogToStderr();
@niujiabenben
niujiabenben / crop_imdecode.cpp
Created July 18, 2019 15:01
imdecode with crop
extern "C" {
#include <jerror.h>
#include <jpeglib.h>
#include <setjmp.h>
}
struct JpegErrorManager {
struct jpeg_error_mgr pub;
jmp_buf setjmp_buffer;
};
@niujiabenben
niujiabenben / httpclient.cpp
Created August 20, 2019 14:35
libcurl multi inferface example
#include "httpclient.h"
static inline size_t WriteCallback(void* contents, size_t size, size_t nmemb,
void* userp) {
((std::string*) userp)->append((char*) contents, size * nmemb);
return size * nmemb;
}
//////////////////////////// class HttpClient //////////////////////////////////
@niujiabenben
niujiabenben / cite.py
Created December 21, 2019 10:14
获取某个会议的文章的引用数.
# coding: utf-8
"""
获取某个顶会的文章的引用数, 并输出其前10%的文章列表.
由于google scholor有防爬机制, 这里假定所有的html的源文件都手动下载到本地.
"""
import re
import os
from bs4 import BeautifulSoup