>>> import ansible
>>> ansible.run_module("ping", "*").host_results
{'h2.pdp7.net': {'ping': 'pong', 'invocation': {'module_args': {'data': 'pong'}}, 'ansible_facts': {'discovered_interpreter_python': '/usr/bin/python3'}, '_ansible_no_log': None, 'changed': False}, 'h1.pdp7.net': {'ping': 'pong', 'invocation': {'module_args': {'data': 'pong'}}, 'ansible_facts': {'discovered_interpreter_python': '/usr/bin/python3'}, '_ansible_no_log': None, 'changed': False}}
>>> ansible.command("*", "uptime")
{'h1.pdp7.net': CommandResult(host='h1.pdp7.net', stdout=' 14:44:29 up 10 days, 2:59, 1 user, load average: 0.75, 0.90, 0.72', stderr='', rc=0), 'h2.pdp7.net': CommandResult(host='h2.pdp7.net', stdout=' 14:44:29 up 209 days, 23:39, 1 user, load average: 0.09, 0.11, 0.12', stderr='', rc=0)}
>>> ansible.command("*", "false")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/acorcole/tmp/20231018-ansiblepy/ansible.py", line 29, in command
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
?- [user]. | |
sentence(s(NP,VP)) --> noun_phrase(NP), verb_phrase(VP). | |
noun_phrase(np(D,N)) --> det(D), noun(N). | |
verb_phrase(vp(V,NP)) --> verb(V), noun_phrase(NP). | |
det(d("the")) --> "the". | |
det(d("a")) --> "a". | |
noun(n("bat")) --> "bat". | |
noun(n("cat")) --> "cat". | |
verb(v("eats")) --> "eats". | |
^D |
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 -ue | |
mock --clean | |
function build_gem { | |
echo ..................................................$1 | |
ls $1-*.el8.src.rpm || { | |
! test -d $1 && git clone https://src.fedoraproject.org/rpms/$1.git |
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
package net.pdp7; | |
import java.util.Arrays; | |
import org.asciidoc.intellij.AsciiDocLanguage; | |
import org.asciidoc.intellij.parser.AsciiDocParserDefinition; | |
import org.asciidoc.intellij.psi.AsciiDocASTFactory; | |
import com.google.gson.GsonBuilder; | |
import com.google.gson.JsonArray; |
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
import java.io.File; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.stream.Collectors; | |
import org.asciidoctor.Asciidoctor; | |
import org.asciidoctor.Options; | |
import org.asciidoctor.ast.ContentNode; | |
import org.asciidoctor.ast.Cursor; | |
import org.asciidoctor.ast.List; |
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
import json | |
import boto3 | |
# To use, connect to an API gateway, grant route53 permissions and: | |
# | |
# curl "https://your_api_gateway_host/prod/updateDdns?host_name=host_name_to_update&secret=matching_secret" | |
# | |
# or |