Hi, I‘m Martin. You should follow me: @martinklepsch

July 2014 Emacs & Vim

After using Vim for more than four years my recent contacts with Lisp encouraged me to take another look at Emacs. I used to make jokes about Emacs just as Emacs users about Vim but actually it seems to be a pretty decent piece of software.

Being a Vim user in the Clojure community sometimes feels weird. You are happy with Vim. Running Clojure code with right from the editor works well these days. Still you wonder why all those people you consider smart seem to be so committed to Emacs. So I decided to try it once again.

Keybindings

Let’s start with a slight rant: I completely do not understand how anyone can use Emacs’ default keybindings. Being a Vim user I obviously have a thing for mode-based editing but Emacs’ keybindings are beyond my understanding. Some simple movement commands to illustrate this:

Command Emacs Vim
Move cursor down one line Ctrl-n j
Move cursor up one line Ctrl-p k
Move cursor left one character Ctrl-b h
Move cursor right one character Ctrl-f l

These are the commands recommended in the Emacs tutorial (which you open with Ctrl-h t). They are mnemonic, what makes them easy to learn–but is that really the most important factor to consider for commands you will use hundreds of times a day? I don’t think so. I tried to convince myself that it might be worth to get used to Emacs’ default keybindings but after some time I gave up and installed evil-mode.

Mode-based Editing with Evil Mode

In my memory evil-mode sucked. I was delightfully surprised that it doesn’t (anymore?). Evil brings well-done mode based editing to Emacs. As you continue to evolve your Emacs configuration you will most likely install additional packages that bring weird Emacs-style keybindings with them. Since you now have a mode-based editor you can use shorter, easier to remember keybindings to call functions provided by these packages. A useful helper that fits a sweet spot in my Vim-brain is evil-leader which allows you to setup <leader> based keybindings, just like you can do it in Vim:

