Skip to content

Instantly share code, notes, and snippets.

View ubnt-intrepid's full-sized avatar
🦀
I may be slow to respond.

Yusuke Sasaki ubnt-intrepid

🦀
I may be slow to respond.
View GitHub Profile
@ubnt-intrepid
ubnt-intrepid / gist:3ab2889227725c6e8cf0
Last active August 29, 2015 14:03
CSVを読み込んでTeXのtabular環境に出力するPythonスクリプト
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
CSVを読み込んでTeXのtabular環境に出力する
"""
import sys
import csv
#include <iterator>
#include <tuple>
template <typename Iterator1, typename Iterator2>
struct product2_iterator
{
// [first1, last1), [first2, last2)
// -> (first1,first2), (first1+1,first2), ... , (last1-1, last2-2), (last1-1, last2-1)
private:
@ubnt-intrepid
ubnt-intrepid / gist:987dc4749288dde4f727
Created October 4, 2014 12:25
エクスプローラに登録されたアプリケーションでファイルを開く(MSYS)
#!/bin/bash
# 絶対パス取得は http://qiita.com/katoy/items/c0d9ff8aff59efa8fcbb#2-4 を参考
# 引数に渡したファイルを登録されたアプリケーションで開く
# ※エクスプローラの機能を使用しているためWindows限定
# ※ディレクトリを指定した場合はエクスプローラが起動
function open()
{
# MSYSパスからWindowsパスへの変換
% -*- coding: shift_jis -*-
%
% グループゼミ資料など小文書用のクラスファイル
% Created by : Yusuke Sasaki <y_sasaki@nuem.nagoya-u.ac.jp>
%
%
\typeout{Class File: 'groupseminor' <22 Aug 2014>. Ver1.0}
%
% jsarticle.clsの読込み
\DeclareOption*{\PassOptionsToClass{\CurrenyOption}{jsarticle}}
@ubnt-intrepid
ubnt-intrepid / gmm_examples.ipynb
Created December 7, 2014 04:58
scikit-learnのGMMサンプル
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ubnt-intrepid
ubnt-intrepid / deep_ptr.hpp
Last active August 29, 2015 14:12
unique_ptrにコピーコンストラクタ+コピー代入演算子を追加してみる
#pragma once
#include <memory> // std::unique_ptr<T, D>
#if (__cplusplus < 201103)
# if defined(_MSC_VER) // ..., VC10.0, VC11.0, VC12.0
# define noexcept _NOEXCEPT
# endif
#endif
#include <algorithm>
#include <iostream>
#include <string>
#include <regex>
// 最初のレコードを抽出する
std::pair<std::string::const_iterator, std::string::const_iterator>
extract_record(std::string::const_iterator rstart, std::string::const_iterator rend)
{
bool is_quote = false;
@ubnt-intrepid
ubnt-intrepid / coroutine.cpp
Last active August 29, 2015 14:15
遅延評価サンプル
// cl /EHsc coroutine.cpp && coroutine.exe
#include <iostream>
#include <functional>
#include <thread> // std::this_thread::sleep_for
#include <future>
#include <queue>
using namespace std;
#include <algorithm>
#include <functional>
#include <type_traits>
#include <vector>
#include <iostream>
#include <iterator>
#include <boost/optional.hpp>
using boost::optional;
using boost::none;
#include <iostream>
#include <functional>
#include <utility>
#include <type_traits>
using namespace std;
namespace detail {
template <typename MaybeCallable, class... Args>
struct is_callable