Tanini++
10月27日に19歳になりました。
お祝いの言葉を送ってくれた人たち、どうもありがとう!
18歳はいろいろあった一年だった。
大学に合格したあとに書いた記事に少し書いているので省略するけれど、僕の10代中盤はなかなか厄介な時期だった。
高校ではある程度持ち直したのだけど、やっぱり心のどこかで引きずっていた。
そういうモヤモヤがやっと終わったな、という感じ。それが18歳でした。
19歳、最後の10代もいい一年にします。
Cygwinにslをインストール
ちょっと前の話になるのだけど、id:uiureoのツイートでslの存在を知り、面白そうだと思ったのでインストールした。
方法1:自分でコンパイルする
手順:
1. Cygwinのsetup.exeを起動して以下のパッケージをインストールする。
- wget (Web) (←必須ではない)
- libcurses-devel (Devel)
2. 適当なフォルダをつくり、wgetでsl.tarをダウンロード・解凍
> mkdir sl > cd sl > wget http://www.tkl.iis.u-tokyo.ac.jp/~toyoda/sl/sl.tar --2011-10-16 09:28:15-- http://www.tkl.iis.u-tokyo.ac.jp/~toyoda/sl/sl.tar www.tkl.iis.u-tokyo.ac.jp (www.tkl.iis.u-tokyo.ac.jp) をDNSに問いあわせています... 157.82.157.21 www.tkl.iis.u-tokyo.ac.jp (www.tkl.iis.u-tokyo.ac.jp)|157.82.157.21|:80 に接続しています... 接続しま した。 HTTP による接続要求を送信しました、応答を待っています... 200 OK 長さ: 20480 (20K) [application/x-tar] `sl.tar' に保存中 100%[======================================>] 20,480 76.1K/s 時間 0.3s 2011-10-16 09:28:15 (76.1 KB/s) - `sl.tar' へ保存完了 [20480/20480] > tar xvf sl.tar
make CC=gcc
とする。
そのままだとエラーが出る。
> make CC=gcc gcc -O -o sl sl.c -lcurses -ltermcap sl.c:30:20: fatal error: curses.h: No such file or directory コンパイルが中断されました。 make: *** [sl] エラー 1
curses.hが/usr/include/ncursesの中に入っているせいで、sl.cからの参照がうまくいってないらしい。
ので、-Iオプションをつけた。
コマンドを次のようにして実行。
make CC=gcc CFLAGS='-O -I/usr/include/ncurses'
すると、またエラー。
> make CC=gcc CFLAGS='-O -I/usr/include/ncurses' gcc -O -I/usr/include/ncurses -o sl sl.c -lcurses -ltermcap /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -ltermcap collect2: ld はステータス 1 で終了しました make: *** [sl] エラー 1
termcapが見つからないらしい。
Cygwinのsetup.exeからtermcap(Util)をインストールしてみるも解決せず。
ググってもよくわからなかった。
開き直ってtermcapを呼び出さないことにしてみた。
Makefileを編集。
$(CC) $(CFLAGS) -o sl sl.c -lcurses -ltermcap # $(CC) $(CFLAGS) -o sl sl.c -lcurses
となっていたのを
# $(CC) $(CFLAGS) -o sl sl.c -lcurses -ltermcap $(CC) $(CFLAGS) -o sl sl.c -lcurses
に修正。
すると、
> make CC=gcc CFLAGS='-O -I/usr/include/ncurses' gcc -O -I/usr/include/ncurses -o sl sl.c -lcurses > ls Makefile README sl.1 sl.c sl.exe sl.h sl.txt
コンパイルが成功してsl.exeができる。
あとはsl.exeをパスが通っている適当なディレクトリに移動させればOK。
これでlsをslに打ち間違えても安心!
参考
以下のページを参考にさせていただきました。
方法2:ダウンロードするだけ
もう少し調べていたらCygwin用にコンパイルされたexeファイルが見つかった。
こっちはめちゃくちゃアニメーションが長い。
> wget http://fd0.x0.to/cygwin/release/sl/sl-3.0.3-1bl13.tar.bz2 > tar xvf sl-3.0.3-1bl13.tar.bz2 usr/ usr/bin/ usr/bin/sl.exe usr/share/ usr/share/doc/ usr/share/doc/Cygwin/ usr/share/doc/Cygwin/sl.README usr/share/doc/sl/ usr/share/doc/sl/README usr/share/doc/sl/README.patch5 usr/share/man/ usr/share/man/man1/ usr/share/man/man1/sl.1.gz
usr/binにあるsl.exeを、適当なパスが通っているディレクトリにおけば完了。
僕はこのsl.exeをslsl.exeにリネームして/usr/local/binに置いています。
これでlsをslslに打ち間違っても安心!
CygwinでJAKLDを簡単に起動できるようにした
いちいちjava -jarうんたらかんたら…と打つのがめんどくさいのでコマンドを打てばJAKLDが一発で起動するようにした。
.bashrcの適当な場所に次の1行を追加
alias jakld='java -jar (jakld.jarへのパス)'
例
alias jakld='java -jar C:/cygwin/home/Tanini/JAKLD/jakld.jar'
alias
alias name=command
これを.bashrcに追加すると、cygwinでnameと打つとcommandが実行されるようになる。
※ JAKLDっていうのはJavaで書かれたSchemeのインタープリタで、大学の講義で使ってます。
Javaアプリケーション組み込み用のLispドライバ
.emacsの内容
最近大学の講義をきっかけにCygwin+Meadow環境をつくりました。
いろんなところから引っ張ってきてできた、いま現在のMeadowの設定を公開してみる。
;; 起動時のメッセージを表示しない (setq inhibit-startup-message t) ;;; シェル設定 ;; Cygwinのbashをつかう (setq explicit-shell-file-name "bash.exe") (setq shell-file-name "sh.exe") (setq shell-command-switch "-c") (modify-coding-system-alist 'process "shell" '(undecided-dos . utf-8)) ;; argument-editing の設定 (require 'mw32script) (mw32script-init) (setq exec-suffix-list '(".exe" ".sh" ".pl")) ;; coding-systemの設定 (add-hook 'shell-mode-hook (lambda () (set-buffer-process-coding-system 'undecided-dos 'sjis-unix))) ;; ^Mをとる (add-hook 'commit-output-filter-functions 'shell-strip-ctrl-m nil t) ;; shell-modeでの補完 (for drive letter) (setq shell-file-name-chars "~/A-Za-z0-9_^$!#%&{}@'`.,;()-") ;; homeディレクトリへの移動 (cd "~") ;;; 文字コード ;; unicode設定(mule-ucs) (require 'un-define) (require 'jisx0213) ;;; フォント (create-fontset-from-request "private-fontset" '((width . 7) (height . 14) (fixed . t) (italic . nil)) '((family . "MS ゴシック") (family . "Lucida Console"))) ;;; フォント、背景・文字カラーとか (setq default-frame-alist '((font . "private-fontset") (tool-bar-lines . 0) (background-color . "grey10") (foreground-color . "gray") (cursor-color . "gray") (width . 80) (height . 40) (alpha . (nil 70 50 30)))) ;;; IME設定 ;; Language Environment: Japanese (set-language-environment "Japanese") ;; Windows IME (mw32-ime-initialize) (setq default-input-method "MW32-IME") ;; IME ON/OFF mode-line (setq mw32-ime-show-mode-line t) ;; IME mode-line indicator ;; OFF : [--] ;; ON : [あ] (setq-default mw32-ime-mode-line-state-indicator "[--]") (setq mw32-ime-mode-line-state-indicator "[--]") (setq mw32-ime-mode-line-state-indicator-list '("[--]" "[あ]" "[--]")) ;; 行番号・桁番号 (line-number-mode 1) (column-number-mode 1) ;; ファイル名補完で大文字小文字を区別しない (setq completion-ignore-case t) ;;; バックアップファイルを作らない (setq backup-inhibited t) ;;; 終了時にオートセーブファイルを消す (setq delete-auto-save-files t) ;;; 補完時に大文字小文字を区別しない (setq completion-ignore-case t) ;; タイトルバーにファイル名を表示する (setq frame-title-format (format "%%b" )) ;;; キー設定 ;; C-hでBSする (global-set-key "\C-h" 'delete-backward-char) ;;; カラー設定 ;; 自動で色を付ける (global-font-lock-mode t) ;; regionに色を付ける (transient-mark-mode t) ;; 直前・直後の括弧に対応する括弧を光らせる (show-paren-mode) ;; カーソルがある行にアンダーラインを表示 (global-hl-line-mode) (setq hl-line-face 'underline) (hl-line-mode 1) ;; Emacs-Lispのカラーリング (defface my-face-elisp-macro '((t (:foreground "sea green"))) nil) (defface my-face-elisp-subr '((t (:foreground "SlateBlue3"))) nil) (defface my-face-elisp-func '((t (:foreground "SkyBlue1"))) nil) (defun my-font-lock-elisp-macro (limit) (when (re-search-forward "['(]\\([^() \n]+\\)" limit t) (or (and (not (memq (get-text-property 0 'face (match-string 1)) '(font-lock-comment-face font-lock-warning-face))) (condition-case nil (symbol-function (intern-soft (match-string-no-properties 1))) (error nil))) (my-font-lock-elisp-macro limit)))) (defun my-font-lock-elisp-subr (limit) (when (re-search-forward "['(]\\([^() \n]+\\)" limit t) (or (and (not (memq (get-text-property 0 'face (match-string 1)) '(font-lock-comment-face font-lock-warning-face))) (subrp (condition-case nil (symbol-function (intern-soft (match-string-no-properties 1))) (error nil)))) (my-font-lock-elisp-subr limit)))) (defun my-font-lock-elisp-func (limit) (when (re-search-forward "['(]\\([^() \n]+\\)" limit t) (or (and (not (memq (get-text-property 0 'face (match-string 1)) '(font-lock-comment-face font-lock-warning-face))) (byte-code-function-p (condition-case nil (symbol-function (intern-soft (match-string-no-properties 1))) (error nil)))) (my-font-lock-elisp-func limit)))) (font-lock-add-keywords 'lisp-interaction-mode '((my-font-lock-elisp-macro 1 'my-face-elisp-macro t)) t) (font-lock-add-keywords 'lisp-interaction-mode '((my-font-lock-elisp-func 1 'my-face-elisp-func t)) t) (font-lock-add-keywords 'lisp-interaction-mode '((my-font-lock-elisp-subr 1 'my-face-elisp-subr t)) t) (font-lock-add-keywords 'emacs-lisp-mode '((my-font-lock-elisp-macro 1 'my-face-elisp-macro t)) t) (font-lock-add-keywords 'emacs-lisp-mode '((my-font-lock-elisp-func 1 'my-face-elisp-func t)) t) (font-lock-add-keywords 'emacs-lisp-mode '((my-font-lock-elisp-subr 1 'my-face-elisp-subr t)) t) ;; Scheme用:インデントの定義 (put 'and-let* 'scheme-indent-function 1) (put 'begin0 'scheme-indent-function 0) (put 'call-with-client-socket 'scheme-indent-function 1) (put 'call-with-input-conversion 'scheme-indent-function 1) (put 'call-with-input-file 'scheme-indent-function 1) (put 'call-with-input-process 'scheme-indent-function 1) (put 'call-with-input-string 'scheme-indent-function 1) (put 'call-with-iterator 'scheme-indent-function 1) (put 'call-with-output-conversion 'scheme-indent-function 1) (put 'call-with-output-file 'scheme-indent-function 1) (put 'call-with-output-string 'scheme-indent-function 0) (put 'call-with-temporary-file 'scheme-indent-function 1) (put 'call-with-values 'scheme-indent-function 1) (put 'dolist 'scheme-indent-function 1) (put 'dotimes 'scheme-indent-function 1) (put 'if-match 'scheme-indent-function 2) (put 'let*-values 'scheme-indent-function 1) (put 'let-args 'scheme-indent-function 2) (put 'let-keywords* 'scheme-indent-function 2) (put 'let-match 'scheme-indent-function 2) (put 'let-optionals* 'scheme-indent-function 2) (put 'let-syntax 'scheme-indent-function 1) (put 'let-values 'scheme-indent-function 1) (put 'let/cc 'scheme-indent-function 1) (put 'let1 'scheme-indent-function 2) (put 'letrec-syntax 'scheme-indent-function 1) (put 'make 'scheme-indent-function 1) (put 'multiple-value-bind 'scheme-indent-function 2) (put 'match 'scheme-indent-function 1) (put 'parameterize 'scheme-indent-function 1) (put 'parse-options 'scheme-indent-function 1) (put 'receive 'scheme-indent-function 2) (put 'rxmatch-case 'scheme-indent-function 1) (put 'rxmatch-cond 'scheme-indent-function 0) (put 'rxmatch-if 'scheme-indent-function 2) (put 'rxmatch-let 'scheme-indent-function 2) (put 'syntax-rules 'scheme-indent-function 1) (put 'unless 'scheme-indent-function 1) (put 'until 'scheme-indent-function 1) (put 'when 'scheme-indent-function 1) (put 'while 'scheme-indent-function 1) (put 'with-builder 'scheme-indent-function 1) (put 'with-error-handler 'scheme-indent-function 0) (put 'with-error-to-port 'scheme-indent-function 1) (put 'with-input-conversion 'scheme-indent-function 1) (put 'with-input-from-port 'scheme-indent-function 1) (put 'with-input-from-process 'scheme-indent-function 1) (put 'with-input-from-string 'scheme-indent-function 1) (put 'with-iterator 'scheme-indent-function 1) (put 'with-module 'scheme-indent-function 1) (put 'with-output-conversion 'scheme-indent-function 1) (put 'with-output-to-port 'scheme-indent-function 1) (put 'with-output-to-process 'scheme-indent-function 1) (put 'with-output-to-string 'scheme-indent-function 1) (put 'with-port-locking 'scheme-indent-function 1) (put 'with-string-io 'scheme-indent-function 1) (put 'with-time-counter 'scheme-indent-function 1) (put 'with-signal-handlers 'scheme-indent-function 1) (put 'with-locking-mutex 'scheme-indent-function 1) (put 'guard 'scheme-indent-function 1) ;; .scmファイルの文字コードをeuc-jp-unixにする (modify-coding-system-alist 'file "\\.scm$" 'euc-jp-unix)
これをきっかけにemacsをちゃんと使えるようになりたい。
デザインを担当した「カニバリズム山脈」がリリースされました
カニバリズム山脈
大学の講義情報を蓄積するサービスです。現在京大のみ対応。
TwitterのIDでログインできます。
カニバリズム山脈というWebサービスをリリースしました(開発担当のid:uiureoくん)
遊んでみた:ミニチュア風写真
Quick Tip: How To Fake a Tilt-Shift Photoを見て、この間撮った写真をミニチュア風に加工してみた。
めっちゃ簡単だったけど、なかなかそれっぽく見える。