Hack4Glarus(https://hack4glarus.ch/) is the first hackathon of Glarus. It is your chance to meet & hack with geniuses of Switzerland. It is all about technology and fun.

This event is hosted at a great location (same as the launch of swiss-crowdfunder.com and is hosted by our friends from ungleich glarus ag.

We from 200ok will be there as well - as are our friends from the Insopor Zen Academy. Join us for three great days of hacking, fun and learning!

Join the event now on the dedicated page, on Facebook or on Meetup...

  • 200ok
  • 200ok
  • ungleich
  • ungleich glarus ag

We just released our newest product: Swiss Crowdfunder

Swiss Crowdfunder is a joint product that we built together with our good friends from ungleich glarus ag. As the name implies it is a crowdfunding platform, but with a twist! Whereas traditional crowdfunding campaign supporters will only receive certain goodies (like stickers, t-shirts or even newly created products), supporters on Swiss Crowdfunder can actually invest in companies.

Equity funding (or crowdinvestment) enables the supporters to effectively buy shares from an otherwise not publicly traded company. Therefore it is a great option to raise money for companies on the one hand, but...

  • 200ok
  • 200ok
  • crowdfunding
  • swiss crowdfunder
  • products
  • release
  • ungleich
  • ungleich glarus ag

Today we are going to write a bot using Clojure to beat the game 2048. We are going to use a variation of the minimax algorithm called expectimax.

1. game rules

You can merge tiles by merging the whole board either horizontally or vertically. If you manage to get the 2048 tile, you win. After a merge (= player's turn), a tile will appear randomly on an empty slot. The chance of that tile being a 4 is 0.1, the chance of it being a 2 is 0.9. After reaching the 2048 you can keep...

Happy to be coworking with our friends from ungleich glarus ag in Linthal, Glarus on our new joint venture: Glarner Crowdfunding AG.

As an added bonus, we have the best working conditions we could ever ask for.

Come and join us any time for a coffee, a tea or a coworking session in our offices in Glarus or Schwanden.

I'm happy to be able to share one of the building blocks of the software solution I'm currently working on: fsdb - a Clojure library that provides a reasonably convenient database on top of the file system.

Don't get me wrong, I'm not talking about a file system database like sqlite here. I'm using the term database loosly. Think of a bunch of config files that make up a database that you want to query. That's what fsdb can do for you. You point it to a directory and it reads the data from the directory tree and returns a...

  • clojure
  • opensource
  • clojure
  • filesystem
  • database

You might be familiar with the great vidir utility which allows editing of contents of a directory in a text editor. This is a great concept, because editors are great at text manipulation - which in turn yields more efficiency for mass renaming/moving/deletion than typing commands in a shell or using a GUI. vidir is a great tool, there's no argument to be had - it's even completely decoupled from the actual $EDITOR used. If you're using Debian, it's contained in the moretools package (which has other helpful utilities).

However, if you're using Emacs as your editor, there's no...

If you want to do an ongoing speedtest with graphs for up- and download, forget about the web-based tools like speedtest.net and fast.com - those are nice if you are on a mobile phone. These speedtests as a service will not show you continuous graphs (which sometime you might want to have if you are tweaking your network).

On such occasions, your *nix shell yields better tooling!

First, fire up a Terminal and start nload to view network traffic. If you are on macOS, you can also use the graphical tool activity monitor.

nload

Then, in a second Terminal, start a...

  • Tooling
  • debian
  • bash
  • linux
  • nload
  • shell
  • unix

After upgrading to Chromium 60 on current Debian Testing you might find yourself with a huge UI if you are on a HiDPI device. The current Chromium version has a bug (see Debian tracker). The proposed solution is to run Chromium with a manual scale factor setting. On a 15" MBP Retina, using chromium --force-device-scale-factor=1.5 yields the same UI size that I was used to before the upgrade.

Looking at the Chromium upstream bug tracker, this issue is solved since end of May. It'll find it's way to Debian, eventually. In the meantime the workaround works just as well.

The exact...

tramp-mode is great for editing files remotely, but sometimes having a shell and Emacs together on the same file can be invaluable.

eshell opens up a shell which is like a regular Unix shell, but is written completely in Elisp, so it's built-in to Emacs and is completely portable. eshell has many interesting properties, but let's focus on editing files remotely.

When in eshell, it is possible to change the working directory into a remote directory with the same syntax as tramp-mode. Yes, no manual ssh-ing to the remote machine, it's more like a fuse-sshfs connection, but without fuse and without the...

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...

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...

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...

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...

  • clojure
  • macro
  • metaprogramming
  • prototype

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...

  • ruby
  • ruby
  • dsl
  • programming

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...

  • tricks
  • linux
  • console
  • cli
  • terminal
  • shell
  • zsh

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...

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...

  • tooling
  • clojure
  • graph
  • dependencies
  • visualization

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 it's possible in JavaScript as well, by now.

This is a demo showing...

  • riotjs
  • javascript
  • spa
  • module
  • webpack

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.

...
  • tricks
  • linux
  • console
  • cli
  • terminal
  • shell
  • ssh
  • dbus
  • roxterm
  • zsh

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>
      </tbody>
  ...

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...

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,...

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...

  • vim
  • coding
  • ctags
  • exuberant ctags
  • ide
  • minibuf
  • omni completion
  • pep 8
  • programming
  • python
  • python ide
  • taglist
  • tasklist
  • tutorial
  • vi
  • vimpdb
  • walkthrough

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...

  • python
  • beautifulsoup
  • howto
  • scraping
  • tutorial
  • web scraping
  • webscraping