Table of contents

Note to self: portable pkg-* Aliases

Always bored to remember those:

  • ArchLinux

    alias pkg-search="pacman -Ss"
    alias pkg-add="sudo pacman -S"
    alias pkg-info="pacman -Qv"
    alias pkg-files="pacman -Ql"
    alias pkg-list="pacman -Sl"
    alias pkg-which="pacman -Qo"
    alias pkg-depends="pacman -Si"
    alias pkg-depends-reverse="pacman -Sii"
    alias pkg-delete="sudo pacman -Rs"
    alias pkg-upgrade="pacman -Syu"
    alias pkg-update="pacman -Sy"
    alias pkg-download="pacman -Sw"
    alias port-search="yaourt"
    alias port-add="yaourt -S"
    alias port-update="yaourt -Syua"
    
  • Ubuntu

    alias pkg-search="apt-cache search"
    alias pkg-add="sudo apt-get install"
    alias pkg-info="dpkg"
    alias pkg-depends="apt-cache --no-pre-depends --no-recommends \
                       --no-suggests --no-conflicts --no-breaks \
                       --no-replaces --no-enhances --installed depends"
    alias pkg-depends-reverse="apt-cache --no-pre-depends --no-recommends \
                               --no-suggests --no-conflicts --no-breaks \
                               --no-replaces --no-enhances --installed rdepends"
    alias pkg-delete="sudo apt-get --purge autoremove"
    alias pkg-key="sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys"
    
  • VOID Linux

    alias pkg-files="xbps-query -f"
    alias pkg-list="xbps-query -l"
    alias pkg-info="xbps-query"
    alias pkg-update="xbps-install -S"
    alias pkg-upgrade="xbps-install -Syu"
    alias pkg-add="xbps-install"
    alias pkg-search="xbps-query -Rs"
    alias pkg-which="xbps-query -Ro"
    alias pkg-delete="xbps-remove -R"
    alias pkg-depends="xbps-query -x"
    alias pkg-depends-reverse="xbps-query -X"
    

↷ 13.06.2016 🠶 #server

Mein bisher bestes Brot: Mischbrot

Heute habe ich wieder Brot gebacken und es ist super geworden. Das ursprüngliche Rezept war das Weizenbrot I aus dem Backbrot Nr.1. Allerdings habe ich das Rezept diesmal massiv geändert. Zum einen habe ich statt dem 12 Stunden Vorteig einfach mein Livieto Madre genommen. Dann habe ich alle möglichen Mehlsorten frei Schnauze gemischt: Roggenmehl, Weizen 1050, Weizen Vollkorn und Dinkel 1050. Das Wasser habe ich diesmal gar nicht abgemessen sondern solange welches reingemacht bis der Teig die Konsistenz hatte, die ich haben wollte.

Warum? Bei den letzten Broten habe ich  immer aufwändig die Wasserverhältnisse ausgerechnet, weil ich ja immer LM benutzen möchte. Üblicherweise hat mein LM aber eine andere Teigausbeute, wie der Brotteig haben soll. Die letzten beiden Brote waren aber eher unbefriedigend, trotz des Rechenaufwandes. Ich habe auch nirgendwo eine sichere Methode gefunden wie man das besser machen kann, ausser: kipp die Sachen nach Gusto zusammen und mach 'nen Teig. Ich fand das - insbesondere als Backanfänger - recht brachial und eher keine Garantie für Backerfolge.

Hier habe ich daher nun einen Kompromiss gewagt. Ich habe mich bei Mehlmenge, Salzgehalt usw grob ans Rezept gehalten. Bei der Wassermenge und Konsistenz aber eher an mein Gefühl. Und das ging ganz gut, muss ich sagen. 

A la Bertinet mit der Teigkarte in der Schüssel vermischt und dann geschlagen und nicht geknetet. Das Resultat nach 3 Stunden: 

2016-05-27 - Angeschnitten. Dieser Duft und diese herrliche weiche Krume, wow! Anhand der Krume sieht man übrigens auch schön den Unterschied zum Original. Diese unregelmässigen Lufteinschlüsse sind typisch für geschlagenen Teig. Ich liebe das.:

2016-05-27 - Fertig gebacken, Guckt Euch das an!:

2016-05-27 - Fast fertig im Ofen (auf dem Stein):

Update 2016-05-27:

