Skip to content

Instantly share code, notes, and snippets.

@kkdd
kkdd / 01.cmake
Last active August 29, 2015 14:05
pgrouting 2.0.0 did not build (homebrew)
-- The C compiler identification is AppleClang 5.1.0.5030040
-- The CXX compiler identification is AppleClang 5.1.0.5030040
-- Check for working C compiler: /usr/local/Library/ENV/4.3/clang
-- Check for working C compiler: /usr/local/Library/ENV/4.3/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/local/Library/ENV/4.3/clang++
-- Check for working CXX compiler: /usr/local/Library/ENV/4.3/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
@kkdd
kkdd / gist:fa9dc816973b4e20ee9f
Last active January 15, 2016 22:10
Error: 407 "Proxy Authentication Required" when brew search ...
$ brew search gcc
gcc
Error: 407 "Proxy Authentication Required"
Please report this bug:
https://github.com/Homebrew/homebrew/wiki/troubleshooting
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:119:in `error!'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:128:in `value'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:913:in `connect'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:851:in `start'
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 3 columns, instead of 1. in line 5.
x,y,UTF-8_(日本語=Japanese)
1.1,1.2,1.3
2.1,2.2,2.3
3.1,3.2,3.3
4.1,4.2,4.3
# $ nkf --guess UTF-8.csv
# UTF-8 (LF)
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 3 columns, instead of 1. in line 5.
x,y,Shift_JIS_(���{��=Japanese)
1.1,1.2,1.3
2.1,2.2,2.3
3.1,3.2,3.3
4.1,4.2,4.3
# $ nkf --guess Shift_JIS.csv
# Shift_JIS (LF)
\textrm{An elliptic arc length formula from a modification of Bessel (1825)}\\
\begin{aligned}
m(\varphi) &= \int_0^\varphi M(\varphi) d\varphi \\
&=\frac{a}{1+n}\left( \int_0^\varphi \sqrt{1+2n\cos2\varphi+n^2} \, d\varphi - \frac{2n \sin2\varphi}{\sqrt{1 + 2n \cos2\varphi + n^2}} \right) \\
&=\frac{a}{1+n}\left( c_0 \, \varphi + \sum_{l=1}^\infty c_l \, l^{-1} \sin 2 l \varphi - \frac{2n \sin2\varphi}{\sqrt{1 + 2n \cos2\varphi + n^2}} \right) \\
M(\varphi) &= \frac{a(1-e^2)}{(1-e^2\sin^2\varphi)^{3/2}} \\
e^2 &= \frac{4 n}{\left(1+n\right)^2} \\
c_l &= n^l \sum_{j=0}^\infty n^{2j} \binom{1/2}{j} \, \binom{1/2}{j+l}
\end{aligned}
@kkdd
kkdd / file0.txt
Last active August 8, 2016 14:02
分数の表示(リスト) ref: http://qiita.com/kkdd/items/d3eda81b69610201279d
print(prettyfrac(...)) # print pretty fractions
# ==> [[1, 1/4, 1/64, 1/256], [1/2, -1/16, -1/128], ...]
@kkdd
kkdd / file0.txt
Last active March 14, 2017 13:46
浮動小数点数のリストの表示出力 ref: http://qiita.com/kkdd/items/4f3c112ccb043d4bc501
print(prettyfloat([1./3, 2./3], ndec=3)) # print pretty float numbers
# ==> [0.333, 0.667]
@kkdd
kkdd / file0.txt
Last active March 14, 2017 15:34
print で、リスト内の非ascii文字を見栄え良く ref: http://qiita.com/kkdd/items/b41611777f020690893e
s = [1, '日', ['本']]
print(list_str(s)) # ==> [1, '日', ['本']]
print(s) # ==> [1, '\xe6\x97\xa5', ['\xe6\x9c\xac']]
@kkdd
kkdd / file0.txt
Last active September 6, 2015 08:33
pip search に自分好みの表示機能を加える ref: http://qiita.com/kkdd/items/18cccfe505fe0ebe9a5d
$ pip search cvxopt
cvxopt - Convex optimization package
INSTALLED: 1.1.7 (latest)
https://pypi.python.org/pypi/cvxopt <== この表示を加えたい
$ pip search pandas
pandas - Powerful data structures for data analysis, time series,and statistics
LATEST: 0.15.2 (not installed) <== この表示を加えたい
https://pypi.python.org/pypi/pandas <== この表示を加えたい
@kkdd
kkdd / em.py
Last active November 11, 2015 12:48
混合ガウス分布問題のEMアルゴリズム計算 ref: http://qiita.com/kkdd/items/695dc20748b45fbda8e5
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
from matplotlib.patches import Ellipse