Skip to content

Instantly share code, notes, and snippets.

View ubnt-intrepid's full-sized avatar

Yusuke Sasaki ubnt-intrepid

View GitHub Profile
#include <iostream>
#include <type_traits>
#include <utility>
#include <boost/optional.hpp>
template <typename T>
std::ostream& operator<<(std::ostream& os, boost::optional<T> const& val)
{
if (val)
return os << val.get();
#pragma once
#include "socketapi.hpp"
namespace network {
using boost::optional;
namespace ph = std::placeholders;
// @brief リスナソケットを生成する
// @param port :: unsigned short ソケットをbindするポート番号
// @retval 作成したソケットのディスクリプタ
#include <algorithm>
#include <iostream>
#include <iterator>
#include <random>
#include <vector>
using namespace std;
class multinominal_distribution
{
std::vector<double> m_prob;
@ubnt-intrepid
ubnt-intrepid / example_chinese_restaurant_process.cpp
Last active August 29, 2015 14:18
implementation of sampler from Chinese Restaurant Process (CRP) in C++11
#include <algorithm>
#include <ctime>
#include <fstream>
#include <iostream>
#include <iterator>
#include <random>
#include <tuple>
#include <utility>
#include <vector>
#include <boost/progress.hpp>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import itertools
import numpy as np
from scipy import linalg
import matplotlib.pyplot as plt
import matplotlib as mpl
from sklearn import mixture
# Number of samples per component
\documentclass{beamer}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{calc,shapes,positioning,backgrounds}
\usepackage[absolute,overlay]{textpos}
\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{\TPHorizModule}
\textblockorigin{0mm}{6mm}
\documentclass{jsarticle}
\declareterm{%
state = \mathbf{x},
input = \mathbf{u},
}
\begin{document}
\begin{equation}
@ubnt-intrepid
ubnt-intrepid / gist:2ffb56e8c183935a9621
Last active August 29, 2015 14:21
フォント設定切り替えサンプル
\input ifpdf.sty
\input ifluatex.sty
\input ifxetex.sty
\ifxetex
% XeTeX:
\typeout{---Using XeTeX---}
\documentclass{bxjsarticle}
\usepackage{xlextra}
\XeTeXlinebreaklocale "ja"
\XeTeXlinebreakskip=0pt plus 1pt
@ubnt-intrepid
ubnt-intrepid / handout.sty
Last active August 29, 2015 14:22
PowerPointの配布資料マスター風にスライドPDFをまとめるためのパッケージ
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{handout}[2015/06/12 support for handout]
\newif\ifhandout@landscape
\handout@landscapefalse
\DeclareOption{landscape}{\handout@landscapetrue}
\newif\ifhandout@draft
\handout@draftfalse
\DeclareOption{draft}{\handout@drafttrue}