# My Emacs Setting on Servers

My desktop emacs config is complecated, however I need a minimal config for emacs installed on ubuntu servers. This is my note of how to configure emacs on servers that works for me.

# Minimal NodeJS Router

Here comes the problem, you’re prototyping a website that has powerful front-end like EmberJS or AngularJS, and sync JSON data with your NodeJS back-end, but you want your nodejs code to be lite and clean.

You can use some nodeJS framework like restify, expressJS, director or whatever, but is there a way to write a minimal router using regex and switch statements? Yes.

# Writing Java Programs on a Remote Server

Recently I started to work on hadoop and big data processing, but I was frustrated on eclipse and the development environment. We run hadoop on a remote cluster, but develop map-reduce programs on laptop. The development cycle was pretty slow because we need to upload the jar for every release. Another thing is Eclipse is too inefficient for a Vim and Emacs hacker like me. Thankfully I’m not the only one who think this way; Eric Van Dewoestine developed Eclim which can let you work on java programs on headless eclipse and vim/emacs! Here comes the installation steps:

# Laziness and Memoization in Clojure

I’m now having a job at supplyframe Inc., and luckily I can use Clojure for work! Clojure is a young language created by Rich Hickey on 2007. It uses Lisp syntax, immutable data structures by default, and supports both strict and lazy evaluations. As Christ Okasaki suggested:

Strict evaluation is useful in implementing worst-case data structures and lazy evaluation is useful in implementing amortized data structures.

It’s really cheap to define lazy or strict data structures in Clojure that has low amortized cost even in a persistent manner. Let’s dig into the source code and see how does Clojure implement it.

# Install Graphite on OSX

Installing graphite on OSX is a pain. This post is a quick note that I would never want to go through again. If you are looking this post, I’d suggest you to install graphite on linux.

Most installation steps are from this gist.

# Popular Clojure Projects

When I want to learn a new programming language, the best way is always learn from the best projects in that ecosystem. I grabbed several popular repositories that has high ratings on Github.

# LibSVM on Mac OSX

Here are the basic steps to install libSVM on Mac OSX.

Installing libsvm itself in system path is easy, however hombrew does not include demo-data, python/java integration, or other goodies. The finally installation in homebrew only consists these files:

In this post, I’ll show you how to modify some Makefiles and create mac specific binaries.

# Emacs and PDF

Emacs has a built-in pdf viewer named doc-view-mode. It require ghostscript to convert the pdf files. On my OSX 10.8 laptop, I use ghostscript 9.07 (2013-02-14) version, installed by

### Usage and configs

Using docview is pretty simple, just use your emacs to open the file and it’s done. I added two keyboard macro to help me navigate the PDF.

The keybindings is only for two windows layout. You can use M-[ or M-] to navigate the pages while your cursor is in another window. So that you can write your notes and navigate without leaving your notes! Pretty neat, right?

# Emacs W3m

This year I switched from vim to emacs. The reason is quite simple, I want to try different things, that’s all. Emacs is a highly configurable editor that you can use it to read emails, chat on irc, read pdf files, or whatever you can imagine. One of the most useful plugin is using emacs-w3m to browse websites.