This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- add line number to gist --> | |
<script type="text/javascript"> | |
var gists = document.getElementsByClassName('gist'); | |
for (var i = 0; i < gists.length; i++) { | |
var lines = gists[i].getElementsByClassName('line'); | |
for (var j = 0; j < lines.length; j++) { | |
var div = document.createElement('div'); | |
div.innerHTML = j + 1; | |
div.style.cssFloat = 'left'; | |
div.style.width = '30px'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
LaTeX for Blogger, requires jQuery | |
1. Add a HTML/Javascript gadget in the Layout mode and write this code. | |
2. In the HTML edit mode, write equations as follows: | |
<div class="equation"> | |
ax^2 + bx + c = 0 | |
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
多次元尺度構成法 | |
Multidimensional Scaling; MDS | |
""" | |
import numpy as np | |
import matplotlib.pyplot as plt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6.040760282116731938e-02 2.003600989193874138e-01 0 | |
-2.180560612167562751e-01 -8.292820699779238636e-01 0 | |
-5.144639589460509033e-01 8.281746425448210935e-01 0 | |
-4.740161490764375866e-03 -3.159114014274040476e-03 0 | |
-1.417081236535422117e-01 -1.966777129492919621e-02 0 | |
6.803427539200110341e-02 7.803962205781220240e-02 0 | |
-1.875352326510989487e-01 2.345321639090314769e-01 0 | |
2.805120457198624351e-01 1.557595199768933847e-01 0 | |
-2.649491374332632043e-01 -3.705041702348287058e-02 0 | |
-1.841101081351155799e-01 -6.072910303536597360e-02 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import re | |
regex = u'^[ぁ-ゞ・ー]+$' # ひらがな+・+ーだけ | |
p = re.compile(regex) | |
for line in open('ruby.txt'): | |
file, kanji, yomi = line.strip().split('\t') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import math | |
import random | |
class plsa(): | |
def __init__(self,n,nz=2): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
TeX2PDF for CotEditor | |
編集中のTeXファイルをDrag & Drop pTeX (http://www2.kumagaku.ac.jp/teacher/herogw/)でタイプセットするスクリプト。texファイルはどこかに保存されている必要があります。デフォルトではpTeX.appは“アプリケーション”フォルダにインストールされているとします。pTeX.appのスクリプトを参考にしました。少し書き換えればportsなどでインストールしたpTeXにも対応できるかもしれません。 | |
*) | |
(* written by satomacoto. 2010.1.26 *) | |
tell application "CotEditor" | |
if exists front document then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
from collections import defaultdict | |
d = defaultdict(int) | |
for line in sys.stdin: | |
title, author, moji, rubi = line[:-1].split('¥t') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
TEX=$* | |
DVI=`/usr/bin/basename "$TEX" ".tex"` | |
THECODE=`nkf -g "$TEX"` | |
case $THECODE in | |
UTF-8) KANJI="-kanji=utf8" ;; | |
EUC-JP) KANJI="-kanji=euc" ;; | |
Shift_JIS) KANJI="-kanji=sjis" ;; | |
ISO-2022-JP) KANJI="-kanji=jis" ;; | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from matplotlib import pyplot as plt | |
data = """1 0.841470984807896 | |
0.54030230586814 0.287797828416081 | |
-0.416146836547142 0.172313864573127 | |
-0.989992496600445 0.830544794233449 | |
-0.653643620863612 0.414369558091726""" |