Skip to content

Instantly share code, notes, and snippets.

// 以下のFirefox用アドオンにタグ選択パネルを付加するuserChrome.jsスクリプトです
// Hatebu IncSearch, livedoor clip IncSearch, del.icio.us IncSearch, Google Bookmarks IncSearch
(function(){
const LIVEDOOR_URL = 'chrome://livedoorclip_incsearch/content/view.html';
const LIVEDOOR_DIR = 'livedoorclip_incsearch';
const HATEBU_URL = 'chrome://hatebu_incsearch/content/view.html';
const HATEBU_DIR = 'hatebu_incsearch';
const DELICIOUS_URL = 'chrome://delicious_incsearch/content/view.html';
@ronekko
ronekko / LDR - More about Recently Added Feeds.user.js
Last active August 29, 2015 14:11
LDR - More about Recently Added Feeds.user.js
// ==UserScript==
// @name LDR - More about Recently Added Feeds
// @namespace http://profile.livedoor.com/ronekko/
// @description Livedoor Readerで「○○の新着フィード」のフィードにより詳しい情報を追加する
// @include http://reader.livedoor.com/reader/
// @include http://reader.livedoor.com/subscribe/*
// @version 20141229
// ==/UserScript==
//20120512: Greasemonkey 0.9.19におけるwindow.setTimeoutの仕様変更に対処
//20141210: "Live Dwango Readerに登録"に変更になったことへの対処とか
@ronekko
ronekko / LDR - Expand Folders in Rate View Mode.user.js
Last active August 29, 2015 14:12
LDR - Expand Folders in Rate View Mode
// ==UserScript==
// @name LDR - Expand Folders in Rate View Mode
// @namespace http://profile.livedoor.com/ronekko/
// @description Livedoor Readerで起動/リロード時にフォルダを自動的に開く(レート表示モードのときのみ)
// @include http://reader.livedoor.com/reader/
// @version 20150102
// @grant GM_getValue
// @grant GM_setValue
// @grant unsafeWindow
// ==/UserScript==

numpy.dot について

xとWのshapeが様々なパターンのときの、a = np.dot(x, W) の結果のaのshapeを観察すると以下のようになっている。

x.shape W.shape a.shape
(D,) (D,) scalar
(D,) (D, 1) (1,)
(D,) (D, K) (K,)
(N, D) (D, K) (N, K)
(T, N, D) (D, K) (T, N, K)
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 15 12:59:56 2015
@author: sakurai
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn import preprocessing

SPTKをWindows+MSVC環境にインストールする方法

前提: インストール先をC:\SPTKとする。

  1. 公式サイトからソースコード(例: SPTK-3.8.tar.gz)をダウンロード、任意の場所に展開し、ソースコードのフォルダを開く(例: C:\SPTK-3.8)。
  2. Makefile.makの1行目を編集し、C:\SPTK\binC:\SPTK 変更する(\binを削除する)。あるいは、任意のパスを指定すると、そのフォルダにインストールされる。
  3. Visual Studioの x86 Native Tools コマンドプロンプト管理者権限で起動し、C:\SPTK-3.8 に移動する。x64版ではコンパイルできなかった。
  4. unistd.h が無いため、どこかから拾ってきて C:\SPTK-3.8\include\unistd.h を作成する。例えば、Win7 64bit, MSVS2013なら このリンク先からコピペする のでもコンパイルできた。
  5. 以下のコマンドを、順番に実行し、エラーが出なれけばインストール完了。
nmake /f Makefile.mak
import subprocess
subprocess.Popen(['proc.bat'], creationflags=subprocess.CREATE_NEW_CONSOLE)
print "Launched a process on new console"
@ronekko
ronekko / basic_distributions.py
Last active December 1, 2017 10:48
Basic probability distributions
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 25 23:08:22 2015
@author: ryuhei
"""
import numpy as np
import matplotlib.pyplot as plt
@ronekko
ronekko / mixture_distributions.py
Last active August 29, 2015 14:27
Mixture distribusions
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 10 14:40:04 2015
@author: ryuhei
"""
import numpy as np
from basic_distributions import (
ProbabilityDistribution, Multinomial, Gaussian, Poisson
@ronekko
ronekko / faviconize_google_nested.user.js
Last active February 20, 2021 13:35
faviconize google, fixed for update of google at 2015/07/23
// ==UserScript==
// @name Faviconize Google (nested icons)
// @namespace http://userscripts.ru/js/faviconize-google/
// @description Adds favicons to each link offered by Google search results.
// @include https://www.google.*/search?*
// @include https://encrypted.google.*/search?*
// @include https://www.google.*/webhp*
// @include https://www.google.*/#*
// @include https://groups.google.*/groups/search?*
// @copyright 2009+, Nikita Vasilyev (http://userscripts.org/scripts/show/58177)