Skip to content

Instantly share code, notes, and snippets.

View t-uda's full-sized avatar

Tomoki UDA t-uda

  • AIMR, Tohoku University
  • Sendai
  • X @t_uda
View GitHub Profile
@t-uda
t-uda / bad-newenvironment-lstlisting.tex
Created June 23, 2012 15:00
lstlisting の新しい環境を定義する \lstnewenvironment ref: http://qiita.com/items/8ac529870144884f2951
\documentclass{article}
\usepackage{listings}
\lstset{language=C++}
\newenvironment{C++}{\begin{lstlisting}}{\end{lstlisting}}
\begin{document}
\begin{C++}
#include <iostream>
int main () {
\PassOptionsToClass{hiresbb}{graphicx}
\documentclass[dvipdfmx]{beamer}\listfiles
\usepackage{graphicx}
\usepackage{pgf}
%\usetheme{Warsaw}
%\setbeamertemplate{blocks}[default]
\newcommand{\thickhrulefill}{\leavevmode\leaders\hrule depth-1.2pt height 3.2pt\hfill\kern0pt}
\newcommand{\indicatewidth}[1]{\thickhrulefill{#1}\thickhrulefill}
@t-uda
t-uda / Hat.tex
Created January 7, 2014 14:08
$\left(\hat{ ... }\right)$ のカッコが大きくて気持ち悪い ref: http://qiita.com/t_uda/items/05441624c28b802ca12e
%% 縦に大きくならないハット付き文字を作る。
%%%% \hbox to 0pt : 幅 0pt のボックスを作る。
%%%% \phantom : その文字列の大きさで何も表示されないボックスを作る。
%%%% \raisebox : ボックスの位置・サイズを変更する。
%%%% \mathchoice : 数式モードに応じて条件分岐する。
\def\Hat#1{{\fboxsep0pt\mathchoice
{\hbox to 0pt{\phantom{$\displaystyle #1$} }\raisebox{0ex}[0pt][0pt]{$\displaystyle\hat{#1}$}}
{\hbox to 0pt{\phantom{$\textstyle #1$} }\raisebox{0ex}[0pt][0pt]{$\textstyle\hat{#1}$}}
{\hbox to 0pt{\phantom{$\scriptstyle #1$} }\raisebox{0ex}[0pt][0pt]{$\scriptstyle\hat{#1}$}}
{\hbox to 0pt{\phantom{$\scriptscriptstyle #1$}}\raisebox{0ex}[0pt][0pt]{$\scriptscriptstyle\hat{#1}$}}
@t-uda
t-uda / gist:5822869
Last active December 18, 2015 17:59
#!/usr/bin/env ruby
$memo = [1]
JUMAN = 100000
def removeZeros(x)
while (x % 10 == 0) do
x /= 10
end
@t-uda
t-uda / output-for-test-interval-fun-math-0.txt
Created June 19, 2012 15:35
boost::numeric::interval<int>(2): C++ Boost 区間演算ライブラリ 数学関数 ref: http://qiita.com/items/abcf31a7b1787604a4f4
a = [-1,3]
b = [2,4]
min(a, b) = [-1,3]
max(a, b) = [2,4]
abs(a) = [0,3]
@t-uda
t-uda / bad-example.js
Created October 17, 2012 07:08
new 演算子を使いつつ可変長引数っぽいことをするには? ref: http://qiita.com/items/60817eeaab857b2fb316
function Hoge (a) {
this.x = a;
}
var a = new (function () { return Hoge.apply(this, ["hoge"]); })();
a instanceof Hoge; // => false
@t-uda
t-uda / .gitconfig
Created August 26, 2012 14:41
git show-branch を使っていないだなんて! ref: http://qiita.com/items/9b6055aa93215cb8bac1
[alias]
sb = show-branch -a
br = branch
st = !git status -s && git stash list | cat
cfm = !git sb && git br && git st
@t-uda
t-uda / file1.sh
Created August 12, 2012 08:45
boost::numeric::interval<int>(3): C++ Boost 区間演算ライブラリ 超越関数 ref: http://qiita.com/items/e08ca64b318917e6d4ab
$ g++ test-interval-transc-error.cpp
In file included from /usr/include/boost/numeric/interval.hpp:30:0,
from test-interval-transc-error.cpp:2:
/usr/include/boost/numeric/interval/transc.hpp: In function ‘boost::numeric::interval<T, Policies> boost::numeric::exp(const boost::numeric::interval<T, Policies>&) [with T = double, Policies = boost::numeric::interval_lib::policies<boost::numeric::interval_lib::rounded_math<double>, boost::numeric::interval_lib::checking_strict<double> >]’:
test-interval-transc-error.cpp:12:30: instantiated from here
/usr/include/boost/numeric/interval/transc.hpp:34:64: error: ‘boost::numeric::interval_lib::policies<boost::numeric::interval_lib::rounded_math<double>, boost::numeric::interval_lib::checking_strict<double> >::rounding’ has no member named ‘exp_down’
/usr/include/boost/numeric/interval/transc.hpp:34:64: error: ‘boost::numeric::interval_lib::policies<boost::numeric::interval_lib::rounded_math<double>, boost::numeric::interval_lib::checking_strict<double
@t-uda
t-uda / file0.sh
Created August 12, 2012 07:36
Debian で WPA-PSK(AES) 方式で無線接続 - wpa_supplicant 編 ref: http://qiita.com/items/a29874cbeecd080ea2fe
$ sudo aptitude install wpasupplicant
@t-uda
t-uda / MY_HOME
Created August 12, 2012 06:24
Debian で WPA-PSK(AES) 方式で無線接続 - NetworkManager 編 ref: http://qiita.com/items/42e96c2daa2ca932f7e3
[connection]
id=MY_HOME
uuid=***-***-***-***-***
type=802-11-wireless
[802-11-wireless]
ssid=MY_HOME
mode=infrastructure
mac-address=**:**:**:**:**:**
security=802-11-wireless-security