Und hier noch das Rezept, der Vollständigkeit halber:
Hauptteig:
  • 200 g Lievito Madre (LM)
  • 100 g Weizenmehl 1050
  • 100 g Dinkelmehl 1050
  • 100 g Weizen Vollkorn
  • 50 g Roggenmehl 1150
  • 50 g Weizenmehl 550
  • Wasser nach Bertinet
  • 6 g Frischhefe
  • 10 g Salz
  • 5 g Balsamico-Essig
  • 5 g flüssiges Gerstenmalz
  • 5 g Honig

Alle Zutaten – ausser dem Salz – in eine große Schüssel geben, Hefe mit etwas Wasser aufgelöst. Mit der Teigkarte vermengen (Methode Bertinet). Nach und nach Wasser zugeben, bis der Teigklumpen die richtige Konsistenz hat (weich bis mittelfest, klebt noch, bleibt aber kompakt).

13:00

Dann rausholen und Schlagen (Methode Bertinet). Nach 1 Minute Salz hinzugeben. Etwa 10 Minuten schlagen, bis Teig glatt ist, nicht mehr klebt und keine Reste mehr auf der Arbeitsplatte beim Abheben hinterlässt.

13:05

In die Schüssel zurück (diese vorher ggf. Reinigen), luftdicht abdecken und 1,5 Stunden bei 20-22° zur Gare stellen. Je nach ca. 30 Minuten falten.

13:15

Länglichen Laib wirken, leicht bemehlen, mit Nudelholz längs mittig bis fast unten eindrücken, die beiden Hälften zusammenklappen und mit der Falte nach unten in bemehlten Gärkorb stellen. Mit bemehlten Leinen abdecken und ca. 1 Stunde bei 25° zur Stückgare stellen.

14:45

50 Minuten (wenn man 2 kleinere Laibe macht, nur 40 Minuten) bei 250° mit Schwaden fallend (nach 10 Minuten 210°) mit der Falte nach oben backen. In den letzten 5 Minuten Türe etwas öffnen und auf 250° stellen. Kruste muss dunkelbraun sein. Auf Gitter offen abkühlen lassen.

15:45

Abends zur Brotzeit verspeisen.

18:00

↷ 27.05.2016 🠶 #kochen

Emacs: read-only copy of current buffer

Very often I split the emacs frame into two windows with the same buffer in both. For example on the left side I have a class definition and on the right side I implement it (so that part of the buffer is below the definition). While this works like a charm, sometimes I stumble upon an obstacle: if I want to change the class definition for testing, I cannot see the old definition for comparision. It has changed after all.

So I wrote this function which creates a copy of the current buffer, names it appropriately, makes it read-only, splits the current window and places the read-only copy on the right. Now I can see the old implementation while changing the current one, I can copy parts of the old stuff back into the current (because UNDO might remove some of the new things I want to keep) and so on. I bound this to C-c C-p, which you might want to change.

Here's the code. Put into .emacs to try it out:

;; ** Make a read-only copy of the current buffer
;;
I just create a new read-only buffer and copy the contents of the
;; current one into it, which can be used as backup
(defvar copy-counter 0)

(defun get-copy-buffer-name() “return unique copy buffer name” (let ( (name (concat "*COPY “ (buffer-name (current-buffer)) ” (RO)")) ) (if (not (get-buffer name)) (progn (setq copy-counter (1+ copy-counter)) (concat name "<" (number-to-string copy-counter) ">") ) (concat name) )))

(defun copy-buffer-read-only() “Create a read-only copy of the current buffer” (interactive) (let ( (old-buffer (current-buffer)) (new-buffer-name (get-copy-buffer-name)) ) (progn (delete-other-windows) (split-window-horizontally) (other-window 1) (if (not (eq (get-buffer new-buffer-name) nil)) (kill-buffer (get-buffer new-buffer-name)) ) (set-buffer (get-buffer-create new-buffer-name)) (insert-buffer-substring old-buffer) (read-only-mode) (switch-to-buffer new-buffer-name) (other-window 1) )))

(defaliascp ‘copy-buffer-read-only)

(global-set-key (kbd “C-c C-p”) ‘copy-buffer-read-only)

There's even a screenshot (the read-only copy can be seen on the right):

↷ 27.05.2016 🠶 #emacs

Emacs: copy things at point without marking

This emacs config snippet is the predecessor to viking-mode: it allows me to copy thing at point without marking it beforehand. I just press a prefix key followed by an abbreviation of the thing to copy:

  • C-c w   copy word
  • C-c l    copy line
  • C-c p   copy paragraph
  • C-c a   copy all (the whole buffer)

Like viking-mode the copied thing is being highlighted shortly for visual feedback.

Put this into your .emacs config to try it out:

