Git

# enable repo wide commit signing
git config commit.gpgsign true

# set global signing key
git config --global user.signingkey CAFEBABE

# create new branch, take local changes along
git checkout -b new-branch

# remove local branch
git branch -d new-branch

# add single hunk from a file
git add --patch

# push the current branch
git push origin HEAD

# create alias "git new" to init with empty commit
git config --global alias.new '!git init && git commit --allow-empty -m "initial commit"'

# update all submodules
git submodule foreach git pull origin master

(Spac)emacs

Splitting windows

  • C-x 2: split into two windows, one above the other
  • C-x 3: split into two windows, side by side
  • C-x o: switch to other buffer in window split

Required package request-0.1.0 is unavailable

see issue #4642

  1. M-x list-packages
  2. search and install request
  3. restart emacs M-m f e R (for ‘evil’: SPC f e R)

Duplicate current line

(defun duplicate-line()
  (interactive)
  (move-beginning-of-line 1)
  (kill-line)
  (yank)
  (open-line 1)
  (next-line 1)
  (yank)
  )

(global-set-key (kbd "C-c d") 'duplicate-line)

Kill current line

(global-set-key (kbd "C-c f") 'kill-whole-line)

Webserver configuration

Enable autorun on boot (Ubuntu)

sudo update-rc.d supervisor defaults

Objective C

Blocks

// define:
typedef retTy (^BlockName)(int foo, NSString *bar);

// use:
BlockName block = ^retTy(int foo, NSString *bar) {
    // do stuff
};

// as property:
@property (nonatomic, copy) BlockName myBlock;

JavaScript

Benchmarks

Docker

Configure daemon to listen on TCP

sudo emacs /lib/systemd/system/docker.service # remove -H option
sudo emacs /etc/docker/daemon.json # update to the following:
# { "hosts": [ "tcp://127.0.0.1:2375", "fd://" ] }
sudo systemctl daemon-reload
sudo systemctl restart docker.service

AWS