Thomas Skardal

Hello, computer.

Use local changes in go libraries by using replace in go.mod

July 12, 2021

Every now and then I have to search my way back to this blogpost to figure out how to test changes in library code without publishing a new version of it.

Add this manually to go.mod

replace<user>/<project> => /Users/<your-user>/path/to/local/codebase

or run go mod edit -replace like this:

go mod edit -replace<user>/<project>=/Users/<your-user>/path/to/local/codebase

I’ll just leave the link here for future reference:

Find memory errors by using the address sanitizer

May 3, 2018

The address sanitizer (ASAN) is a runtime memory error detector. You compile your code with the sanitizer enabled and run it like normally. If ASAN detects a memory error it will report it to you immediately and then exit. I first got aware of this nice tool when hunting a “use after delete” and asking for help on the CppSlack. I don’t remember the wording exactly, but it was something like “you could try running it with ASAN”. I had no idea what it meant and did some searching.

You should look up the documentation on how to use it, but here’s a simple example:

#include <iostream>
#include <string>
#include <vector>

struct Message {
  std::string content;

Message* fetchMessage() {
  Message* m = new Message;
  m->content = "Hello world!";
  delete m;
  return m;

int main() {
  auto msg = fetchMessage();
  std::cout << "Content: " << msg->content;
  return 0;

This is just a silly example of using something that has been deleted. But running this code through clang with ASAN leaves no doubt about where the error resides.

# compile it with sanitizer
❯ clang++ -fsanitize=address -fno-omit-frame-pointer -g -O1 sanitize_this.cpp
# run it and get ASAN report (I've omitted most of it')
❯ ./a.out 
==6887==ERROR: AddressSanitizer: heap-use-after-free on address 0x603000000010 at pc 0x000000517910 bp 0x7ffc4dc057f0 sp 0x7ffc4dc057e8
READ of size 8 at 0x603000000010 thread T0
    #3 0x51790f in main /home/thomas/Code/cpp/2018-05-silly-sunday/sanitize_this.cpp:18
freed by thread T0 here:
    #1 0x51788f in fetchMessage() /home/thomas/Code/cpp/2018-05-silly-sunday/sanitize_this.cpp:12:3
previously allocated by thread T0 here:
    #1 0x5177f7 in fetchMessage() /home/thomas/Code/cpp/2018-05-silly-sunday/sanitize_this.cpp:10:16

Even though -fsanitize=address is the only necessary flag, the other flags make the stacktrace much more interesting. If you use Qt and QMAKE you enable it by adding to CONFIG: CONFIG += sanitizer sanitize_address.

Not surprisingly, running your code with ASAN has a performance penalty, so you don’t want this for your production build. Use it while developing/testing and/or as part of CI. It is also worth noting that both g++ and clang provides ASAN support. If your stacktrace looks weird you probably need to tell the compiler where the symbolizer is located. Do some searching and you’ll figure it out.

Take a look at this video for a nice demonstration:

Blogging with Hugo

February 11, 2017

So, I decided to throw out Jekyll and give Hugo a try. The main reason for this is that I got tired of fighting Ruby, RubyGems and all that every time (once a year) I wanted to do something with this blog. Hugo is just an independent executable which makes it way easier to use.

Although there are quite a few nice templates for Hugo, I didn’t find one that I wanted to use. There was always something missing. Even though I’m sure I would have managed to figure out how to change the theme I’ve chosen to write my own theme in order to learn how it works. I probably won’t end up very stylish, but that doesn’t matter. All I need for now is syntax highlighting and some basic blog functionality.

I hope to tweak and enhance as time fly by. Still, the style doesn’t matter if there’s no content.

Let's encrypt!

January 21, 2016

If you pay attention to privacy and security news you’ve probably heard of and maybe even used Let’s Encrypt. If not, this is your lucky day!

This is their own description:

Let’s Encrypt is a new Certificate Authority: It’s free, automated, and open.

What does that mean? Well, from now on everyone gets easy and access to certificates that they can use to serve over HTTPS. No more need to buy expensive certificates or sign them yourself (which means a non-trusted cert).

The setup is completely automatic and requires no registration. All you have to do is clone their GitHub repository and run the letsencrypt-auto script. This script will analyze your configure web sites, obtain certificates and configure them to use these certificates.

It is also worth mentioning that your site/service now will be getting an “A rating” at SSL Labs!

Simplified value objects in Java

January 16, 2016

If you’ve ever taken a step out of your Java code you know that defining so called POJOs are quite cumbersome. Let’s say you’re defining a Item class. The item has a name and an optional description. You add the private variables, and it’s time for getters and setters. Also, you need a constructor. You should probably override a equals, hashCode and toString as well. Oh, and wait. The class should be immutable as well, so remove the setters again and make the fields final. Is it lunch time yet? :unamused:

There have been alternatives to this around for quite a while. Project Lombok is one and Immutables is another. I’ve tried out Lombok in a couple of side projects, so I wanted to take a look at Immutables. I don’t have an overview of all its features, but the essential feature is that you annotate an interface or an abstract class with @Immutable.Value and get a generated immutable class containing equals, hashcode and toString in addition to a builder that takes care of constructing valid objects.

public interface Person {
    String name();
    Optional<String> description();

The definition above generates a builder that handles creation, copying, equality and everything you need for a Person type. If you need custom methods on your type you could define it as an abstract class instead. A lot less boilerplate, no doubt! If you can’t use a immutable value, you could check out Value.Modifiable which gives you a similar experience for more familiar JavaBean style classes.

Here’s some example usage of the above type definition:

Person p1 = ImmutablePerson.builder()
		.description("A test person")
Person p2 = ImmutablePerson.builder()
		.description("A test person")
Person p3 = ImmutablePerson.copyOf(p1).withName("Other");
System.out.println(p1.equals(p2)); // => true
System.out.println(; // => Test
System.out.println(; // => Other

I wanted to use gradle to build the example code. Immutables is based on annotation processing. Even though this is supported by javac IDEs need some configuration in order for it to pick up the generated code. I’ve used the [gradle apt plugin] to help me with this. With this build script I can run gradle eclipse and the APT-stuff is ready to use! :smiley:

plugins {
  id 'java'
  id 'eclipse'
  id "net.ltgt.apt" version "0.5"

sourceCompatibility = 1.8
version = 1.0

repositories {

dependencies {
    compile 'org.immutables:value:2.1.7'
    apt 'org.immutables:value:2.1.7'

For the record; this is how it would look like in Scala:

case class Item(name: String, description: Option[String] = None)

Fedora 23 installation report

January 14, 2016

I’ve been thinking about installing some flavour of linux on my macbook for a while. After Ubuntu added features that many see as privacy concerns I’ve mostly been using other distros. Up until now I’ve been a Debian and Arch user, but after reading about Fedora I got interested in giving it a try. Here are some of the stuff I learned.

My biggest concern for this installation was to mess up something so that I couldn’t boot OS X (this laptop is my work computer). I read a lot about EFI boot and rEFInd, and ended up without rEFInd. After the installation the computer will start GRUB. It is possible to boot OS X from there, but it doesn’t work out of the box and I haven’t managed to fix it. The workaround is easy though. Just hold alt when booting, and you can chose which EFI partition to boot.

My first try was at the KDE spin (spins are Fedora with different default desktop environments). It crashed a lot and HiDPI support was far from decent. After a while I got tired of it and installed the cinnamon desktop. The HiDPI support is way better, but after a while, all the KDE applications started to annoy me. I decided to go for the standard version of Fedora with Gnome.

This time everything looks good and promising from the start! Even the installation procedure was nice and scaled for my retina screen :-) For the KDE spin it was quite challenging to read the tiny text. The only problem (present for all spins) is wifi. It works fine while installing, but as soon as you boot you’re without wifi. If you have a thunderbolt adapter for ethernet you’re covered. If not, you can use a computer with internet access to download and extract the necessary firmware files. Transfer them to a USB drive and put them on your mac. After a reboot it should be working. More about this here.

Even though this driver (b43) worked kind of fine I ended up installing broadcom-wl. The reason for this is simple. The b43 driver caused some kind of screen flickering whenever there was any significant network activity.

It is also worth noting that if the wirless device suddenly stops working it can most likely be revived by either doing a suspend/resume or manually reloading the kernel module (modprobe -r wl && modprobe wl).

I like having my F1-F12 keys behaving like F-keys instead of media and function keys. I rather press the fn key whenever I need them. After some searching, trial and error I got it working as preferred. Take a look at these two guides.

When it comes to display drivers I tried using the proprietary NVIDIA drivers, but I ended up removing them. With the NVIDIA drivers screen backlight adjustment stopped working, and suspend on lid close also stopped working. Even though I managed to get the backlight working again I decided to go back to Nouveau. This model of MBP has a hybrid GPU solution consisting of both an Intel and a NVIDIA GPU. Unfortunately the NVIDIA GPU is used by default and drains a lot of battery. There are some ways to switch between the two such as Bumblebee but I can’t manage to get it working on this model. I’ve only found others with the same experience. So for now I’m leaving this alone.

When it comes to battery time I haven’t done any serious measuring, but it is definitly worse than with OS X. I haven’t done much research on this, but installing tlp and tlp-wrd seems like a good start. I’m sure that switching between Intel and NVIDIA would have made a huge impact though.

If you haven’t figured out already; Fedora is quite strict when it comes to include packages in their official repositories. Anything with patent issues or that isn’t free are not allowed. If you want to install packages such as VLC, various kinds of codecs (mp3 maybe?), or maybe the broadcom-wl drivers already mentioned, you will have to use the RPMFusion[] repos.

A final suggestion is to enable swipe gestures in firefox so that you can navigate back and forth in your browsing history by swiping left and right. Just like you’re used too :smiley:

Long time, no see. Here's some Clojure!

June 22, 2015

Recently I got inspired by this blog post (it’s in norwegian, but I’m sure you can find a way to translate it) which solves the bowling kata in Haskell. The goal is to implement a function that gives you a score for a series of rolls in a bowling game.

This blog post mentions other posts as well, and all of the solutions are worth a read.

So, back to me. I wanted to give it a try in Clojure, and here’s the result!

(ns kata-bowling.bowling)

(defn- last-frame? [x y z]
  (some nil? [x y z]))

(defn- spare? [x y]
  (= (+ x y) 10))

(defn- strike? [x]
  (= x 10))

(defn score [[x y z & rolls]]  
    (last-frame? x y z) (+ (take-while some? [x y z]))
    (spare? x y) (+ 10 z (score (cons z rolls)))
    (strike? x) (+ 10 y z (if (empty? rolls) 0 (score (concat [y z] rolls))))
    :else (+ x y (score (cons z rolls)))))

I’ve implemented this as a recursive function. Not tail recursive, just plain old recursive. I use cond to “match” the different kinds of throws. I’m sure I could make the code shorter and more consice by using something like core.check, but I wanted to use vanilla Clojure. If that’s a thing.

What I like about this solution is that it’s quite clear how a strike is better than a spare and how this again is better than a regular frame. I don’t like is how I have to cons and concat the following rolls back into the collection before recursing.

Any feedback is most welcome!

Finally, here are the tests I wrote to feel confident that the solution is correct.

(ns kata-bowling.bowling-test
  (:require [clojure.test :refer :all]
            [kata-bowling.bowling :refer :all]))

(deftest bowling
  (testing "everything in the gutter"
    (is (= 0 (score (repeat 20 0)))))
  (testing "one single pin"
    (is (= 1 (score (cons 1 (repeat 19 0))))))
  (testing "a spare gives ten plus the number of pins in next throw"
    (is (= (+ 10 5 5) (score [5 5 5]))))
  (testing "a strike gives ten plus the number of pins in the two next throws"
    (is (= (+ 10 3 1 2 5) (score [10 1 2 5]))))
  (testing "no spares or strikes"
    (is (= 90 (score (take 20 (interpose 0 (repeat 9)))))))
  (testing "all spares"
    (is (= 150 (score (repeat 21 5)))))
  (testing "a perfect game"
    (is (= 300 (score (repeat 12 10))))))

(also available as a gist)

Adding some Clojure tools

May 14, 2015

Clojure is a very interesting language. It’s a lisp for the JVM, and Emacs is very well suited as a Clojure IDE. In this post I’ll add some customizations that will enhance the Clojure experience in Emacs.

After completing this part I’ll have a setup that let me edit Clojure code in a nice and effective way with help from clojure-mode, clj-refactor and smartparens. I can compile and evaluate code, as well as running tests with help from Cider and company-mode gives me autocompletion powered by Cider. I won’t go into details about these packages. They all have good documentation. Read it!


(require 'setup-package)

(package-require 'clojure-mode)
(package-require 'clj-refactor)
(package-require 'cider)
(package-require 'smartparens)
(package-require 'rainbow-delimiters)
(package-require 'yasnippet)

 (lambda ()
   (eldoc-mode 1)
   (company-mode 1)
   (setq nrepl-hide-special-buffers t)))

(add-hook 'cider-repl-mode-hook #'company-mode)

 (lambda ()
   (clj-refactor-mode 1)
   (cljr-add-keybindings-with-prefix "C-c C-m")
   (smartparens-strict-mode 1)
   (rainbow-delimiters-mode 1)
   (yas/minor-mode 1)))

(provide 'setup-clojure)

What I’ve done here is to require a bunch of packages. In addition to the ones already mentioned I’ve added rainbow-delimiters and yasnippet, which is nice to have, but not crucial.

Next up is three hooks. Hooks are functions that are called when a given event occurs. In this case the events are modes that become enabled. These are more or less copied from the usage section of the different packages. For cider-mode I enable eldoc-mode and company-mode and hide some special buffers. eldoc-mode gives me information about function arguments, while company-mode provides autocompletion.

The first hook defines a lambda which contains all functions to execute for that hook. The next one “points” directly to an existing function. This is better as that hooks currently consist of just one function. I could have rewritten the first hook as several such statements; one for each line inside the lambda.

The final hook is the one for clojure-mode. I enable clj-refactoring which provides a lot of helpful functions for refactoring code. Take a look at the documentation! It will make your life easier. Then I bind its prefix key to the default/recommended value C-c C-m. Smartparens makes working with parens a lot easier. Once you get used to barfing, slurping and killing expressions you will not go back to manual editing.

This is a pretty minimal setup for Clojure development, but I think the most important parts are taken care of.

My .emacs.d at this point can be found in my GitHub repository.

Adding Magit

May 9, 2015

Git is great. I use it all the time, and when I work in Emacs, I use Magit. It gives you a nice interface to perform tasks and work with code in a git repository.

Let’s add it to the mix!


I’ve created a new setup file, nameley setup-git.el. I suspect that there will be more git related customizations, but for now it will only contain magit specific code.

(require 'setup-package)

(package-require 'magit)
(global-set-key (kbd "C-x g") 'magit-status)

(provide 'setup-git)

Not very much interseting going on here. I’ve used the package-require function from the previous part to ensure that we have magit installed. Then I bind the function magit-status to C-x g just like in ohai-emacs. Running this command will take you to the “git control center” showing you all changes, both staged and unstaged for commit. Press d to view the diff, c to commit or maybe F to perform a fetch or a pull. Take a look at the documentation and this cheat sheet if you’re new to Magit.

The final step is to add (require 'setup-git) to init.el.

Configuring Emacs from scratch

April 30, 2015

I’ve been using Emacs for quite some while now. I’ve been using others setup, and I’ve smashed together my own setups. And now, after using ohai-emacs for a while, I’ve decided to throw it all out and build it up from scratch again.

First of all; I’m no Emacs expert. Not at all! By doing this I hope to learn more about Emacs and the Emacs Lisp dialect. I’ll take small steps and try to explain why and how. This is the first (and hopefully not last) post about Emacs customization.

My goals for this part is to create.


This is where it all begins. When you start Emacs, this file is your entry point. Let’s have a look at it.

;; Setup load-path
(setq elisp-dir (expand-file-name "elisp" user-emacs-directory))
(add-to-list 'load-path elisp-dir)

;; No splash screen
(setq inhibit-startup-message t)

(require 'setup-package)
(require 'better-defaults)
(require 'setup-mac)

;; I want path from shell on both MacOS and GNU\Linux
(package-require 'exec-path-from-shell)

The first thing I need to do is to add make my extensions and customizations available. I have to add a folder to the load-path.

To see what your current load-path is you can use the command C-h v. This will also give you a description of the variable if available.

I’ve added the folder ‘elisp’ inside my emacs directory. This name is probably not permanent, but it’s good enough for now. This is where I’ll put most of my code.

(setq inhibit-startup-message t) sets the value of this variable to t which can be considered a truthy value. If this variable is set to a non-nil value the splash screen will not be shown. Again, look up both of these variables with the help functions inside Emacs!

Next step is the exec-path variable. If you start Emacs from elsewhere than your shell you probably want this. It takes the $PATH defined in your shell and adds it to exec-path which is Emacs’s $PATH. Without it you will for instance have trouble running cider-jack-in if you use Emacs for Clojure development.

The next three lines import code provided by the given names. Better defaults are what the names say. Better defaults. This is just downloaded and placed into the elisp folder (which we added to load-path, remember?). Next up is setup of packages. Emacs extensions are distributed as packages. Some are found in the official Emacs repository (ELPA), but most users also add MELPA or Marmalade (or both) to their list of archives.


(require 'package)

(add-to-list 'package-archives
	     '("melpa" . "") t)


(defun package-require (pkg)
  "Install the package if it's not already installed"
  (when (not (package-installed-p pkg))
    (package-install pkg)))

(provide 'setup-package)

Not much going on here. As mentioned I’ve added MELPA so that I can install packages from this package repository. The interesting thing here is the package-require function. This one is yanked from ohai-emacs and let us require packages and automatically install them if not already installed. I think the code is pretty self explanatory. Use C-h f to look up documentation for each of the functions if it doesn’t make sense to you.

Finally we provide our functions and setup code as a feature named setup-package. This is necessary in order for us to be able to require it later on.


(setq is-mac (equal system-type 'darwin))

(when is-mac
  ;; change command to meta, and ignore option to use weird Norwegian keyboard
  (setq mac-option-modifier 'super)
  (setq mac-command-modifier 'meta)
  (setq ns-function-modifier 'hyper)

  ;; Norwegian mac-keyboard alt-keys)
  (define-key key-translation-map (kbd "s-8") (kbd "["))
  (define-key key-translation-map (kbd "s-(") (kbd "{"))
  (define-key key-translation-map (kbd "s-9") (kbd "]"))
  (define-key key-translation-map (kbd "s-)") (kbd "}"))
  (define-key key-translation-map (kbd "s-7") (kbd "|"))
  (define-key key-translation-map (kbd "s-/") (kbd "\\"))
  (define-key key-translation-map (kbd "M-s-7") (kbd "M-|")))

(provide 'setup-mac)

These are customizations specific to mac users. Currently this means keyboard setup. These lines are copied from Magnar Sveen’s setup.

And that’s it!

Optional, what is it good for?

February 21, 2015

NullPointerExceptions. They occur everywhere and are often caused by stupid programming mistakes. Its a really common problem in Java applications. And the guy that first introduced null references calls it the billion dollar mistake.

Many programming languages have a solution to this. In idiomatic Scala you don’t use null. You would use Option instead with either Some value or None. Haskell has the Maybe monad. Clojure has no optional type, but most functions deal with nil and empty lists in a way that makes it close to transparent. This blog post gives some good examples. See the sixth point.

This can (and should) be done in Java too! In Java 8 Optional was added, and earlier versions could get an implementation from libraries like Guava. Using optional make it explicit where a value may or may not be present. You don’t have to read code or documentation in order to figure out if you have to do a null check. Maybe you just add a null check to feel safe. I’m sure you’ve seen code bases bloated with null checks.

Optionals aren’t just about using isPresent() instead of != null in if statements. This slideshow presents some good arguments for why it is a good practice, and what benefits it gives.

Here’s some sample code copied from the slides:

String getCarInsuranceName(Person person) {
  if (person != null) {
    Car car = person.getCar();
    if (car != null) {
      Insurance insurance = car.getInsurance();
      if(insurance != null) {
        return insurance.getName();
  return "Unknown";

This is a rather small sample, but still, a lot of null checks! I’m sure most of us have seen worse. Let’s have a look at how this could have been if using optionals (also copied from the slides).

String getCarInsuranceName(Optional<Person> person) {
  return person.flatMap(person -> person.getCar())
               .flatMap(car -> car.getInsurance())
               .map(insurance -> insurance.getName())

This looks much better! And in my opinion this should be the preferred way of doing it. I’m sure it can be exploited and misused, but mostly, you would benefit from it.

Show me what, not how!

February 12, 2015

Java 8 was released last year, and with it came lambdas and better possibilities for functional programming. This is old news to a lot of people, but if you have been living exclusively in Java lately you might wonder why you should bother with a new style of coding when the old way is just as “readable” in most cases? I see this as a big improvement and benefit, but some people do not.

The old way

List<String> startingWithT = new ArrayList<>();
for(String s : allNames) {
  if (s.startsWith("T")) {

The new way

List<String> startingWithT =
        .filter(n -> n.startsWith("T"))

The first sample is familiar and all, but there’s also more room for stupid errors. The last example is more readable (as in declarative, not familiar!). When you’re used to this way of coding, you’ll have fewer parts of the code that needs focus. No reason to enter “human compiler mode” to ensure that you’re iterating correctly and adding to the right list.

This is of course just one of many examples, but I hope it still proves a point.

To be honest, I prefer using the functional way even in earlier versions of Java. By using the functional parts of Guava I can write code that feels and reads like this even in Java 7 (which I’m using at work). Sure, it’s quite verbose and all, but I tend to see through the boilerplate code and focus on the small important parts of the filters and transforms. In the imperative code all of these lines matters. In functional approach most of them don’t, and messing it up would probably causing a compiler error instead of a hard to find bug!

Sharing code between Clojure and ClojureScript

February 6, 2015

As preparation for my next step on BattleSnake I’ve created a sample application on GitHub that demonstrates shared code between Clojure and ClojureScript. The intention is to run the same game logic both server side and client side.

This is achieved by using the leiningen plugin cljx which enables you to produce both variants by using annotations.

This isn’t a very useful example, but it illustrates the necessary configuration needed to use a shared codebase.

(ns example.shared)

(defn hello []
  "Hello there!")

(defn log []
  #+clj (println "hello from cljx")
  #+cljs (js/console.log "hello from cljx"))

The functions defined above can be called from both Clojure and ClojureScript :-)

Making ajax requests from ClojureScript

January 21, 2015

Recently I’ve played around with ClojureScript and my current idea is to create a multiplayer browser based snake game. I’m not sure if I’ll ever finish this project, but hey, at least I can blog about stuff I learn while doing it. I’ve put the source code on github so feel free to check it out.

Game communication will happen over websockets, but I’ll leave that alone for a while. The first thing I want to bring up is making simple ajax requests from the client. You could of course use JavaScript interop and jQuery or even XMLHttpRequest directly, but luckily, there are ClojureScript libraries.

I’ve used cljs-ajax. This library let you write code like this:

(GET "/something")
(POST "/something"
      {:params {:title "Hello, world!"
                :content "Important message"}})

This library support several formats such as json and edn (Extensible Data Notation). I wanted to use edn. To do that I had to ensure that the server could handle this. That was pretty straight forward and as the documentation suggesed, I’ve been using ring-middleware-format to wrap my ring/compojure handler.

In addition the requests need to be configured to use the correct format for both the request and the response: Note the response-format for the GET request!

(GET "/games" {:handler update-game-list :response-format :edn})

;; storing
(POST "/games"
        {:params {:game-name name
                  :created-by "Bob"}
         :format :edn}))

…and for the sake of completeness; here’s the compojure route definition to handle this

;; ...
(GET "/games" [] (active-games))
(POST "/games" {{name :game-name} :body-params} (create-gamename))

And that’s about it! The essence of this post can be seen in this commit. Here I’ve made it possible to create new games by providing a name and posting it to /games.

Making an uberjar containing ClojureScript artifacts

January 4, 2015

I’ve been playing around with ClojureScript lately. The other day I wanted to make an uberjar so that I could easily deploy my app as a standalone jar file. It turned out that I had skipped some documentation on this subject.

I’m using lein-cljsbuild to compile my .cljs files into JavaScript. As I’m using a mix of both Clojure (server side) and ClojureScript (client side) I have split my src directory into src/clj and src/cljs. This gave me some headache when trying to run the application using lein run: Could not locate battlesnake/server__init.class or battlesnake/server.clj on classpath

The cause of this is of course the new directory layout in src, and the solution is simple. Add :source-paths ["src/clj"] to your project.clj.

Next problem: why doesn’t the uberjar contain any of my compiled ClojureScript? While programming I’ve had lein cljsbuild auto running. This keeps all my .cljs files compiled at all times. When compiling and packaing the uberjar, cljsbuild is not part of the workflow. You can read the details here.

You need this in your project.clj:

:hooks [leiningen.cljsbuild]
:cljsbuild {:builds
            [{;; ...
              :jar true
              ;; ...

That’s it. Now the uberjar is both runnable and contains the compiled ClojureScript!

Easy window navigation in Emacs with WindMove

September 24, 2014

If you’re an Emacs user like me, and your workflow involves windows splitting, you will eventually get tired of using ‘C-x o’ to navigate around. This command cycles through all the windows in order.

WindMove to the rescue! Unless you’re using an ancient version of Emacs, you already have this set up and ready to use. With WindMove you can move around windows intuitively by holding down shift and pressing the arrow keys. Much better than repeating ‘C-x o’ over and over!

Note to self: How to fix SSH locale issues

January 24, 2013

For some reason, when I change the localization settings on my MacBook Pro, ssh locale/encoding behaves differently from when I was using standard settings. That is using region=United States works, region=Norway not so much.. I noticed the problem when I was unable to type norwegian characters into the remote shell.

The fix is simple. (thanks to

Comment out **SendEnv LANG LC_*** in /etc/ssh_config.