Emacs: here I go again

"Emacs" stands for "Editor MACroS" and I have been using it on-and-off since the early 1990s. I had detours to Windows-editorss (like Sublime and Code) and IDEs (like Eclipse) but I always return to Emacs.

I like that Emacs has everything but the kitchen sink. It is pretty complete out of the box and it has tons of packages available in repositories like MELPA.

I like that the Emacs keychords are in my muscle memory.

I also like the tinkering that it allows. But that is also its/my pitfall: I can spend hours/days/weeks tinkering without ever doing anything really productive.

So, every couple of years or so, my .emacs has become overly complex, so I tend to go look for a pre-packaged setup like Prelude Emacs, which bundles a consistent set of pre-configured packages and settings. This greatly simplifies my .emacs and frees me from maintaining it.

But then, after again a couple of years, I find that the whole pre-packaged deal restricts my right to self-determination. And I decide to start my own .emacs from scratch. Which is where I am at now:

org-static-blog

This website and its blog are written in orgmode, exported to HTML through org-static-blog, and published through Github pages.

A few tips for org-static-blog:

Other considerations:

Docker

Docs | QuickRef | Cheatsheet

Use docker help, man dockerfile of man docker-<command> (e.g. man docker-run).

Concepts:

  • Major components:
    • A server/daemon which
      • manages docker objects, such as images, containers, network and data volumes
      • has a REST API
      • and a CLI (which uses the REST API)
    • A client which is the primary way to interact with Docker.
    • A registry (e.g. Docker Hub) that stores images
  • App hierarchy:
    • Stack
    • Service: a container from a docker-compose file
    • Container:
      • When stopped: a runnable instance of an image
      • When started: a running image (i.e. image + state)
      • may be connected to a network and/or storage
      • can be stored as an image
    • Image:
      • A read-only template with instructions for creating a Docker container
      • an executable package
      • may be based on another image
  • Files:
    • A Dockerfile defines an image
    • A docker-compose.yml defines one or more containers (a.k.a. services) that work together
  • Tips:
    • You start a container (after it has been stopped) and run an image (which creates and starts a container).
    • ​Docker services can address each other through their container names as host name.

Basic docker commands

command (docker …) effect
build -t friendlyhello . Create image using this directory's Dockerfile
run -p 4000:80 friendlyhello Run "friendlyname" mapping port 4000 to 80
run -d -p 4000:80 friendlyhello Same thing, but in detached mode
container ls List all running containers
container ls -a List all containers, even those not running
container stop <hash> Gracefully stop the specified container
container kill <hash> Force shutdown of the specified container
container rm <hash> Remove specified container from this machine
container rm $(docker container ls -a -q) Remove all containers
image ls -a List all images on this machine
image rm <image id> Remove specified image from this machine
image rm $(docker image ls -a -q) Remove all images from this machine
login Log in this CLI session using your Docker credentials
tag <image> username/repository:tag Tag <image> for upload to registry
push username/repository:tag Upload tagged image to registry
run username/repository:tag Run image from a registry

(src)

More advanced docker commands

command (docker …) effect
volume rm $(docker volume ls) Remove all named volumes
exec -i -t container_name /bin/bash Open a terminal
system prune WARNING: use with caution

docker-compose

command (docker-compose ...) effect
exec <container_name> bash run command bash
-f <file> up start from a custom file
down --volumes also remove volumes attached to the container

Org-mode cheat sheet

Manual | RefCard | Org4Beginners | Glossary | Cookbook | 5 useful features

Markup: bold, italic, underlined, strikethrough, , verbatim, code

  • list
    • other list
      • Numbered list

Links1: http://otech.nl, OTech, otech.jpg

Cycle to do items with S-LEFT and S-RIGHT

Table and keys

key context effect
M-RET   New headline
TAB / S-TAB   Fold / Unfold
M-RIGHT / M-LEFT   Promote / Demote
  table Move column
M-UP / M-DOWN table Move row
M-S-DOWN table Insert row (?)
C-c RET table Insert horizontal line
C-c ^ table Sort lines
S-RIGHT / S-LEFT task Cycle workflow
  list Cycle bullet type
S-UP / S-DOWN   Cycle priority
C-c C-e   Export menu
C-c a   Agenda
C-c C-c heading edit tags
  on top refresh local setup
C-c ' code block edit in native mode
C-c ;   Toggle COMMENT of subtree

Literal examples

Some example from a text file.

Also available: VERSE, QUOTE and CENTER

Source code blocks

(defun org-xor (a b)
  "Exclusive or."
  (if a (not b) b))

Use Ditaa for figures.

Footnotes:

1
Show markup by removing the last (hidden) symbol of the link

Blockchain

Key concepts

  • Chain of immutable blocks (though hashes)
  • Public, distributed replication (through peer to peer - p2p)
  • Decentralized, trustless consensus (by collective self-interest)
  • Forks are resolved through scoring (resulting in orphan blocks)
Other posts