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
;;; Convert text to audible speech by /usr/bin/say (Emacs + OSX) | |
(defun MyTeX-speech () | |
"Convert text to audible speech by /usr/bin/say of OSX." | |
(interactive) | |
(let (b e s | |
(block-sep-str "^\*\\|^\\ *%\\|^\\ *\n\\|\\\\item\\|\\\\begin\\|\\\\end")) | |
(if (eq (process-status "speech") 'run) | |
(delete-process "speech") | |
(progn | |
(if mark-active |
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
(defun MyTeX-open-article () | |
"Open PDF file by the cite key: \cite{foo} -> open foo.pdf" | |
(interactive) | |
(let* ((s (save-excursion | |
(skip-chars-backward "^{,") | |
(point))) | |
(e (save-excursion | |
(skip-chars-forward "^},") | |
(point))) | |
(pdfdir "~/Documents/Dropbox/Papers/pdf/") |
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
;;; フォントセットを作る | |
(let* ((fontset-name "myfonts") ; フォントセットの名前 | |
(size 12) ; ASCIIフォントのサイズ [9/10/12/14/15/17/19/20/...] | |
(asciifont "Menlo") ; ASCIIフォント | |
(jpfont "Hiragino Maru Gothic ProN") ; 日本語フォント | |
(font (format "%s-%d:weight=normal:slant=normal" asciifont size)) | |
(fontspec (font-spec :family asciifont)) | |
(jp-fontspec (font-spec :family jpfont)) | |
(fsn (create-fontset-from-ascii-font font nil fontset-name))) | |
(set-fontset-font fsn 'japanese-jisx0213.2004-1 jp-fontspec) |
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
;;; フレームのフォントを設定 | |
(let* ((size 12) ; ASCIIフォントのサイズ [9/10/12/14/15/17/19/20/...] | |
(asciifont "Menlo") ; ASCIIフォント | |
(jpfont "Hiragino Maru Gothic ProN") ; 日本語フォント | |
(h (* size 10)) | |
(fontspec (font-spec :family asciifont)) | |
(jp-fontspec (font-spec :family jpfont))) | |
(set-face-attribute 'default nil :family asciifont :height h) | |
(set-fontset-font nil 'japanese-jisx0213.2004-1 jp-fontspec) | |
(set-fontset-font nil 'japanese-jisx0213-2 jp-fontspec) |
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
(defun MyTool-speech-region-Kyoko () | |
"Convert text to audible speech by /usr/bin/say of OSX." | |
(interactive) | |
(let ((str (concat (buffer-substring-no-properties (point) (mark))))) | |
(setq str (replace-regexp-in-string "\\\\%" "percent" str)) | |
(setq str (replace-regexp-in-string "%\n" "" str)) | |
(setq str (replace-regexp-in-string "\\%[^\n]+" "" str)) | |
(setq str (replace-regexp-in-string "%" "" str)) | |
(setq str (replace-regexp-in-string "\\\\[a-zA-Z]+" " " str)) | |
(setq str (replace-regexp-in-string "[$_^\n()~{}|;]" " " str)) |
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
(define-key global-map (kbd "C-c w") 'MyTool-lookup-dictionary-osx) | |
(define-key global-map (kbd "C-c g") 'MyTool-search-google) | |
(define-key global-map (kbd "C-c G") 'MyTool-search-googlescholar) | |
(defun MyTool-search-google() | |
"Search by google" | |
(interactive) | |
(let* ((str (string-word-or-region))) | |
(browse-url | |
(concat "http://google.com/search?q=\"" str "\"")))) |
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
;;; Finder でフォルダを開く | |
;; ショートカット: ⌘-option-shift-F | |
;; (ショートカットは USキーボードで確認) | |
(define-key global-map [?\s-Ï] 'MyTool-open-folder-in-finder) | |
(defun MyTool-open-folder-in-finder () | |
"open -a Finder.app CURRENT-DIRECTORY" | |
(interactive) | |
(process-query-on-exit-flag | |
(start-process-shell-command "open folder in Finder" nil "open ."))) |
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
;;; Tsuchiya-san's corrections (yatex ML [yatex:04810,04811]) | |
(defun skim-forward-search () | |
(interactive) | |
(process-query-on-exit-flag | |
(start-process | |
"displayline" | |
nil | |
"/Applications/Skim.app/Contents/SharedSupport/displayline" | |
(number-to-string (save-restriction | |
(widen) |
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
(defun MyTeX-open-item-BibDesk () | |
"Open the bibitem in BibDesk.app" | |
(interactive) | |
(let* ((s (save-excursion | |
(skip-chars-backward "^{,") | |
(point))) | |
(e (save-excursion | |
(skip-chars-forward "^},") | |
(point)))) | |
(browse-url (concat "x-bdsk://" (buffer-substring-no-properties s e))))) |
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
#/Applications/VPython-Py2.7/VIDLE.app/Contents/MacOS/Python | |
# coding=utf-8 | |
from visual import * | |
import numpy | |
import sys | |
fin = open(sys.argv[1]) | |
scene = display(title='Simple Shear', | |
width=1100, height=800, |
OlderNewer