(evil-leader/set-leader ",")
(evil-leader/set-key
  "," 'projectile-find-file)

With this I can open a small panel that finds files in my project in a fuzzy way (think Ctrl-p for Vim) hitting , two times instead of Ctrl-c p f.

Batteries Included

What I really enjoyed with Emacs was the fact that a package manager comes right with it. After adding a community maintained package repository to your configuration you have access to some 2000 packages covering Git integration, syntax and spell checking, interactive execution of Clojure code and more. This has been added in a the last major update (v24) after being a community project for some years.

Conclusion

Vim’s lack of support for async execution of code has always bugged me and although there are some projects to change this I can’t see it being properly fixed at least until NeoVim becomes the go-to Vim implementation. Emacs allows me to kick off commands and do other things until they return. In addition to that it nicely embeds Vim’s most notable idea, mode-based editing, very well, allowing me to productively edit text while having a solid base to extend and to interactively write programs.

If you are interested in seeing how all that comes together in my Emacs configuration you can find it on Github.


March 2014 Heroku-like Deployment With Dokku And DigitalOcean

Over the weekend I sat down to play around with Docker/Dokku and was able to set up a small machine on DigitalOcean that basically offers Heroku-like deployment. It was surprisingly simple so here is some rough outline that should get you going.

Create a Droplet at Digitalocean

Go to DigitalOcean and create a droplet (note the comments below the screenshots):

Make sure the hostname is a fully qualified domain name, as it will be the git remote you'll push to to deploy.
When selecting the image, go to Applications and select the Dokku one.

There are some unresolved problems with Dokku on Ubuntu 13+ so if you are not just playing around you might want to setup Dokku manually. After that you’re ready to hit the create button and a droplet will be created within the next minute. The last bit of server-setup that’s required is Dokku’s.

Setting up Dokku

To get to Dokku’s setup screen just steer your browser to the IP shown in the droplet’s detail view:

What you’ll see next is Dokku’s setup screen:

Add an SSH key, tick the virtualhost checkbox, and make sure the hostname is correct.

DNS Setup

To get the hostname you chose earlier actually point to your machine running Dokku you need to add two A records to the zonefile of your domain. This strongly varies between domain/DNS providers so I can’t exactly say how it’d be done for yours. Whats important is that your provider supports wildcard entries. Also the value of an A record should be only the subdomain part of the hostname you set earlier, not the complete domain.

A       <subdomain-of-hostname>      <droplet-ip>
A       *.<subdomain-of-hostname>    <droplet-ip>

# in a zonefile it’d look like this:
*.apps 10800 IN A 107.170.35.171
apps 10800 IN A 107.170.35.171

Deploying

After you’ve waited three hours for DNS servers to propagate the changes you should be able to do something like the following:

git clone git@github.com:heroku/node-js-sample.git
cd node-js-sample
git remote add digital-ocean dokku@apps.example.com:nodeapp
git push digital-ocean master

Now going to nodeapp.<dokku-hostname> should bring up “Hello World” from the app we just cloned and pushed.

If you want to add have a custom domain point to your app you’ll need to either push to a remote like dokku@apps.example.com:example.com or edit the nginx.conf that comes with Dokku’s nginx plugin.

Thanks to Dokku’s Buildstep that utilizes Heroku’s opensource buildpacks you can now deploy almost every application you can deploy to Heroku to Dokku as well.

Have fun!


February 2014 Woodworking Masterclasses

Back when I lived at home my dad used to make fun of my mechanical skills. He said if everyone just sits in front of computers the whole day no one will know how to drill a hole at some point. He would like what follows.

Woodworking Masterclasses is an online course to woodworking. It’s the first time that I’ve seen such high quality material about learning a craft. They offer a simple monthly subscription to their courses with a new video being released every week. The videos are top-notch. Kind of like you would expect it by a company like Treehouse but not by people who do woodworking and are probably not too familiar with cutting videos and this type of stuff. Take a look:

Clock Episode 1 from woodworking on Vimeo.

I like how the internet supports the ongoing evolvement of crafts and woodworking has always fascinated me. These videos make me want to be at a farm with a huge workbench.


February 2014 Early Adopters And Inverted Social Proof

Hirschman credits the stability of early America with the fact that discontents could simply travel west until they felt sufficiently freed from its rules and restrictions. […]
There’s no limit on the number of possible subreddits, stack exchange sites, or wikipedia pages that can be made, so a user can always keep traveling west until they find something that’s worth sticking around to defend.

A great analysis of why people are early adopters and how the constantly changing face of a community can affect their loyality to a product. One of those timeless reads you should probably re-read every now and then.


February 2014 Living Small

Living in a world where consumerism appears to be the predominant behaviour it seems more and more exciting to me to live a less materialistic lifestyle. What follows are some of the things that stimulated my thinking — maybe they do the same for you.

After stumbling upon Bruce Hauman’s blog while trying to figure out some Clojure stuff I discovered another post on his blog where he talks about building a geodesic dome in which he’s now (partly?) living for 3.5 years. It’s an amazingly analytical post about building something and simplifying it to it’s purest, most functional form. Motivated by spending less money on rent he iterated on his idea resulting in this construction:

In case you were wondering what this “geodesic dome” thing looks like

In his post he also mentions the Tiny Housing Movement through which I found a TED talk that nicely illustrates the pitfalls of the idea of living “a good life” once you have your own income. The key line in the talk is: What does freedom mean to you? I wanted to give a small summary here but, as it is with TED talks, the talk itself does it’s job pretty well.

I believe as thoughtful members of our society we should rethink our relationship to stuff. How can we, as a society, make better use of the things we have at our disposal? What do I really need to own to live my life? Ideas like the share economy seem like a logical step with the increasing ease of sharing/routing information.

Purposely living with less is obviously not a new idea and so it happens to be part of things like the 100 Things Challenge. Coming across the 100 Things Challenge again and again I want to try it myself. In February I’m going to create an inventory of the things I own. Let’s see if the number of things I own is going to be above or below 100.

Stuff has gotten a lot cheaper, but our attitudes toward it haven’t changed correspondingly. We overvalue stuff. Stuff by Paul Graham

Think about it.


« 1 2 3 4 5 6 »