# Using unison to sync dokuwiki data via SSH

I like the simple interface of dokuwiki very much. Another point that gets me excited about dokuwiki is that it uses text files for its database rather than MySQL. This means I can easily backup by compressing the whole folder contains dokuwiki, copy it to somewhere else and I'm done. Moreover, the convenience of text file data is that I can effectively use git for version control - which is great. I can do whatever I want to the content of my homepage while offline and upload it when I'm online.

So I was trying to adopt dokuwiki to my homepage and decided to move the "About" and "Projects" pages to dokuwiki. I love editing text with my beloved Sublime Text 3 (which I have purchased recently). I then realized it's kind of cumbersome to upload those text files via FTP. I would like to have the capability of synchronization bi-direction from my home machine to my web server via SSH. At first I tried rsync but it doesn't work the way I want because it's unidirectional sync (or maybe I did it wrongly?). Then I remember unison - the program I use to sync my personal data. The problem with unison is that it needs the remote server to have unison program too. But I don't have root permission to install unison on my host server. So what I did was downloading a precompiled version of unison here (note that my web server is running 64 bit Linux) and upload it to /home/myusername/bin/unison
On the other hand, unison v.2.40 is running on my home machine Linux Mint 14. Since I already created the SSH key for my web server, I can just effectively use 1 command to synchronize the local dokuwiki data to my remote web server like so:

unison -ui text -sshargs "-i ~/.ssh/everbot.ssh -p xxxxx" /localDir/dokuwiki/ ssh://myusername@everbot.com//home/myusername/pathToDokuwiki/pages/ -servercmd /home/myusername/bin/unison -perms 0



Pretty neat isn't it!

Feel free to share your experience on how to use dokuwiki effectively by commenting below.

# Loveless - Read by Genesis

LOVELESS (Crisis Core)

Prologue (Poem)
When the war of the beasts brings about the world's end
The goddess descends from the sky
Wings of light and dark spread afar
She guides us to bliss, her gift everlasting

Prologue (Interpreted)
When the war of the beasts brings about the world's end
The goddess descends from the sky

Wings of light and dark spread afar
She guides us to bliss, her gift everlasting

Act I (Poem)
Infinite in mystery is the gift of the Goddess
We seek it thus, and take it to the sky
Ripples form on the water's surface
The wandering soul knows no rest.

Act I (Interpreted)
The infinite mystery
The gift of the goddess is what the three men seek
But their fates are scattered by war

One becomes a hero, one wanders the land
And the last is taken prisoner

But the three are still bound by a solemn oath
To seek the answer together, once again

Act II (Poem)
There is no hate, only joy
For you are beloved by the goddess
Hero of the dawn, Healer of worlds

Dreams of the morrow hath the shattered soul
Pride is lost
Wings stripped away, the end is nigh

Act II (Interpreted)
Though the prisoner escapes, he is gravely wounded
His life is saved, however
By a woman of the opposing nation

He begins a life of seclusion with her
Which seems to hold the promise of eternal bliss

But as happiness grows, so does guilt
Of not fulfilling the oath to his friends

Act III (Poem)
My friend, do you fly away now?
To a world that abhors you and I?
All that awaits you is a somber morrow
No matter where the winds may blow

Is the bringer of life, the gift of the goddess

Even if the morrow is barren of promises
Nothing shall forestall my return

Act III (Interpreted)
As the war sends the world hurtling towards destruction
The prisoner departs with his newfound love
And embarks on a new journey

He is guided by hope that the gift will bring bliss
And the oath that he swore to his friends

Though no oath is shared between the lovers
In their hearts they know they will meet again

Act IV (Poem)
My friend, the fates are cruel
There are no dreams, no honor remains
The arrow has left the bow of the goddess

My soul, corrupted by vengeance
Hath endured torment, to find the end of the journey
In my own salvation

Legend shall speak
Of sacrifice at world's end
The wind sails over the water's surface
Quietly, but surely

