Skip to content

Instantly share code, notes, and snippets.

View sky-y's full-sized avatar

Yuki Fujiwara sky-y

View GitHub Profile
@sky-y
sky-y / my-open-emacs-at-point.el
Created August 5, 2012 08:58
Emacs: Open the file which filename is pointed in an other window or dired
;; Open the file name being pointed in an other window or dired
;; reference: http://kouzuka.blogspot.com/2011/02/emacsurlfinder.html
(defun my-directory-or-file-p (path)
"return t if path is a directory,
return nil if path is a file"
(car (file-attributes path)))
(defun my-open-emacs-at-point ()
"open the file with opening emacs"
(interactive)
@sky-y
sky-y / forward-backword-to-word.el
Created August 5, 2012 11:10
Emacs: M-f,M-b for backward/forward word exactly
;; M-f,M-b for backward/forward word exactly
(require 'misc)
(global-set-key "\M-f" 'forward-to-word)
(global-set-key "\M-b" 'backward-to-word)
@sky-y
sky-y / ucs-normalize-NFC-buffer.el
Created August 5, 2012 12:14
Emacs: MacでPDFからコピーすると濁点が分離する問題を直す
;; ucs-normalize-NFC-region で濁点分離を直す
;; M-x ucs-normalize-NFC-buffer または "C-x RET u" で、
;; バッファ全体の濁点分離を直します。
;; 参考:
;; http://d.hatena.ne.jp/nakamura001/20120529/1338305696
;; http://www.sakito.com/2010/05/mac-os-x-normalization.html
(require 'ucs-normalize)
(prefer-coding-system 'utf-8-hfs)
(setq file-name-coding-system 'utf-8-hfs)
@sky-y
sky-y / _pandoc
Created August 12, 2012 19:48
Zsh completion for pandoc
#compdef pandoc
typeset -A opt_args
local context state line
_arguments -s -S \
'(-f+ --from=+)'{-r+,--read=+}'[Specify input format.]:FORMAT:(native json markdown textile rst html docbook latex)'\
'(-r+,--read=+)'{-f+,--from=+}'[Specify input format.]:FORMAT:(native json markdown textile rst html docbook latex)'\
'(-t+ --to=+)'{-w+,--write=+}'[Specify output format.]:FORMAT:(native json plain markdown rst html html5 latex beamer context man mediawiki textile org texinfo docbook opendocument odt docx epub asciidoc slidy slideous dzslides s5 rtf)'\
'(-w+ --write=+)'{-t+,--to=+}'[Specify output format.]:FORMAT:(native json plain markdown rst html html5 latex beamer context man mediawiki textile org texinfo docbook opendocument odt docx epub asciidoc slidy slideous dzslides s5 rtf)'\
@sky-y
sky-y / fullpath
Created August 15, 2012 06:47
[Shell Script] Get the full path from a (non-full) filename
#!/bin/sh
#usage:
# $ cd /usr/bin
# $ fullpath vim
# /usr/bin/vim
find `pwd` -name $1
@sky-y
sky-y / mediabb.sty
Created August 23, 2012 14:51
[mirror][LaTeX] mediabb.sty (by iNOUE Koich!): Including PDF images in pLaTeX
% Original Author: iNOUE Koich! http://www.ma.ns.tcu.ac.jp/Pages/
% Original Source: http://www35.tok2.com/home/hashimotolab/LaTeX/mediabb.sty
% Mirror Date: August 23, 2012
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mediabb}[2006/10/26 v1.9 iNOUE Koich! <[email protected]>]
\@ifpackageloaded{graphics}{}{\RequirePackage[dvipdfm]{graphicx}}
\define@key{Gin}{usebb}[true]{\expandafter\let\expandafter\if@usebb\csname if#1\endcsname}
\let\if@usebb\iffalse
\define@key{Gin}{mediaboxonly}[/MediaBox]{\@ifundefined{Gread@find@#1}%
@sky-y
sky-y / my-key-combo.el
Created October 20, 2012 08:01
key-combo.elのグローバル設定
;; key-combo.el
;; http://d.hatena.ne.jp/uk-ar/20111208/1322572618
(require 'key-combo)
(key-combo-define-global (kbd "(") '("(" "(`!!')" "( `!!' )" "(("))
;; (key-combo-define-global (kbd "(") '("("))
;; (key-combo-define-global (kbd "(") '("("))
;; (key-combo-define-global (kbd "()") '("()"))
@sky-y
sky-y / haskell-key-combo.el
Created October 20, 2012 08:05
[修正済(12.10.22)] Haskell用key-combo.elの設定
;; key-combo
;; add-hook: on init.el
(defun my-haskell-key-combo ()
(key-combo-define-local (kbd "-") '("-" " -> " "--"))
(key-combo-define-local (kbd "<") '("<" " <- " " <= " " =<< " "<<" "<"))
(key-combo-define-local (kbd ">") '(">" " >= " " >>= " ">"))
(key-combo-define-local (kbd "=") '("=" " = " " == " " => " "=="))
(key-combo-define-local (kbd ":") '(":" " :: " "::"))
(key-combo-define-local (kbd "+") '("+" " + " " ++ " "++"))
)
@sky-y
sky-y / iconv-nfd-to-nfc.sh
Created December 22, 2012 06:07
iconv(Shell Script): Macで濁点が分離する問題を直す (Unicode NFD to NFC)
#!/bin/sh
# Unicode NFD to NFC
# 標準出力に出力されるので、適当にパイプで処理する
iconv -f UTF-8-MAC -t UTF-8 input.txt
@sky-y
sky-y / jlatexdiff.sh
Last active June 3, 2016 08:10
jlatexdiff: latexdiffを日本語LaTeX文書でうまく扱えるようにする 参考:http://blogs.yahoo.co.jp/pentainformation/28571072.html
#!/bin/bash
# jlatexdiff: latexdiffを日本語LaTeX文書でうまく扱えるようにする
# 参考:http://blogs.yahoo.co.jp/pentainformation/28571072.html
# 実行時に指定された引数の数、つまり変数 $# の値が 2 でなければエラー終了
if [ $# -ne 2 ]; then
echo "指定された引数は$#個です." 1>&2
echo "実行するには2個の引数が必要です." 1>&2
echo "jlatexdiff [old file name] [new file name]" 1>&2