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
///
/// F#からGurobiを使用するサンプル
///
/// 参考: http://www.gurobi.com/documentation/6.0/quickstart_windows/cs_example_mip1_cs_cs.html
///
open System
open Gurobi
[<EntryPoint>]
@ubnt-intrepid
ubnt-intrepid / output.txt
Last active August 29, 2015 14:27
std::chrono::durationを使ったBoost.Unitsもどき
1.21111
121.111
1.21111
12
12000
0
#include <iostream>
#include <string>
#include <vector>
#include "time_series.hpp"
template <typename T = double, typename Duration = std::chrono::seconds>
my::time_series<T, Duration> load_series(std::string const& file_path)
{
// load datasets.
  • コミット前にclang-format + BOMつきUTF-8に変換
  • .gitattributes にautocrlfオプションをつける
@ubnt-intrepid
ubnt-intrepid / dos2unix.sh
Last active August 29, 2015 14:26
Shift-JIS から UTF-8 (with BOM) に変換するスクリプト (perl, shell script)
perl -MEncode -pe 'BEGIN{print "\xEF\xBB\xBF"} s/\r\n/\n/g;Encode::from_to($_,"shiftjis","utf-8");' $1 > $2
#include "Collector.hpp"
class GraphCollector : private Collector
{
private:
void push_impl(object && data) override
{
// send to graph
}
};
@ubnt-intrepid
ubnt-intrepid / file.md
Created July 27, 2015 13:03
Gitのログの中から特定の拡張子のファイル名を抽出する

git filter-branch で履歴を一括削除したい場合に用いる

拡張子指定

$ git log --name-only 2> /dev/null | grep '.\(sdf\|suo\)$' | sort | uniq
hoge/huga/test.sdf
hoge/huga/test.v12.suo
...

作業メモ

autopep8 をWindows上で自動化する

$ # カレントディレクトリ以下のPythonファイルのうちPEP8に準拠していないものを自動的に修正する
$ pep8 . | cut -d: f1 | sort | uniq | sed 's!\\!/!g' | xargs autopep8 -i
#!/usr/bin/env python
# -*- coding: utf-8 -*-
r'''TeX系コマンドのPythonインタフェース
Functions:
- make_pdf : TeX文書を PDF に変換
- read_bounding_box : 画像の Bounding Box を取得
Memo:
@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}