Skip to content

Instantly share code, notes, and snippets.

@CrBoy
CrBoy / valgrind_massif_example1
Created April 19, 2011 16:29
這是關於 valgrind massif 的輸出範例
--------------------------------------------------------------------------------
MB
9.096^ #
| @:@#
| @:::@:@#
| @:::@@@:: @:@#
| @:: @ @:: @:@#
| @@:: @ @:: @:@#
@CrBoy
CrBoy / PalindromicStack.cpp
Created April 19, 2011 19:50
print out a palindromic stack implemented by template meta programming XD
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
template<size_t max> string inc_seq()
{
string s;
for(int i=1; i<=max; i++)
@CrBoy
CrBoy / Makefile
Created June 14, 2011 10:28
Something test about C++ exception handling
all: set_new_hand set_unexpected set_terminate
set_new_hand: set_new_hand.cpp
g++ -g -o set_new_hand set_new_hand.cpp
set_unexpected: set_unexpected.cpp
g++ -g -o set_unexpected set_unexpected.cpp
set_terminate: set_terminate.cpp
g++ -g -o set_terminate set_terminate.cpp
@CrBoy
CrBoy / .gitignore
Created June 27, 2011 02:44
Plurk Mobile Unread_* Auto Opener
.DS_Store
@CrBoy
CrBoy / README
Created September 12, 2011 06:31
Plurk CSS (original by howar31)
這個 CSS 樣式表最初由 howar31 製作, CrBoy 為了記錄改寫的過程所以放上 gist.github。
This stylesheet is originally made by howar31. CrBoy put it on gist.github for modifying and improving.
@CrBoy
CrBoy / cutility.c
Created November 3, 2011 11:03
Cutility - Command-line drawing utility
#include "cutility.h"
void gotoxy(int x, int y)
{
static HANDLE hConsole = GetStdHandle( STD_OUTPUT_HANDLE );
COORD coord={x, y};
SetConsoleCursorPosition(hConsole, coord);
}
void setcolor(const char *fg, const char *bg)
@CrBoy
CrBoy / zip.cpp
Created November 3, 2011 18:17
A simple implementation like Python's zip
#include <list>
#include <utility>
#include <iostream>
using namespace std;
template<class T1, class T2>
list< pair<T1,T2> > zip(const list<T1>& container1, const list<T2>& container2)
{
list< pair<T1,T2> > result;
#include <iostream>
#include <vector>
#include <algorithm>
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
using namespace std;
using namespace boost::lambda;
int main(int argc, const char *argv[])
@CrBoy
CrBoy / MyClass.h
Created November 8, 2011 09:08
A strange problem about BOOST_CLASS_EXPORT
#ifndef MYCLASS_H
#define MYCLASS_H
#include <boost/serialization/export.hpp>
#include <boost/serialization/vector.hpp>
using namespace std;
class A
{
@CrBoy
CrBoy / list_quick_sort.h
Created November 30, 2011 05:04 — forked from baiyanhuang/list_quick_sort.h
quick sort of single linked list
#pragma once
#include <utility>
//
// Quick sort for single linked list
//
// Template arguments:
// T: node's pointer type
// Next: function/functor to get next node
// Compare: functor to compare 2 arguments
//