aboutsummaryrefslogtreecommitdiffstats
path: root/config/khard/khard.conf
blob: 509c71bc9a207dd115c973489719ffce6feff7cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# example configuration file for khard version > 0.14.0
# place it under ~/.config/khard/khard.conf
# This file is parsed by the configobj library.  The syntax is described at
# https://configobj.readthedocs.io/en/latest/configobj.html#the-config-file-format

[addressbooks]
[[contacts]]
path = ~/.contacts/contacts/

[general]
debug = no
default_action = list
# These are either strings or comma seperated lists
editor = emacsclient
merge_editor = vimdiff

[contact table]
# display names by first or last name: first_name / last_name / formatted_name
display = formatted_name
# group by address book: yes / no
group_by_addressbook = no
# reverse table ordering: yes / no
reverse = no
# append nicknames to name column: yes / no
show_nicknames = no
# show uid table column: yes / no
show_uids = yes
# sort by first or last name: first_name / last_name / formatted_name
sort = last_name
# localize dates: yes / no
localize_dates = yes
# set a comma separated list of preferred phone number types in descending priority
# or nothing for non-filtered alphabetical order
preferred_phone_number_type = pref, cell, home
# set a comma separated list of preferred email address types in descending priority
# or nothing for non-filtered alphabetical order
preferred_email_address_type = pref, work, home

[vcard]
# extend contacts with your own private objects
# these objects are stored with a leading "X-" before the object name in the vcard files
# every object label may only contain letters, digits and the - character
# example:
#   private_objects = Jabber, Skype, Twitter
# default: ,  (the empty list)
private_objects = Jabber, Skype, Twitter
# preferred vcard version: 3.0 / 4.0
preferred_version = 3.0
# Look into source vcf files to speed up search queries: yes / no
search_in_source_files = no
# skip unparsable vcard files: yes / no
skip_unparsable = no
/span>)) ("(\\w+): (\\w+) ([*+/-]) (\\w+)" line) (setf (gethash monkey table) (list op dep1 dep2)))) ((ppcre:register-groups-bind ((#'read-from-string monkey number)) ("(\\w+): (\\d+)" line) (setf (gethash monkey table) number))))) (defun build-monkey-table (filename) (let ((table (make-hash-table :test #'eq))) (with-open-file (stream filename) (loop for line = (read-line stream nil nil) while line do (parse-line line table))) table)) (defun resolver (entry table) (trivia:match entry ((list op a b) (funcall op (resolver (gethash a table) table) (resolver (gethash b table) table))) (a a))) ;;; part2 (defun human-in-tree-p (name table) (or (eq name 'humn) (trivia:match (gethash name table) ((list _ left right) (or (human-in-tree-p left table) (human-in-tree-p right table)))))) (defun invert-operation (human-lhs-p op target known) (ecase op (+ (- target known)) (- (if human-lhs-p (+ target known) (- known target))) (* (/ target known)) (/ (if human-lhs-p (* target known) (/ known target))))) (defun reverse-solver (entry target table) (destructuring-bind (op left right) entry (let* ((human-lhs-p (human-in-tree-p left table)) (next-entry (if human-lhs-p left right)) (known-term (resolver (gethash (if human-lhs-p right left) table) table)) (new-target (invert-operation human-lhs-p op target known-term))) (if (eq next-entry 'humn) new-target (reverse-solver (gethash next-entry table) new-target table))))) (defun part2 (table) (reverse-solver (cons '- (cdr (gethash 'root table))) 0 table)) ;; solutions (fiveam:test solutions (let ((table (build-monkey-table "eg-in"))) (fiveam:is (= 152 (resolver (gethash 'root table) table))) (fiveam:is (= 301 (part2 table)))) (let ((table (build-monkey-table "input"))) (fiveam:is (= 56490240862410 (resolver (gethash 'root table) table))) (fiveam:is (= 3403989691757 (part2 table)))))