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 flagged.org, you can open it and use C-c C-w
to refile to other places.
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 127.0.0.1:5555 as socket 5. If you want DNS to be translated
securely, in firefox, input about:config, then change to
network.proxy.socksremotedns=true
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.
- Resize horizontally: move mouse cursor to those dash line in
mode-line, and then just drag it. - 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. - Split vertically: move to mode-line, and C-mouse-midle-key.
- close window: right click mouse on the mode-line.
Is it nicer? Enjoy it.
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
automatically.
(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" '(progn (color-theme-initialize) (color-theme-blackboard))) )
Here archkicad is the name of my laptop, which will not use any theme.
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 w3schools.com about html and css and realized that if I can
change the template of blogstpot.com, 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 http://comments.gmane.org/gmane.emacs.orgmode/18069
,---- | (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
- 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 wordpress.com, it cause<pre>
part notoverflow
(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<b:skin> .... * Varaible definitions apart CSS you added original CSS setting .... </b:skin>
- add following line into
.emacs
file(defun org-export-body-as-html () (interactive) (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)))
- Use C-c C-x to generate body part of the blog
- 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 `<’,
and ‘>’ respectively. While <pre> tags may have other tags inside
them, especial for color setting <span>. - If use blogspot to update blog, in
post option
part, chooseUse br tags
. Otherwise, unwanted line breaks will be added.
Hello world!
Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!
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.
ruby
require 'date' "This file was last evaluated on #{Date.today}"
This file was last evaluated on 2010-10-10
octave
example 1
n=[1:10];
x=2*n;
ans=x
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]';
C=A*B;
ans=C
8.00000000e+00
p
8.00000000e+00