Org-mode is my exocortex, second brain, second mind, mind palace, pensive, personal knowledge management system, and apocrypha. It’s very flexible and the features I use as well as how I organize my files continues to change so I collected things here to document how I do things in 2024, I did this in 2023 as well1. No, my Emacs org-mode configuration is not published. However, if you have some question, just reach out.
I’ve been pretty much living in org-mode for 6 or 7 years now1. It’s my exocortex, second brain, second mind, mind palace, pensive, and personal knowledge management system2. The features and tools I use as well as how I organize my files has changed quite a bit over this period of time and I thought it would be nice give myself (and anyone else who cares) a reference of what it was like in 2023 so here it is.
I think I started getting interested in org-mode in 20071. I definitely was making serious attempts to integrate it into my workflow by 2010. By 2016 it became my primary tool. By primary tool, I mean that most of my daily work is either done from within or at least I’ve probably written down something about what I’ve done in org-mode. Early on, maybe 2009 I found Bernt Hansens Organize you life in plain text!
Do you have any tips on reversing a json dictionary? I have a map of IPv4 addresses to environments and I would like to have a map of environments to IPv4s. 1 2 3 4 5 6 7 { "192.0.2.131" : "TEST-NET-1", "198.51.100.151" : "TEST-NET-2", "198.51.100.146" : "TEST-NET-2", "203.0.113.146" : "TEST-NET-3", "203.0.113.21" : "TEST-NET-3" } Would become: 1 2 3 4 5 6 7 8 9 10 11 12 13 { "TEST-NET-1": [ "192.
How can I use or with a classes type promise where an element is negated with not(). It's not currently possible to use not() directly within an or classes promise since it returns a string and not boolean. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 bundle agent main { vars: "f" string => "/tmp/missing"; classes: "missing" or => { not( fileexists( $(f) ) ) }; "exists" or => { fileexists( $(f) ) }; reports: missing:: "$(f) is missing"; exists:: "$(f) is present"; } Using not() inside a classes or results in syntax error Running the policy results in a syntax error
CFEngine provides the services promise type to manage the state of a given service. By default, bundle agent standard_services is used for the service_method. The standard_services bundle uses the status command and interprets the return codes according to the Linux Standard Base init script actions. Unfortunately some init scripts do not follow the standards. On sysvinit (non-systemd) hosts, if the status command returns zero when a service is not running, cfengine will issue the commands necessary to stop the service every time the agent is run.
Can I access the current KEY when iterating in Mustache? Yes, CFEngine's implementation of mustache includes an extension to be able to access the current key when iterating. @ expands the current key being iterated. This example defines d as a simple json data structure with index-1 and index-2 being top level keys. The mustache template iterates over the entirety of the structure leveraging -top- (another cfengine specific extension to mustache) and prints the key using @.
From #cfengine on irc.freenode.net: How can I clear the POSIX ACLs from a file? To clear the POSIX ACLs from a file, you specify the ACL with no permissions. 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 54 55 56 57 58 bundle agent main { vars: "file" string => "/tmp/myFileWithAces"; files: "$(file)" create => "true"; methods: "Set POSIX ACL and report" usebundle => SetAndReport( $(file) ); "UnSet POSIX ACL and report" usebundle => UnSetAndReport( $(file) ); } bundle agent SetAndReport( file ) { files: "$(file)" acl => my_posix_aces; reports: "In $(this.
How can I execute a command that uses command substitution in CFEngine? On the console I might execute something like this: 1 2 touch /tmp/file-$(date --iso-8601) ls /tmp/file-* /tmp/file-2019-03-08 Example command substitution I recommend not executing commands using substitution. Instead, prepare all that you need up front. Get the result of the data command and put it into a cfengine variable, then use the cfengine variable directly. 1 2 3 4 5 6 7 8 9 10 11 12 bundle agent main { vars: "date" string => execresult( "date --iso-8601=second", useshell ); "command" string => "/usr/bin/touch /tmp/file-$(date)"; "result" string => execresult( $(command), useshell ); reports: "CFEngine $(sys.
What is the -top- extension, and how do I use it in CFEngines Mustache templating method? The -top- extension to the mustache template method, first introduced in CFEngine 3.9.0, is a special key representing the complete data given to the templating engine. This is useful for iterating over the top level of a container {{#-top-}} … {{/-top-}} and rendering json representation of data given with $ and %. Note, when iterating over -top- you can expand the current iterations key with @ and value with .