;; ** Easily copy word, line, paragraph or buffer without marking
;;
with ideas from:
;; http://emacs.stackexchange.com/questions/1051/copy-region-from-emacs-without-newlines
;; https://www.emacswiki.org/emacs/CopyWithoutSelection (defun my-blink(begin end) "blink a region. used for copy and delete" (interactive) (let* ((rh (make-overlay begin end))) (progn (overlay-put rh 'face '(:background "DodgerBlue" :foreground "White")) (sit-for 0.2 t) (delete-overlay rh) )))

(defun get-point (symbol &optional arg) “get the point” (funcall symbol arg) (point) )

(defun copy-thing (begin-of-thing end-of-thing &optional arg) “Copy thing between beg & end into kill ring. Remove leading and
trailing whitespace while we’re at it. Also, remove whitespace before
column, if any. Also, font-lock will be removed, if any. Also, the
copied region will be highlighted shortly (it ‘blinks’)."
(save-excursion (let* ((beg (get-point begin-of-thing 1)) (end (get-point end-of-thing arg))) (progn (copy-region-as-kill beg end) (with-temp-buffer (yank) (goto-char 1) (while (looking-at ”[ \t\n\r]") (delete-char 1)) (delete-trailing-whitespace) (delete-whitespace-rectangle (point-min) (point-max)) ;; del column \s, hehe
(font-lock-unfontify-buffer) ;; reset font lock
(kill-region (point-min) (point-max)) ) ))))

(defun copy-word (&optional arg) “Copy word at point into kill-ring” (interactive “P”) (my-blink (get-point ‘backward-word 1) (get-point ‘forward-word 1)) (copy-thing ‘backward-word ‘forward-word arg) (message “word at point copied”))

(defun copy-line (&optional arg) “Copy line at point into kill-ring, truncated” (interactive “P”) (my-blink (get-point ‘beginning-of-line 1) (get-point ’end-of-line 1)) (copy-thing ‘beginning-of-line ’end-of-line arg) (message “line at point copied”))

(defun copy-paragraph (&optional arg) “Copy paragraph at point into kill-ring, truncated” (interactive “P”) (my-blink (get-point ‘backward-paragraph 1) (get-point ‘forward-paragraph 1)) (copy-thing ‘backward-paragraph ‘forward-paragraph arg) (message “paragraph at point copied”))

(defun copy-buffer(&optional arg) “Copy the whole buffer into kill-ring, as-is” (interactive “P”) (progn (my-blink (point-min) (point-max)) (copy-region-as-kill (point-min) (point-max)) (message “buffer copied”)))

;; “speaking” bindings CTRL-[c]opy [w]ord, etc…
(global-set-key (kbd “C-c w”) ‘copy-word)
(global-set-key (kbd “C-c l”) ‘copy-line) (global-set-key (kbd “C-c p”) ‘copy-paragraph) (global-set-key (kbd “C-c a”) ‘copy-buffer)

Update 2017-02-12:

Sometimes during programming in emacs I need to copy a whole function. If a function contains empty lines, copy-paragraph is insuffcient. So, I added copy-defun, which copies the whole function (at point, that is, point must be inside the function). This works with almost all programming modes, as long as it implements beginning-of-defun and end-of-defun.

<pre>

(defun copy-defun (&optional arg) “Copy function at point into kill-ring” (interactive “P”) (my-blink (get-point ‘beginning-of-defun) (get-point ’end-of-defun)) (kill-ring-save (get-point ‘beginning-of-defun) (get-point ’end-of-defun)) (message “function at point copied”))

(global-set-key (kbd “C-c f”) ‘copy-defun)

↷ 27.05.2016 🠶 #emacs

Emacs screen reader - novel mode

I'm using Xah's novel function for a couple of weeks and found myself enhancing it time and again. Today - yet another day on my way south using the train - I took the opportunity and made a separate mode of the stuff. The result is novel-mode and I'm quite satisfied with it so far.

Novel mode is a minor mode. It makes the current buffer quasi read-only, disabled all distractions (like widgets, mode-line etc), enlarges the font size, line spacing, adds a margin left and right and adds an one key key-map which makes it possible to make dynamic adjustments. There's a GIF demo on the github page. Here are some screenshots:

Bare bones emacs before novel mode is active:

Novel mode activated:

After pressing "h" or "?"

After pressing [right] a couple of times: margins increased

After pressing [+] a couple of times: font size increased

After pressing "i": video display inverted

While I wrote it mostly for myself, I published the mode on github anyway. So if you want to try it out: installation and configurations instructions can be found there.

↷ 24.05.2016 🠶 #emacs