Skip to content

Instantly share code, notes, and snippets.

View kumagi's full-sized avatar
:octocat:
Fine.

Hiroki KUMAZAKI kumagi

:octocat:
Fine.
View GitHub Profile
@kumagi
kumagi / tokyo cabinet hashmap in C++
Created June 24, 2010 14:38
tokyo cabinet C++ wrapper
#ifndef TCPP_HPP_
#define TCPP_HPP_
#include <tcutil.h>
#include <tchdb.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include "asmsg.hpp"
#include <numeric>
class calc_var{
const double avg;
double sum;
public:
calc_var(const double& a):avg(a),sum(0.0){}
void operator()(const double& dat){
double diff = std::abs(dat-avg);
# BEGIN SL ALIASES
export PATH=~/.sl/
alias aux=sl
alias bash=sl
alias cat=sl
alias cd=sl
alias cp=sl
alias chmod=sl
alias chown=sl
;;; coloring current line
(global-hl-line-mode 1)
(set-face-background 'hl-line "white")
(push "/usr/share/emacs/site-lisp/emacs-goodies-el" load-path)
(require 'color-theme)
(color-theme-greiner)
;;; half transparent emacs frame
;;(active not-active moving resizing)
;; kumagi custom
;;; coloring current line
(global-hl-line-mode 1)
(set-face-background 'hl-line "white")
(push "/usr/share/emacs/site-lisp/emacs-goodies-el" load-path)
(require 'color-theme)
(color-theme-greiner)
#include <msgpack.hpp>
#include <boost/mpl/int.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
#define MAX_PARAMS 16
namespace{
#define TYPENAME_DEF(ignore1,param,ignore2) typename A##param = void
#define EVAL_OBJECT_PARENT(n) \
template <BOOST_PP_ENUM(n,TYPENAME_DEF,fuga)> \
class object{};
#define TEXT(ignore1,ignore2, text) text
#define ARG(ignore,param,arg) arg(param)
@kumagi
kumagi / ev.c
Created October 23, 2010 17:30
/*
* libev event processing core, watcher management
*
* Copyright (c) 2007,2008,2009 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
@kumagi
kumagi / client.cpp
Created October 25, 2010 05:11
server.cpp
#include "msgpack/rpc/server.h"
#include "msgpack/rpc/client.h"
using namespace mp::placeholders;
namespace rpc { using namespace msgpack::rpc; }
class myserver : public rpc::dispatcher {
public:
void dispatch(rpc::request req)
{}
@kumagi
kumagi / qt_stopwatch.cpp
Created November 26, 2010 06:49
qt_stopwatch
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QHBoxLayout>
#include <QtGui/QHeaderView>
#include <QtGui/QLCDNumber>
#include <QtGui/QMainWindow>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>