MobileOrg is cool

Recently I began to use mobileOrg to synchronize my org file with
iphone. It works great. Now I can look at my schedule and use Capture in
iphone. The Work flow like this:

For emacs to iphone,

  • Run in emacs:
M-x org-mobile-push

or C-c C-x RET p

This will push org file to a Dropbox folder which share with iphone

  • Click sync button in iphone and thus update the org-file in iphone

For iphone to emacs,

  • Add note in Iphone
  • Run in emacs:
M-x org-mobile-pull

or C-c C-x RET g

Now notes are located in, you can open it and use C-c C-w
to refile to other places.


February 8, 2012 at 4:55 am 4 comments

Ssh tunnel for security web access in insecure web connection

Use ssh tunnel is a good way to get web security in public
wireless connection. I did this experiment tonight.

Set up sshd service in my Arch

  • Allow sshd in /etc/hosts.allow, check /etc/hosts.deny
  • Choose port number other than 22 for security reason
  • Choose protocol version 2
  • add it as daemon at /etc.rc.conf
  • start it =/etc/rc.d/sshd restart

Configure client

  • For linux, simply run : ssh -D 5555 xxx@ip  -p port
  • putty setting (you can download putty here)
    At tunnel section, Add a source port,e.g.5555, select Auto and Dynamic

  • Firefox setting (you can download firefox here)
    add as socket 5. If you want DNS to be translated
    securely, in firefox, input about:config, then change to

For speed up settings, check

out and search ssh

November 20, 2010 at 3:28 am Leave a comment

Use your mouse to resize emacs widows

It’s easy to split emacs windows with binding keys, C-x 2 and C-x 3,
for horizontally and vertically, respectively. But resizing it with C-u xx C-x C-}, or C-x C-^, or C-x C-v is somewhat
cumbersome. Fortunately, mouse can do this for us.

  1. Resize horizontally: move mouse cursor to those dash line in
    mode-line, and then just drag it.

  2. Resize vertically: move mouse cursor to the area just under the
    split line, in the mode-line. When it shows double horizontal arrow,
    drag it.

  3. Split vertically: move to mode-line, and C-mouse-midle-key.

  4. close window: right click mouse on the mode-line.

Is it nicer? Enjoy it.

October 10, 2010 at 4:51 am Leave a comment

Make your emacs init file know your machine

My laptop screen is glossy, and so only light theme or default theme is
suitable, while all other machine is okay to run great dark theme. So
today I add following code into my .emacs file to do this

(when  (not (equal "archkicad\n" (shell-command-to-string "uname -n")))
  (load-file "~/.emacs.d/color-theme-blackboard.el")
  (require 'color-theme)
         (eval-after-load "color-theme"

Here archkicad is the name of my laptop, which will not use any theme.


October 10, 2010 at 4:51 am 2 comments

How to use org-mode to write blog

I begin to write blog recently, naturally I choose org-mode to do this
task. However, org-mode export to html with whole page of html tags with
head and body. While writing to blog, we only need the body part. When I
just copy the body part, I loose its format. If I copy the whole html,
blogspot general some unwanted space, title, etc and I also lost title
link. I read about html and css and realized that if I can
change the template of, add those css, I should be able to
keep the format. Read google’s own online help, and then I changed my
template, done! Only thing left is that I still need manually copy body
part. After a long search, I known that there is a variable
org-export-as-html whose fifth option can be set to body-only
(refer to discuss part in EMACS-FU ). But I known very little about
lisp. A promising setting is from

|   (setq html (org-export-region-as-html beg end t 'string))

I tried substituting the string with body-only, but it’s wrong.
Thanks to Tamas K Papp’s blog, who gives the whole solution. The only
thing I didn’t follow his solution is CSS apart for syntax highlight,
since inline-css works for me. If I choose ccs instead of inline-css,
local html will be generated without syntax hight.

So the whole step is

  1. Copy CSS part of a org-mode generated html into template of blogspot
    (Only part 1 of CSS mentioned in Tamas K Papp’s blog). The first
    line should be removed, since it cause some problem, especially when
    I use them in, it cause <pre> part not overflow
    (scroll bar not shown when space is not enough), i.e.

    html { font-family: Times, serif; font-size: 12pt; }

    The location
    is to add CSS is

     * Varaible definitions apart
      CSS you added
      original CSS setting
  2. add following line into .emacs file

    (defun org-export-body-as-html ()
    (org-export-as-html 3 nil nil "blog" t))
    (add-hook 'org-mode-hook
           (lambda ()
             (local-set-key (quote [?\C-c ?\C-x]) 'org-export-body-as-html)))
  3. Use C-c C-x to generate body part of the blog
  4. Use scribefire to update blog and preview the results. I feel this is
    more convenient than webloger.el. Since webloger.el cannot update
    title and set label, I have to manually change it every time if I use
    this. Need use new version scribefire, old version have bugs, when
    encounter `<‘ and `>’ inside <pre> tags, it convert them into `&lt’,
    and ‘&gt’ respectively. While <pre> tags may have other tags inside
    them, especial for color setting <span>.

  5. If use blogspot to update blog, in post option part, choose Use br tags. Otherwise, unwanted line breaks will be added.

October 10, 2010 at 4:51 am Leave a comment

Hello world!

Welcome to This is your first post. Edit or delete it and start blogging!

October 9, 2010 at 2:44 am 1 comment

Org-babel is great!

I just installed org-mode 7.01h and tried babel. It’s great. Now you can
put different programs and their results with document together. Here are some examples.


require 'date'
"This file was last evaluated on #{}"
This file was last evaluated on 2010-10-10


example 1

 2.00000000e+00 4.00000000e+00 6.00000000e+00 8.00000000e+00 1.00000000e+01 1.20000000e+01 1.40000000e+01 1.60000000e+01 1.80000000e+01 2.00000000e+01

example 2

A=[1 2];
B=[2 3]';



October 8, 2010 at 9:58 pm 1 comment

Recent Posts


Blog Stats

  • 1,301 hits