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 dired-add-to-smplayer-playlist () | |
"Add a multimedia file or all multimedia files under a directory into SMPlayer's playlist via Dired." | |
(interactive) | |
(require 'cl) | |
(let* (PATTERN FILE full-path-FILE n) | |
(setq PATTERN "\\(\\.mp4\\|\\.flv\\|\\.rmvb\\|\\.mkv\\|\\.avi\\|\\.rm\\|\\.mp3\\|\\.wav\\|\\.wma\\|\\.m4a\\|\\.mpeg\\|\\.aac\\|\\.ogg\\|\\.flac\\|\\.ape\\|\\.mp2\\|\\.wmv\\)$") | |
(setq FILE (dired-get-filename nil t)) | |
(setq n 0) | |
(if (file-directory-p FILE) ;if it's a dir. | |
(progn |
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
;;Emacs24開始內建的package.el相關設定 | |
(require 'package) | |
(package-initialize) | |
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) | |
;;超變態的undo-tree-mode | |
;;(提醒:redo會變成C-?) | |
;;C-x u 進入 undo-tree-visualizer-mode,t顯示時間戳。 | |
(require 'undo-tree) | |
(global-undo-tree-mode) |
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
;;kuanyui's ~/.emacs | |
;;Time-stamp: "此文件最後是在2013-08-18 22:05:18由kuanyui修改" | |
;;掃描~/.emacs.d目錄 | |
(add-to-list 'load-path "~/.emacs.d") | |
(add-to-list 'load-path "~/.emacs.d/lisps") | |
;;執行Shell外部程式的搜尋路徑(意同$PATH) | |
(setenv "PATH" (concat (getenv "PATH") ":/home/kuanyui/Dropbox/scripts/")) |
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 ramen-download-voice-file () | |
(if (not (file-exists-p "~/.emacs.d/ramen.ogg")) | |
(progn | |
(message "Please wait, it'll be downloading a voice file (169.6KB) to ~/.emacs.d/ramen.ogg") | |
(sleep-for 3) | |
(url-copy-file "https://dl.dropboxusercontent.com/u/1776218/ramen.ogg" "~/.emacs.d/ramen.ogg")))) | |
(let* (mins sec time-left a-flag title play-flag a-1-1 a-1-2 a-1-3 a-2-1 a-2-2 a-2-3 a-3-1 a-3-2 a-3-3) | |
(defun ask-minutes () | |
(setq mins (string-to-number (read-from-minibuffer "How many minutes?(1~10) "))) |
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
#!/bin/bash | |
cd ~ | |
mkdir -p ~/.emacs.d | |
cd ~/.emacs.d | |
git clone https://gist.github.com/6309242.git ramen | |
if [ -f ~/.emacs ] | |
then |
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 opml-to-markdown () | |
(interactive) | |
(let (output-markdown opml-copy-to trans input-file) | |
(setq output-markdown "~/Dropbox/Blog/source/blogrolls/index.md" | |
opml-copy-to "~/Dropbox/Blog/source/blogrolls/" | |
input-file (read-file-name "OPML file's location: ")) | |
(if (not (string-match "\\(\.opml\\|\.xml\\)$" input-file)) | |
(progn "It's not an OPML file." | |
(opml-to-markdown)) | |
(progn |
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 html-entities-convert (string) | |
"Replace html entities. | |
Example: | |
(html-enetities-convert \">\;\") | |
=> \">\"" | |
(map 'array (lambda (x) | |
(if (string-match (aref x 0) string) | |
(setq string (replace-regexp-in-string (aref x 0) (aref x 1) string)) | |
)) | |
[ |
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 ((url-request-method "GET") | |
(url-request-extra-headers '(("Content-Type" . "application/x-www-form-urlencoded"))) | |
output-buffer-name | |
) | |
(setq output-buffer-name (url-retrieve-synchronously "http://d.hatena.ne.jp/khiker/20111112/url_retrieve_with_timeout")) | |
(switch-to-buffer output-buffer-name) | |
(set-buffer-multibyte t) | |
(goto-char (point-min))) | |
;; Try this, a buffer will jumped out and you will find a lot of characters cannot be displayed correctly. |
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
if [ `id -u` -ne 0 ]; then | |
echo "This script must be run as root" > /dev/stderr | |
exit 1 | |
fi | |
PACKAGE_LIST_SUSE=" | |
ack | |
acpi | |
aspell | |
autoconf | |
automake |
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
;;確認後再關掉 Emacs 啦 | |
(defun save-buffers-kill-terminal-after-confirm () | |
"老是不小心關掉 Emacs,揪咪。" | |
(interactive) | |
(if (yes-or-no-p "Really quit Emacs?") | |
(save-buffers-kill-terminal) | |
"好極了!")) | |
(global-unset-key (kbd "C-x C-c")) | |
(global-set-key (kbd "C-x C-c") 'save-buffers-kill-terminal-after-confirm) |
OlderNewer