Skip to content

Instantly share code, notes, and snippets.

import collections
import queue
import time
from waflib import Runner, Task
TaskEvent = collections.namedtuple("TaskEvent", "id start end task outputs".split())
def monkey_patch():
prev_start = Runner.Parallel.start
def start(self):
@kljohann
kljohann / eg.bash
Last active December 5, 2018 21:04
#!/bin/bash
main () {
declare expression="^EXAMPLE"
declare -a args
args=("$@")
if (( $# == 0 )); then
cat >&2 <<END
Usage: $0 [<args>...] [<expr>]
#!/usr/bin/python3
from pathlib import Path
import shlex
import subprocess
import sys
OPERATIONS = (
("merge", "MERGE_HEAD"),
@kljohann
kljohann / eg.zsh
Created July 29, 2018 10:20
eg.zsh
eg () {
(( $+1 )) || {
cat >&2 <<END
Usage: $0 [<args>...] [<expr>]
args: Arguments to pass to man.
expr: Command line argument to search for.
Defaults to jump to the "EXAMPLE" section.
Examples:
cmake -GNinja .. -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DLLVM_USE_LINKER=gold -DBUILD_SHARED_LIBS=ON -DLLVM_USE_SPLIT_DWARF=ON -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_PARALLEL_LINK_JOBS=2 -DLLVM_USE_SPLIT_DWARF=ON -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_INSTALL_PREFIX=$HOME/llvm -DCMAKE_BUILD_TYPE=Debug
#!/bin/zsh
setopt local_options err_exit warn_create_global
this_cmd=$0:t
usage () {
echo -e "Usage: $this_cmd [OPTION]... [NAME] [--] [COMMANDS]...\n" 1>&2
cat 1>&2 <<END
Arguments:
NAME Name of the (parent) session to attach to.
include "/usr/share/X11/locale/en_US.UTF-8/Compose"
include "/home/jk/.XCompose.base"
include "/home/jk/.XCompose.math"
<Multi_key> <ISO_Level5_Shift> <elementof> <elementof> : "∋" U220B
<Multi_key> <slash> <ISO_Level5_Shift> <elementof> <elementof> : "∌" U220C
<Multi_key> <slash> <ISO_Level5_Shift> <elementof> <space> : "∉" U2209
<Multi_key> <slash> <ISO_Level5_Shift> <U2203> : "∄" U2204
<Multi_key> <ISO_Level5_Shift> <integral> <o> : "∮" U222E
<Multi_key> <o> <ISO_Level5_Shift> <integral> : "∮" U222E
Xcursor.theme: neutral
! See also fonts.conf
! https://wiki.archlinux.org/index.php/Font_Configuration
! http://www.lagom.nl/lcd-test/subpixel.php
Xft.hinting: true
Xft.hintstyle: hintfull
Xft.lcdfilter: lcddefault
Xft.rgba: rgb
[core]
excludesfile = ~/.gitignore
whitespace = trailing-space,space-before-tab
[color]
ui = auto
[push]
default = upstream
@kljohann
kljohann / split_transactions.py
Last active June 10, 2022 22:44
split transactions by posting date (beancount)
__author__ = "Johann Klähn <[email protected]>"
import collections
import math
import itertools
import datetime
from beancount.core import data
from beancount.core.interpolate import balance_incomplete_postings