Skip to content

Instantly share code, notes, and snippets.

(autoload 'js-console "js-console" nil t)
(defun js-console-eval-region (start end)
"Execute region"
(interactive "r")
(let ((buf-name (buffer-name (current-buffer))))
(copy-region-as-kill start end)
(switch-to-buffer-other-window "*js*")
(js-console-exec-input (car kill-ring))
(switch-to-buffer-other-window buf-name)))
(defun run-js-console-and-split-window ()
(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 / latex-to-google-chart-api.el
Created April 29, 2011 02:58
latex表現をgoogle chart apiの形式へ変換
(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/chart?cht=tx&chl="
(w3m-url-encode-string (car kill-ring))
"\" alt=\"\" />") )))
(global-set-key "\C-c\C-l\C-t" 'latex-to-google-chart-api)
@nozma
nozma / hatena-latex-to-google-chart-api.el
Created May 7, 2011 17:29
はてダのtex記法をgoogle chart apiを使った数式表現に変換&逆変換
;; latex数式をgoogle chart apiを使った数式表現に変換
(defun latex-to-google-chart-api ()
(interactive)
(replace-regexp "\\[tex:\\(.*?\\)\\]"
(query-replace-compile-replacement
"<img src=\"http://chart.apis.google.com/chart?cht=tx&chl=\\,(url-hexify-string \\1)\"/>" t) nil (point-min) (point-max)))
(global-set-key "\C-c\C-l\C-t" 'latex-to-google-chart-api)
;; 逆変換
(defun google-chart-api-to-latex ()
(interactive)
@nozma
nozma / EmacsMode.bas
Created May 5, 2012 15:51
Emacs like key bindings for Microsoft Excel
'' define EmacsMode key bindings
Sub EmacsMode()
With Application
.OnKey "^{f}", "ForwardCell"
.OnKey "^{b}", "BackwardCell"
.OnKey "^{p}", "PreviousLine"
.OnKey "^{n}", "NextLine"
.OnKey "^{a}", "BeginningOfUsedRangeLine"
.OnKey "^{e}", "EndOfUsedRangeLine"
.OnKey "%{<}", "BeginningOfUsedRangeRow"
@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