Act V (Poem)
Even if the morrow is barren of promises
Nothing shall forestall my return
To become the dew that quenches the land
To spare the sands, the seas, the skies
I offer thee this silent sacrifice

Credit: http://finalfantasy.wikia.com/wiki/LOVELESS

# Raspberry Pi - my new toy has arrived

After 10 days ordered from RS Components, my Raspberry Pi has finally arrived from UK. The package come with the Raspberry Pi type B and a clear case for total S\$63, which is a good deal for a cheap computer :)

The board fits nicely into the clear module plastic case.

Ok, so here are the steps that I used to set up my Raspberry Pi:
- Prepare an decent SD card (minimum 2GB). I'm using a 4GB class 4 SD card (the faster SD card the better)
- Format the SD card to ext4 (using GParted)
- Copy the Raspbian "wheezy" image to the SD card using dd command
+ Take note: be very careful using dd command. If you issue the wrong device name, you may destroy data on that device. So make sure you know the device name of the SD card before proceeding. Using lsblk command, I'm able to know that my USB thumbdrive is sdc

+ sudo dd if=2012-12-16-wheezy-raspbian.img of=/dev/sdc bs=1M
+ Take note the dd command above, I want to copy to sdc instead of sdc1
+ The dd command will take awhile, so sit back and relax :)

- Plugin HDMI cable, USB keyboard and mouse
- Plugin micro USB power cable and the Raspberry Pi will boot into Raspbian "wheezy"
- If you don't have a dedicated monitor for the Pi, it's useful to enalbe SSH server so that you can remote control the Pi without using screen for it. Use command sudo raspi-config to enable ssh server on Raspberry Pi

- After that you can just ssh to the Pi effectively

- Happy hacking!

# Adelaide - South Australia 2013

Bonython Hall The University of Adelaide

South Australian Museum

South Australian Museum

# Sublime Text 2 and Scheme

I've been using Emacs for a few months. I'm very excited in its great capability of being extensible and customizable. I decided to invest time on it and spend a few good whole weekends just to learn and to get familiar with the VIM's key binding via Viper mode. Another interesting point is that I can use it to learn and practice my Scheme's skill by configuring .emacs file using elisp.

However I'm still having the feeling that I'm missing something to really get me excited and inspire me to write/view code. I happened to come across Sublime Text 2. And all I can say is: this is a truly awesome text editor. I configure it successfully to make it run portably across my home Linux machine and Windows (at work). Its plugins can be written in Python - which is a great point - since after Scheme, Python is the next language that I want to learn.

Being fascinated by Sublime, putting my fingers on keyboard is one of the most enjoyable moments of my day. I don't think I will ever go back to Emacs (unless there is serious thing happens to Sublime - this is a real threat since Sublime is not an open source project). I've been using Sublime for 1 week and will definitely consider to buy it to support the developer. There are numerous plugins available via Package Control that you should take a look here http://wbond.net/sublime_packages/community

I've found a plugin named SublimeREPL to run Scheme interpreter inside Sublime. As you can see in the below picture, my Scheme script ran nicely inside Sublime:

Scheme in Sublime

But there is a small problem in the REPL screen, some control commands are not working (such as Ctrl+c to interrupt , ..). To make up for this, SublimeREPL provides a context menu when you right click on the screen:

By choosing Send other SIGNAL , a popup will appear and you can choose to send various control commands to REPL, for example: SIGINT, ...

SublimeREPL_send_other_signal

So it would be nice to have a shortcut key to bring up the above pop-up. As I'm not familiar with Python and json, I don't know why my key binding in Package Settings -> SublimeREPL -> Settings - User is not working. So what I do is to modify directly on the file Default (Linux).sublime-keymap:

{ "keys": ["ctrl+l"], "command": "subprocess_repl_send_signal",
"context":
[
{ "key": "setting.repl", "operator": "equal", "operand": true }
]
},


Done, I just need to press Ctrl + l to bring up the pop-up thing :)

If you have any suggestion on using Sublime effectively, feel free to comment :)