Consultancy - Research Lab - Incubator

based in beautiful Zürich, Switzerland

- 377 words - 2 min read
#tooling

Amazon AWS has a nice command line client for their public cloud. This client is very well suited for automating tasks in many IaaS DevOps scenarios. However, it can also be used by a person. The scenarios to do so might be different than for automation, though.

A common scenario for looking into S3 is to want to list files ordered by date and including metadata. On a Unix machine, this would be an ls -lt. If it's a very long list of files, you might want to cap the list - which again is very easy to achieve, for...

- 142 words - 1 min read
#debian

If you happen to upgrade your Debian Jessie to Stretch (currently Debian Testing), one of the things you might want to patch is the default behavior of Chromium having extensions disabled by default. There's no way to fix that in the UI, it has to be done by setting a global configuration flag.

There's also a reason why extensions are disabled by default. Apparently Chromium started downloading binary extensions that don't show in the extensions list which had access to the Google Voice API which sounds kinda scary. Well, maybe it is, maybe it isn't.

However, if you decide you can't live...

- 656 words - 4 min read
#coders tip

Many programmers commit infrequently and their pushes are even rarer. There are multiple reasons for that - some programmers have a strong background in version control systems like SVN or even CVS (yes, both are still a thing in 2017) where branching and committing is expensive. Other programmers mention reasons in the range of "I'm not finished, yet" and won't commit or push for days or weeks.

If you are using a modern VCS like git or mercurial, then committing and branching is actually very cheap. With those, it is actually best practice to commit early and often. If you don't...

- 167 words - 1 min read
#ruby

This is nothing more than linked list of resources for learning how to write DSLs with Ruby, but also DSLs in general.

(DSL stands for Domain Specific Language and which is a programming language that is closely modelled after the domain it is used in. Wikipedia has a good introductory article.)

Obie Fernandez wrote the reference on Rails. In this podcast he speaks about what a DSL is, the difference between internal and external DSLs as well as the importance of the flexibly syntax of the host language in order to make DSLs worthwhile.

http://podbay.fm/show/120906714/e/1175932332

Martin Fowler is a well...

- 537 words - 3 min read
#clojure

TL;DR I was looking for a prototype of a Clojure macro that fulfills three requirements: (1) Generates a function. (2) Takes options as parameters and provides those to the generated function. (3) And lastly the generated function takes arguments. Spoiler! This is it...

