Love, caffeine and omlette

Tag: dotfiles

Resize panes in VIM with your arrow-keys

It's worth to write about your learning's. Even if they seem small.

Recently I turned of my arrow keys in VIM and blogged about it.

After reading my article Philipp Fehre suggested, that I could take this a step further and use the arrow keys for resizing panes.

So I went ahead and copied the following 5 lines from his .vimrc:

" Make arrowkey do something usefull, resize the viewports accordingly
nnoremap <Left> :vertical resize +5<CR>
nnoremap <Right> :vertical resize -5<CR>
nnoremap <Up> :resize +5<CR>
nnoremap <Down> :resize -5<CR>

Phil was right! This is a great way of resizing panes.

The awesomeness tool-chain

I have an awesomeness tool-chain — command line tools, that increase my productivity dramatically. In this blog post I want to introduce you to these powerful tools.


$>  echo "I love strawberries" | cowsay
 < I love strawberries >
              (__)       )/
                  ||----w |
                  ||     ||


If you like ponies and colors more - I understand. Depends on the use case really. I found ponies way more effective if you want to communicate something that could trigger bad feelings.

sl - The ls for pros

I often mistype ls. Gone are the days were this was boring. I just lean back and enjoy the show. Steam Locomotives are a big part of being awesome.


If you are as new to programming as me you need help, when someone asks you for you're opinion.

Fortune produces profound answers to all kind of questions you did not even ask.

$ fortune
I am the mother of all things, and all things should wear a sweater.

$ fortune
Any sufficiently advanced technology is indistinguishable from a rigged demo.
    -- Andy Finkel, computer guy


Being awesome requires a special tool-chain. Having ponies and quotes at your disposal is essential. I think you should give this a try.

Manage your Mac Apps with homebrew-cask

A while ago I became interested in automating the setup of my Macs. I started my journey with chef-solo, however this wasn't really practical for me, so I switched to homesick to manage my dotfiles.

Unfortunately that left me without a solution to install my apps automatically.

Not any more. homebrew-cask to the rescue!

Take a walk

Image Source: Flickr/megoizzy (CC BY-SA 2.0)

What is homebrew-cask

homebrew-cask is a Homebrew extension that allows you to install your apps like this:

brew cask install evernote

How to install homebrew-cask

If you already use homebrew, installing homebrew-cask is really simple:

brew tap phinze/homebrew-cask
brew install brew-cask

If you have Alfred installed you should also configure it, so that it recognizes apps managed by homebrew-cask.

brew cask alfred link

Using homebrew-cask

Using homebrew-cask is simple. You install apps using the brew cask install command. Evernote for example, you would install like this:

brew cask install evernote

Create a little script to install your Apps

I store all my apps in a file called ~/.brew. In order to install the apps I just have to run it.

This is how you create your own:

touch ~/.brew
chmod +x ~/.brew

Now fill it with the Apps you want to install across all your Mac's.

For me this looks like:

brew cask install google-chrome  
brew cask install rubymine  
brew cask install charles  
brew cask install mou  
brew cask install bit-torrent-sync  

I have this file on GitHub and symlink it with homesick. When I am on a new Mac I just have to run


That installs all my common apps.

Create own casks

There are over 300 casks available already. You can view a list with

brew cask search

If your favorite app is missing it is really simple to add it.

In the example below I create a Cask for Soulver.

brew cask create soulver

An editor opens with the newly generated cask.

class Soulver < Cask  
   url ''
   homepage ''
   version ''
   sha1 ''
   link ''

You just have to fill in the download URL of the app, the apps name, the version, the sha1 checksum of the download and it's homepage.

class Soulver < Cask  
  url ''
  homepage ''
  version 'latest'
  link ''

In Soulver's case the download URL does always refer to the latest version. So in this case I used no_checksum, so that this Cask will not break in the future.

Now audit your cask:

$ brew cask audit soulver
audit for soulver: passed

Now you can install Soulver. And don't forget to open a pull request 😉

Before you do — check the latest contribution guidelines.


I am really happy that homebrew-cask exists now. It closed a gap in my configuration management. I can set up a new Mac in no time. I hope you enjoy it as much as I do.

How to prevent yourself from force pushing to master

I am pretty reckless sometimes. I forced pushed to master several days in a row.

What does a real programmer do? - He writes a script that prevents him from doing it ever again, of course..

For the longest time this was a little complicated - you had to
install a hook onto the remote repro. For Git >1.8.2, there's a pre-push hook that was just perfect for my script.

If the hook returns an error the push is not executed.

The script

So this is the git hook i came up with.

#!/usr/bin/env ruby
# Pre-push hook that rejects force pushes to master.
# Requires Git > 1.8.2

class PushRejecter  
  def run
    if pushing_to?(:master) and forced_push?

  def pushing_to?(branch)
    `git branch | grep "*" | sed "s/* //"`.match(branch.to_s)

  def forced_push?
    `ps -ocommand= -p #{Process.ppid}`.match(/force|pfush/)

  def reject
    puts "Force push to master rejected."

  def allow

Ignore the over engineering please..

If the current branch is master and i am force pushing it does return an error and the push is not executed.

How to install it

All my hooks are stored in a folder called ~/.git_template.

It is configured as my template directory for git:

  templatedir = ~/.git_template

In order to activate the hook you have to go into all your existing repros and execute

git init

This will install the hook for you. As I mentioned you need Git >1.8.2.

Alternatively you could place the hook in the .git/hooks/ directory manually in each of your repros.


I am more confident, that I will not cripple a master branch again. A nice feeling. If you like to have a look at the rest of my setup I recommend a look at
my dotfiles.

© 2017

Theme by Anders NorenUp ↑