One liner to load m3u into mpd

mpc clear;ln -s ~/Music/all.m3u ~/.mpd/playlists/all.m3u;mpc load all;mpc update;mpc shuffle;mpc play;

Toggle full view of window in Emacs

Add below code into your ~/.emacs:


(defun toggle-full-window()
  "Toggle the full view of selected window"
  (interactive)
  ;; @see http://www.gnu.org/software/emacs/manual/html_node/elisp/Splitting-Windows.html
  (if (window-parent)
      (delete-other-windows)
    (winner-undo)
    ))

I use evil, so I assign hot key ",ff" to toggle-full-window.

The minimum packages to install for front end development on Linux

sudo apt-get install ack git emacs24-nox feh i3 xsel ctags vim scrot xbindkeys dunst unclutter parcellite gimp

Use Gnus to apply patch sent by `git send-email`

Send the latest commit


# send one commit

git send-email -1 --annotate

Apply patch

Select that email, run command "M-x gnus-summary-save-article-email" whose short key is "O m" in summary buffer.

Emacs will prompt you where to save that email. Say I save it in ~/News/patch/hello.patch.


git am ~/News/patch/hello.patch

Syntax highlight of patch email

See fgeller's plugin.

Add following code to configure his plugin:


(require 'gnus-article-treat-patch)

(setq gnus-article-patch-conditions
      '( "^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@" ))

香菇生滚牛肉窝蛋粥做法

  • 菜谱
  • 香菇先用冷水冲洗,然后25度温水浸泡至少1小时,浸泡后的水也要放到粥里
  • 小火1到1.5小时后粥基本烂了,不断搅拌粥
  • 牛肉最后开大火加入过一下,可能是为了避免把牛肉烧老
  • 蛋是用粥捂熟的,据说很经典的技巧,就是要蛋白和粥混在一起,但是蛋黄半熟还是完整的
  • 如果粥觉得不够味可以加盐和鲜露(家乐牌鲜露)

http://blog.binchen.org/wp-content/uploads/2013/08/wpid-beef-porridge.jpg

Use org2blog to share blog efficiently

org2blog to share blog efficiently :en:emacs:blog:wordpress:org2blog:

org2blog will post items in org-mode into wordpress blog.

It's the best blog writer in the world.

My only issue that I need share the blog url to social network sites after publishing.

Here is my solution to automatically copy post url into clipboard after publishing:

(defun my-org2blog-post-subtree ()
  (interactive)
  ;; go to the top node which is a blog item
  ;;(outline-up-heading)

  ;; post and publish
  (org2blog/wp-post-subtree t)
  (let* ((postid (or (org-entry-get (point) "POSTID")
                     (org-entry-get (point) "POST_ID")))
         (url org2blog/wp-server-xmlrpc-url))
    (if (not postid)
        (message "This subtree hasn't been posted, yet.")
      (setq url (substring url 0 -10))
      (setq url (concat url "?p=" postid ))
      (kill-new url)
      (with-temp-buffer
        (insert url)
        (shell-command-on-region (point-min) (point-max)
                                 (cond
                                  ((eq system-type 'cygwin) "putclip")
                                  ((eq system-type 'darwin) "pbcopy")
                                  (t "xsel -ib"))))
      (message (concat url " => clipboard")))))

BTW, please use some clipboard manager to synchronize the X clipboards.

Install gitso v0.6 on Gentoo Linux

Gitso is a frontend to reverse VNC connections. Say you want to access your office pc which is behind firewall. Then you need Gitso.

Here is the commands to install gitso:


sudo mkdir /usr/portage/net-misc/gitso

sudo bash -c "curl -L https://github.com/longlene/clx/raw/master/net-misc/gitso/gitso-0.6.ebuild > /usr/portage/net-misc/gitso/gitso-0.6.ebuild"

sudo bash -c "curl -L https://github.com/longlene/clx/raw/master/net-misc/gitso/Manifest|sed -e '/gitso[-_]0.5/d' > /usr/portage/net-misc/gitso/Manifest"

sudo emerge wxpython iproute2 x11vnc tightvnc

sudo ebuild /usr/portage/net-misc/gitso/gitso-0.6.ebuild unpack compile install qmerge clean

There are many howtos on gitso on internet. Google it.

韩国大酱汤做法

  • 买酱,见下图

http://blog.binchen.org/wp-content/uploads/2013/08/wpid-korean-soup-sauce.jpg

  • 倒入白菜,菇,韩国豆芽等等,加冷水,煮开
  • 倒入酱,加糖盐调味

http://blog.binchen.org/wp-content/uploads/2013/08/wpid-korean-soup.jpg

How to use expand-region.el in Emacs efficiently

expand-region.el is very useful. I use it to select a code segment and keep press its expand key until the selected region expand to the desired region.

The only issue is its recommended hotkey for "er/expand-region" is "C-=". A little bit hard to press.

After marking a region by pressing "C-=", I press "=" to expand the region and "-" to contract.

As you may have noticed, I need move the right hand to press "=" or "-" so it's not quick enough.

The solution is simple, press ",xx" to select the initial region. Keep press "x" to expand. "z" to contract region because "x" "z" is close to left hand fingers.

evil-mode and evil-leader is required to implement this.

Here is the setup:

(require 'evil)
(require 'evil-leader)
(evil-mode 1) ;; enable evil-mode

(eval-after-load "evil" '(setq expand-region-contract-fast-key "z"))
(evil-leader/set-key "xx" 'er/expand-region)

How to use expand-region.el in Emacs efficiently

to use expand-region.el in Emacs efficiently :emacs:expand:region:en:

expand-region.el is very useful. I use it to select a code segment and keep press its expand key until the the desired region is selected.

The only issue is its recommended hotkey for "er/expand-region" is "C-=". A little bit hard to press.

After marking a region by pressing "C-", I press "" to expand the region and "-" to contract.

As you may have noticed, I need move the right hand to press "=" or "-" so it's not quick enough.

The solution is simple, press ",xx" to select the initial region. Keep press "x" to expand. "z" to contract region because "x" "z" is close to left hand fingers.

evil-mode and evil-leader is required to implement this.

Here is the setup:

(require 'evil)
(require 'evil-leader)
(evil-mode 1) ;; enable evil-mode

(eval-after-load "evil" '(setq expand-region-contract-fast-key "z"))
(evil-leader/set-key "xx" 'er/expand-region)