(defmacro defsample [name & args]
  (let [options (apply hash-map args)]
    `(defn ~name [input#]
       (prn (str (:text ~options) " " input# ".")))))

(defsample sample :text "Hello")

(sample "world")

Keep on reading for a detailed description. In my quest to come up with the prototype above I started with the most basic version...

- 362 words - 2 min read
#tricks

Back in the days when I was developing in Ruby most of my waking hours rbenv was a real life saver. But looking at what it does, it initially felt awkward how it "wrapped" the cd command. You could argue that the Ruby community are no strangers to guerrilla patching. But it felt less awkward when I learned that in my zsh it uses hooks instead of guerrilla patching to achieve the same goal: React on changing the directory.

In the meantime I tried a couple of things with zsh hooks to optimize work flows and what not, but...

- 325 words - 2 min read
#tooling

TL;DR Use codegraph to visualize dependencies within a Clojure file. Codegraph applied to itself will for example generate this graph:

example codegraph graph

Here is how it works.

The other day I wished I had a visualization of the dependencies in a piece of ClojureScript code that over the course of the year has gotten a bit unwieldy. I did some thinking and some codeing and it turns out it's quite easy. Here are some of the highlights in code & images, but mostly code.

Reading a string and have it evaluates in Clojure is done with read-string. Reading a...

- 436 words - 3 min read
#tooling

Frustration with slow and manual processes is probably my number one motivator to discover new tooling. Having lately worked with Swagger on a Json API I found myself in need of a tool to work with Json on the command line.

I tried a couple and just when I was about to make the decision that I want to try them all to find the best one my search was cut short when I tried jq. On the web site it claims: jq is like sed for JSON data. And come to think of it what would we do without...

- 102 words - 1 min read
#tricks

I'm using the command line extensively, with plenty of black terminals side by side in my tiling window manager I was looking for something that helps distinguish remote shells (via ssh) from my local shells.

Introducing one of my favorite tricks: Changing the background color of the terminal while running an ssh session.

function ssh() {
  dbus-send --session /net/sf/roxterm/Options net.sf.roxterm.Options.SetColourScheme string:$ROXTERM_ID string:Tango
  /usr/bin/ssh $@
  dbus-send --session /net/sf/roxterm/Options net.sf.roxterm.Options.SetColourScheme string:$ROXTERM_ID string:Default
}

In my setup I'm using zsh and roxterm, but I'm sure it'll work for other tools as well if you adjust it to yours.

...

- 176 words - 1 min read
#riotjs

Module Hot Loading enables a super efficient workflow without the pain of manual reloading of your web application. What do I mean by that? Well, the usual web developer cycle is:

  1. Write code
  2. Save code
  3. Switch to Browser
  4. Hit Reload
  5. See what happens
  6. Switch back to Editor

Half those steps (3, 4 and 6) are manual and very repetitive if you want to have an incremental development experience. They can be automated completely.

There are some frameworks that support Module hot-loading by now. ClojureScript and Elm probably were the first languages to support that paradigm, but...

- 402 words - 3 min read
#riotjs

If you want to use RiotJS Custom Tags within a <table>, you might have stumbled upon something that looks like a bug. If you nest Custom Tags within a <table> element, they will not render within said element, but outside of it. Let me clarify with an example and how to fix it.

If you have code that nests elements like this:

<todoList>
    <table>
      <tbody>
        <todo each="{ allTodos() }">
        </todo>
    </table>
</todoList>

Where <todo> is defined as...

- 240 words - 2 min read
#org-mode

Update: This is a re-post of an older blog post of mine. Originally it was posted on my personal blog. I'm deprecating my personal blog in favor of this 200OK blog.

You can use templates for different types of capture items, and for different target locations.

The following code sets up three capture templates – for todos, media urls and code snippets (lines 4-7).

%? sets the exit point for the template, %^g prompts for a tag, %^{language} prompts for the language of the snippet and the remainder is boilerplate to create an org-mode entry (*) and an...

- 677 words - 4 min read
#python

Update: This is a re-post of an older blog post of mine. Originally it was posted on my personal blog where it has >30 comments and >20'000 views over the last years. I'm deprecating my personal blog in favor of this 200OK blog.

Spoiler: This post is primarily gonna be an excerpt of my bookmarks collection. That’s because more intelligent men than me have already written great articles on the topic of how to become a great Python programmer.

I will focus on four primary topics: Functional programming, performance, testing and code guidelines. When those four aspects merge in one programmer,...

- 1124 words - 6 min read
#vim

Update: This is a re-post of an older blog post of mine. Originally it was posted on my personal blog where it has >130 comments and ~ 250'000 views over the last years. I'm deprecating my personal blog in favor of this 200OK blog.

Finding the perfect IDE for Python isn’t an easy feat. There are a great many to chose from, but even though some of them offer really nifty features, I can’t help myself but feel attracted to VIM anyway. I feel that no IDE accomplishes the task of giving the comfort of complete power over the code...

- 1406 words - 8 min read
#python

Update: This is a re-post of an older blog post of mine. Originally it was posted on my personal blog where it has ~40 comments and >35'000 views over the last years. I'm deprecating my personal blog in favor of this 200OK blog.

In this short tutorial, I’m going to show you how to scrape a website with the 3rd party html-parsing module BeautifulSoup in a practical example. We will search the wonderful translation engine dict.cc , which holds the key to over 700k translations from English to German and vice versa. Note that BeautifulSoup...