Skip to content

Instantly share code, notes, and snippets.

@FromAtom
FromAtom / saykanakanji.rb
Last active December 16, 2015 15:09
コマンドライン引数で取得した文章をruby-mecabを使って発音を解析、最後にSayKanaコマンドに読ませる。
# -*- encoding: utf-8 -*-
#!/usr/bin/env ruby
require 'rubygems'
require 'MeCab'
mecab = MeCab::Tagger.new("")
ARGV.each{ |arg|
kana = ''
parse_node = mecab.parseToNode(arg)
@FromAtom
FromAtom / init-tex.el
Last active February 6, 2019 05:14
YaTeXでTeXを書いている状態で保存時に動作する。 "、"と"。"を","と"." に変換し、全角英数字を半角英数字に変換する。
;;バッファ全体の句読点と読点をコンマとピリオドに変換
(defun replace-commaperiod-buffer ()
(interactive "r")
(save-excursion
(replace-string "、" "," nil (point-min) (point-max))
(replace-string "。" "." nil (point-min) (point-max))))
;;選択範囲内の全角英数字を半角英数字に変換
(defun hankaku-eisuu-region (start end)
(interactive "r")