Skip to content

Instantly share code, notes, and snippets.

(defun latex-to-google-chart-api (start end)
(interactive "r")
(let ((latex-expression (kill-region start end)))
(insert-string
(concat "<img src=\"http://chart.apis.google.com/shart?cnt=tx&chl="
(w3m-url-encode-string (car kill-ring))
"\" alt=\"\" />") )))
;; デフォルトのinit.elの末尾に追加
;; My Settings for gnupack {{{1
;; key mapping {{{2
;; C-hをバックスペースに
(keyboard-translate ?\C-h ?\C-?)
(global-set-key (kbd "C-x ?") 'help-command)
;; C-x bでミニバッファにバッファ候補表示
(iswitchb-mode t)
(iswitchb-default-keybindings)
;; C-kで行全体削除
@nozma
nozma / Last.fmのチャートからプレイリスト作成.scpt
Created April 17, 2011 07:46
Last.fmのチャートをもとにプレイリスト(週間、3ヶ月、6ヶ月、12ヶ月、全期間で再生回数の多い曲)を作成する
-- 要XML Tools http://www.latenightsw.com/freeware/XMLTools2/
-- Last.fmユーザー名は適宜変更のこと
set username to "Rion778" -- Last.fm ユーザー名をセット
set max_playlist_length to 50 -- プレイリストの曲数の上限
set start_time to current date
set chart_filenames to {".LastFmChartWeekly", ".LastFmChartLast3months", ".LastFmChartLast6months", ".LastFmChartLast12months", ".LastFmChartToptracks"}
set chart_type to {"/weeklytrackchart", "/toptracks.xml?period=3month", "/toptracks.xml?period=6month", "/toptracks.xml?period=12month", "/toptracks.xml"}
set playlist_names to {"Last.fm - Weekly", "Last.fm - 3 months", "Last.fm - 6 months", "Last.fm - 12 months", "Last.fm - Overall"}
@nozma
nozma / Hatena2Word.vb
Created May 27, 2012 11:37
はてな記法をMS Wordのスタイルへ変換
Option Explicit
Sub ClearMyStyle()
'' 独自スタイルの削除
Dim myst As Variant
Dim myStNames() As Variant
Dim st As Style
Dim lg As ListGallery
Dim i As Long
@nozma
nozma / vapor.R
Created December 8, 2012 14:10
湿度計算セット
## --- 気温から飽和水蒸気圧を求める関数色々 ---
GofGra <- function(t){
## 入力:気温(℃)
## 出力:飽和水蒸気圧(hPa)
10^
(10.79574 * (1 - 273.16/(t + 273.15)) -
5.02800 * log((t + 273.15)/273.16, 10) +
1.50475 * 10^{-4} * {1-10^(-8.2969 * ((t + 273.15)/273.16 - 1))} +
0.42873 * 10^{-3} * {10^(4.76955*(1 - 273.16/(t + 273.15))) - 1} +
0.78614)
@nozma
nozma / Emacs.bas
Created April 14, 2013 15:25
Emacs風キーバインド in WordVBA
'' ----- Emacsモードの有効化と無効化 ---------------------
Sub EnableEmacsMode()
Call AddKeyBindings("ForwardChar", wdKeyControl + wdKeyF)
Call AddKeyBindings("BackwardChar", wdKeyControl + wdKeyB)
Call AddKeyBindings("NextLine", wdKeyControl + wdKeyN)
Call AddKeyBindings("PreviousLine", wdKeyControl + wdKeyP)
Call AddKeyBindings("BeginningOfLine", wdKeyControl + wdKeyA)
Call AddKeyBindings("EndOfLine", wdKeyControl + wdKeyE)
End Sub
@nozma
nozma / Sec6setup.R
Created July 5, 2016 15:08
Rプログラミング入門第6章用準備ファイル
# read "deck" dataframe
deck <- read.csv("https://gist.githubusercontent.com/garrettgman/9629323/raw/ee5dfc039fd581cb467cc69c226ea2524913c3d8/deck.csv")
DECK <- deck
# define functions
roll <- function(){
die <- 1:6
dice <- sample(die, size = 2, replace = TRUE)
sum(dice)
}
@nozma
nozma / Sec2ans.R
Created July 24, 2016 16:07
カテゴリカルデータ解析第2章練習問題解答
# 1.
# (a)
CtableS <- xtabs(~ Sex, data = Arthritis)
barplot(CtableS)
pie(CtableS, clockwise = TRUE)
# (b)
mosaicplot(~ Sex + Improved, data = Arthritis, col = TRUE)
# 3.
xtabs(Freq ~ management + own, data = JobSatisfaction)
@nozma
nozma / Sec3ans.R
Created July 24, 2016 16:35
カテゴリカルデータ解析第3章練習問題解答
# 練習問題
# 1.
binom.test(134, 200)$conf.int
# 2.
binom.test(145, 300, 0.3)
# 3.
p <- c(0.382, 0.219, 0.305, 0.094)
x <- c(39, 16, 27, 15)
@nozma
nozma / Sec5ans.R
Created July 26, 2016 13:29
カテゴリカルデータ解析第5章練習問題解答
# 練習問題
# 1.
# (a) (b)
mantelhaen.test(CoalMiners)
# (c)
library(epiDisplay)
mhor(mhtable = CoalMiners)
# 2.