This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun msg (arg) | |
(message (format "%S" arg))) | |
(server-start) | |
(blink-cursor-mode 0) | |
(tool-bar-mode -1) | |
(setq column-number-mode t) | |
(show-paren-mode 1) | |
(setq-default blink-matching-paren nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
set -eu | |
annex () | |
{ | |
local option | |
local OPTARG | |
local OPTIND | |
local recursive= | |
local user=${SUDO_UID:-$(id -ru)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sort the rows of a table body by the given column. | |
function sorttable (table, column) { | |
var trs = []; | |
var tbody = table.querySelector ('tbody'); | |
for (var tr of tbody.querySelectorAll ('tr')) { | |
trs.push(tr.cloneNode(true)); | |
tbody.removeChild(tr); | |
} | |
trs.sort(function(r1 ,r2) { | |
var c1 = r1.querySelectorAll('td').item(column).innerText; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
## | |
## This converts the output of the `ansible` command into valid JSON, | |
## which can be processed by `jq`. | |
## | |
echo \[ | |
sed 's/^\(.*\) | \(.*\) => {/{\n "hostname": "\1",\n "result": "\2",/' | | |
sed '$ ! s/^}/},/' | |
echo \] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Convert a CPS function into a normal function by passing a | |
;; function, which returns just the argument, as a continuation to the | |
;; CPS function. | |
(define (ret x) x) | |
(define (cps f/k) (lambda (x) (f/k x ret))) | |
;; Some test values. | |
(define digits (list 0 1 2 3 4 5 6 7 8 9)) | |
;; Factorial |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; The following code uses two function types: `parsers` and `continuations`. The `parser` functions | |
;; require three arguments: `input`, `continue` and `backtrack`. The `continuation` functions | |
;; require just one argument `input`. The argument `input` is the list of input tokens to parse. | |
;; The arguments `continue` and `backtrack` are continuations. The continuation `continue` is | |
;; followed, when the tried parsing solution up the to current point is correct, which means that it | |
;; is not sure but it might lead to a overall success. And `backtrack` is used, if a missmatch has | |
;; been found, which means that an alternative parsing solution must be tried. The process is | |
;; similar to finding the way out of a maze. | |
;; Throw an error, if the assertion fails. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun expand-character (expansion c) | |
(if (null expansion) | |
(list (list c)) | |
(mapcar (lambda (item) | |
(cons c item)) ;; This reverses the string. | |
expansion))) | |
(defun expand-sequence (expansion p q) | |
(apply #'append | |
(mapcar (lambda (c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/perl | |
my $rs = shift; | |
my $rx = qr/$rs/; | |
for (@ARGV) { | |
exit 1 unless /$rx/; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
set -eu | |
cat <<EOF > "$HOME"/.bashrc | |
[ -z "$PS1" ] && return | |
shopt -s histappend | |
shopt -s checkwinsize | |
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" | |
alias ll='ls -l' | |
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
## | |
## Display added and deleted files in a Fossil repository. | |
## | |
set -eu | |
prev_id= | |
fossil timeline -n 0 "$@" | | |
sed -n 's/^..:..:.. \[\([0-9a-f]*\)\] .*/\1/p' | | |
while read id; do | |
if [ "$prev_id" ]; then |