Skip to content

Instantly share code, notes, and snippets.

@Jackarain
Jackarain / gist:2986880
Created June 25, 2012 05:49
smart ptr
namespace smart
{
// 引用计数类.
class smart_count
{
public:
smart_count(int c = 0) : use_count(c) {}
~smart_count() {}
// 增加引用计数, 并返回计数值.
@Jackarain
Jackarain / gist:3059898
Created July 6, 2012 12:29
一个any的实现
class any
{
public: // structors
any()
: content(0)
{
}
template<typename ValueType>
@Jackarain
Jackarain / gist:3243372
Created August 3, 2012 01:53
circular_buffer
#ifndef __CIRCULAR_BUFFER_H__
#define __CIRCULAR_BUFFER_H__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
int __cdecl sub_49989E(int a1)
{
int result; // eax@1
signed int v2; // esi@1
int v3; // ecx@1
int v4; // edi@2
int v5; // edx@2
char *v6; // ecx@3
signed int v7; // edx@3
int v8; // esi@4
@Jackarain
Jackarain / gist:4608619
Last active August 14, 2018 19:34
常用boost编译命令.
bjam --without-graph --without-graph_parallel --without-math --without-wave -s BZIP2_SOURCE=D:\bzip2-1.0.6 -s ZLIB_SOURCE=D:\zlib-1.2.7 debug release stage link=static runtime-link=static -j8
bjam --without-graph --without-graph_parallel --without-math --without-wave -s BZIP2_SOURCE=D:\bzip2-1.0.6 -s ZLIB_SOURCE=D:\zlib-1.2.7 debug release stage link=static runtime-link=shared -j8
bjam --without-graph --without-graph_parallel --without-math --without-wave -s BZIP2_SOURCE=D:\bzip2-1.0.6 -s ZLIB_SOURCE=D:\zlib-1.2.7 debug release stage link=shared runtime-link=shared -j8
bjam --without-graph --without-graph_parallel --without-math --without-wave -s BZIP2_SOURCE=D:\bzip2-1.0.6 -s ZLIB_SOURCE=D:\zlib-1.2.7 debug release stage link=shared runtime-link=shared -j8 threading=single
bjam --without-graph --without-graph_parallel --without-math --without-wave -s BZIP2_SOURCE=D:\bzip2-1.0.6 -s ZLIB_SOURCE=D:\zlib-1.2.7 debug release stage link=static runtime-link=shared -j8 threading=single
bjam --without-graph --without
@Jackarain
Jackarain / gist:5589590
Last active December 17, 2015 09:48
json格式化
#include <boost/foreach.hpp>
#include <boost/property_tree/json_parser.hpp>
namespace pt = boost::property_tree;
using pt::ptree;
template <class Stream>
void list_json(ptree json, Stream &stream, int level = 0)
{
if (level == 0)
{
From 81a6a51c0cb66de6bc77e1fa5dcd46b2794995e4 Mon Sep 17 00:00:00 2001
From: Christopher Kohlhoff <chris@kohlhoff.com>
Date: Wed, 23 Mar 2011 15:03:56 +1100
Subject: [PATCH] On Windows, ensure the count of outstanding work is decremented for
abandoned operations (i.e. operations that are being cleaned up within
the io_service destructor).
---
asio/include/asio/detail/impl/dev_poll_reactor.ipp | 2 ++
asio/include/asio/detail/impl/epoll_reactor.ipp | 2 ++
//
// async_read_body.hpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2013 Jack (jack dot wgm at gmail dot com)
// Copyright (C) 2012 - 2013 微蔡 <microcai@fedoraproject.org>
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// path LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
@Jackarain
Jackarain / cacert.pem
Created November 29, 2013 02:40
cacert.pem
##
## ca-bundle.crt -- Bundle of CA Root Certificates
##
## Certificate data from Mozilla as of: Sat Dec 29 20:03:40 2012
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
## file (certdata.txt). This file can be found in the mozilla source tree:
## http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1
##
@Jackarain
Jackarain / logger.hpp
Last active March 7, 2022 04:35
一个简单的日志类实现.
//
// Copyright (C) 2019 Jack.
//
// Author: jack
// Email: jack.wgm at gmail dot com
//
#pragma once
#include <clocale>