feat: man jonathan replaces the journalctl line
This commit is contained in:
1 parent
f848489ae2
commit
950651c152
3 files changed
+146
-68
No files matched your search
@@ -14,8 +14,34 @@ up <span style="color:#f59e0b">7</span> hosts · <span style="color:#f59e0b">76<
|
|||||||
<span style="color:#7c8798"> 5</span> <span style="color:#38bdf8">core </span><span style="color:#7c8798"> 12.902 ms 12.744 ms 12.988 ms</span>
|
<span style="color:#7c8798"> 5</span> <span style="color:#38bdf8">core </span><span style="color:#7c8798"> 12.902 ms 12.744 ms 12.988 ms</span>
|
||||||
<span style="color:#7c8798"> 6</span> <span style="color:#38bdf8">container </span><span style="color:#7c8798"> 13.115 ms 13.002 ms 13.240 ms</span>
|
<span style="color:#7c8798"> 6</span> <span style="color:#38bdf8">container </span><span style="color:#7c8798"> 13.115 ms 13.002 ms 13.240 ms</span>
|
||||||
|
|
||||||
<span style="color:#22c55e">jonathan@core</span>:<span style="color:#38bdf8">~</span><span style="color:#7c8798">$</span> journalctl -u jonathan -n 1 -o cat
|
<span style="color:#22c55e">jonathan@core</span>:<span style="color:#38bdf8">~</span><span style="color:#7c8798">$</span> man jonathan
|
||||||
ci: deploy via Komodo stack webhook, tag images with commit sha</pre>
|
<span style="color:#7c8798">JONATHAN(1) General Commands Manual JONATHAN(1)</span>
|
||||||
|
|
||||||
|
<span style="color:#38bdf8">NAME</span>
|
||||||
|
jonathan - software engineer, mostly self-taught
|
||||||
|
|
||||||
|
<span style="color:#38bdf8">SYNOPSIS</span>
|
||||||
|
jonathan [--homelab] [--family] [--travel]
|
||||||
|
|
||||||
|
<span style="color:#38bdf8">DESCRIPTION</span>
|
||||||
|
Jonathan Branan is a Software Engineer. He is mostly
|
||||||
|
self-taught, though he did attend a vocational class at
|
||||||
|
Rackspace Open Cloud Academy. He has worked for Geek
|
||||||
|
Squad repairing computers, GlobalScape as a Lead of the
|
||||||
|
Client Services department, a Product Owner of MFT
|
||||||
|
applications, and as a Software Engineer at Fortra. He
|
||||||
|
is currently a Technical Support Engineer at Teramind.
|
||||||
|
|
||||||
|
<span style="color:#38bdf8">ENVIRONMENT</span>
|
||||||
|
HOME San Antonio, TX - wife, daughter, two dogs
|
||||||
|
HOBBIES basketball, video games, cooking, camping,
|
||||||
|
kayaking, movies, mixed drinks, Lego
|
||||||
|
TRAVEL frequently, with his wife
|
||||||
|
|
||||||
|
<span style="color:#38bdf8">SEE ALSO</span>
|
||||||
|
git(1), docker(1), journalctl(1)
|
||||||
|
|
||||||
|
<span style="color:#7c8798"> JONATHAN(1)</span></pre>
|
||||||
<!-- terminal:end -->
|
<!-- terminal:end -->
|
||||||
|
|
||||||
<!-- status:start -->
|
<!-- status:start -->
|
||||||
@@ -28,14 +54,14 @@ ci: deploy via Komodo stack webhook, tag images with commit sha</pre>
|
|||||||
|
|
||||||
<!-- working-on:start -->
|
<!-- working-on:start -->
|
||||||
- [**qbit-maid**](https://git.jonb.io/jblu/qbit-maid) — Qbittorrent cleaner that deletes torrents based on age, categories, domains and tags. · `v3.0.0`
|
- [**qbit-maid**](https://git.jonb.io/jblu/qbit-maid) — Qbittorrent cleaner that deletes torrents based on age, categories, domains and tags. · `v3.0.0`
|
||||||
- [**jonbio**](https://git.jonb.io/jblu/jonbio) — TypeScript · updated 27m ago
|
- [**jonbio**](https://git.jonb.io/jblu/jonbio) — TypeScript · updated 46m ago
|
||||||
- [**crane**](https://git.jonb.io/jblu/crane) — App to make sure specified containers are running in portainer
|
- [**crane**](https://git.jonb.io/jblu/crane) — App to make sure specified containers are running in portainer
|
||||||
<!-- working-on:end -->
|
<!-- working-on:end -->
|
||||||
|
|
||||||
## Recent activity
|
## Recent activity
|
||||||
|
|
||||||
<!-- activity:start -->
|
<!-- activity:start -->
|
||||||
- [ci: deploy via Komodo stack webhook, tag images with commit sha](https://git.jonb.io/jblu/jonbio/commit/d2b77e488f85d8e468625ed1a44bfc3b60a62f1f) — jonbio · 19h ago
|
- [ci: deploy via Komodo stack webhook, tag images with commit sha](https://git.jonb.io/jblu/jonbio/commit/d2b77e488f85d8e468625ed1a44bfc3b60a62f1f) — jonbio · 20h ago
|
||||||
- [fix: resolve the seven bugs pinned by the test audit (#67)](https://git.jonb.io/jblu/qbit-maid/commit/cc2d75c7778be19597403b485c1db0236b65797e) — qbit-maid · 15d ago
|
- [fix: resolve the seven bugs pinned by the test audit (#67)](https://git.jonb.io/jblu/qbit-maid/commit/cc2d75c7778be19597403b485c1db0236b65797e) — qbit-maid · 15d ago
|
||||||
- [test: audit suite for meaningfulness, reach 100% coverage (#66)](https://git.jonb.io/jblu/qbit-maid/commit/0c02cd40b057f497917f3cce19ada4b7c00f5886) — qbit-maid · 15d ago
|
- [test: audit suite for meaningfulness, reach 100% coverage (#66)](https://git.jonb.io/jblu/qbit-maid/commit/0c02cd40b057f497917f3cce19ada4b7c00f5886) — qbit-maid · 15d ago
|
||||||
<!-- activity:end -->
|
<!-- activity:end -->
|
||||||
@@ -43,7 +69,7 @@ ci: deploy via Komodo stack webhook, tag images with commit sha</pre>
|
|||||||
## Recent pull requests
|
## Recent pull requests
|
||||||
|
|
||||||
<!-- prs:start -->
|
<!-- prs:start -->
|
||||||
- [ci: deploy via Komodo stack webhook, tag images with commit sha](https://git.jonb.io/jblu/jonbio/pulls/3) — jonbio · 27m ago
|
- [ci: deploy via Komodo stack webhook, tag images with commit sha](https://git.jonb.io/jblu/jonbio/pulls/3) — jonbio · 46m ago
|
||||||
- [fix: resolve the seven bugs pinned by the test audit](https://git.jonb.io/jblu/qbit-maid/pulls/67) — qbit-maid · 15d ago
|
- [fix: resolve the seven bugs pinned by the test audit](https://git.jonb.io/jblu/qbit-maid/pulls/67) — qbit-maid · 15d ago
|
||||||
- [test: audit suite for meaningfulness, reach 100% coverage](https://git.jonb.io/jblu/qbit-maid/pulls/66) — qbit-maid · 15d ago
|
- [test: audit suite for meaningfulness, reach 100% coverage](https://git.jonb.io/jblu/qbit-maid/pulls/66) — qbit-maid · 15d ago
|
||||||
<!-- prs:end -->
|
<!-- prs:end -->
|
||||||
|
|||||||
+17
-56
@@ -161,7 +161,21 @@ def vikunja_done(cfg):
|
|||||||
# ---------------------------------------------------------------- blocks
|
# ---------------------------------------------------------------- blocks
|
||||||
|
|
||||||
|
|
||||||
def terminal_block(cfg, stacks, hosts, journal):
|
def man_block(cfg):
|
||||||
|
"""The about text as a man page: header, sections, footer."""
|
||||||
|
p = cfg["palette"]
|
||||||
|
man = cfg["man"]
|
||||||
|
lines = [f'<span style="color:{p["muted"]}">{man["header"]}</span>']
|
||||||
|
for title, body in man["sections"]:
|
||||||
|
lines.append("")
|
||||||
|
lines.append(f'<span style="color:{p["path"]}">{title}</span>')
|
||||||
|
lines.extend(body)
|
||||||
|
lines.append("")
|
||||||
|
lines.append(f'<span style="color:{p["muted"]}">{man["footer"]}</span>')
|
||||||
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def terminal_block(cfg, stacks, hosts, man):
|
||||||
p = cfg["palette"]
|
p = cfg["palette"]
|
||||||
|
|
||||||
def c(key, text):
|
def c(key, text):
|
||||||
@@ -185,53 +199,10 @@ def terminal_block(cfg, stacks, hosts, journal):
|
|||||||
f'{c("muted", f"{i:2d}")} {c("path", f"{hop["name"]:<18}")}'
|
f'{c("muted", f"{i:2d}")} {c("path", f"{hop["name"]:<18}")}'
|
||||||
f'{c("muted", f"{a:>7.3f} ms {b:>7.3f} ms {d:>7.3f} ms")}'
|
f'{c("muted", f"{a:>7.3f} ms {b:>7.3f} ms {d:>7.3f} ms")}'
|
||||||
)
|
)
|
||||||
lines += ["", f"{prompt} journalctl -u jonathan -n 1 -o cat"]
|
lines += ["", f"{prompt} man jonathan", man]
|
||||||
if journal:
|
|
||||||
lines.append(journal)
|
|
||||||
return "<pre>" + "\n".join(lines) + "</pre>"
|
return "<pre>" + "\n".join(lines) + "</pre>"
|
||||||
|
|
||||||
|
|
||||||
def current_activity(cfg, tok):
|
|
||||||
"""Newest signal of what he is doing: an open Vikunja task or a real commit."""
|
|
||||||
cands = []
|
|
||||||
vtok = os.environ.get("VIKUNJA_TOKEN", "").strip()
|
|
||||||
if vtok:
|
|
||||||
base = cfg["vikunja"]["base"]
|
|
||||||
for proj in cfg["vikunja"].get("activity_projects", [cfg["vikunja"]["project"]]):
|
|
||||||
try:
|
|
||||||
tasks = http_json(
|
|
||||||
f"{base}/api/v1/projects/{proj}/tasks?per_page=100",
|
|
||||||
headers={"Authorization": "Bearer " + vtok},
|
|
||||||
)
|
|
||||||
except Exception:
|
|
||||||
continue
|
|
||||||
for t in tasks:
|
|
||||||
if not t.get("done") and t.get("updated"):
|
|
||||||
cands.append((t["updated"], t["title"]))
|
|
||||||
for name in cfg["featured_repos"]:
|
|
||||||
try:
|
|
||||||
commits = gitea(f"/repos/jblu/{name}/commits?limit=5&stat=false", tok)
|
|
||||||
except Exception:
|
|
||||||
continue
|
|
||||||
for c in commits:
|
|
||||||
msg = c["commit"]["message"].strip()
|
|
||||||
if msg.startswith(("Merge pull request", "Merge PR", "chore: refresh profile README")):
|
|
||||||
continue # merges duplicate the PR block; the refresh is self-referential
|
|
||||||
cands.append((c["commit"]["author"]["date"], msg.splitlines()[0]))
|
|
||||||
if not cands:
|
|
||||||
return None
|
|
||||||
cands.sort(key=lambda x: x[0], reverse=True)
|
|
||||||
return cands[0]
|
|
||||||
|
|
||||||
|
|
||||||
def journal_line(cfg, activity):
|
|
||||||
"""`-o cat` prints the message only, so the line fits the card without wrapping."""
|
|
||||||
if not activity:
|
|
||||||
return ""
|
|
||||||
_, msg = activity
|
|
||||||
return one_line(msg, 70)
|
|
||||||
|
|
||||||
|
|
||||||
def status_block(cfg, up, total):
|
def status_block(cfg, up, total):
|
||||||
p = cfg["palette"]
|
p = cfg["palette"]
|
||||||
ok = up == total
|
ok = up == total
|
||||||
@@ -327,17 +298,7 @@ def build():
|
|||||||
if hosts is None:
|
if hosts is None:
|
||||||
hosts = previous_int(text, r"up (\d+) hosts")
|
hosts = previous_int(text, r"up (\d+) hosts")
|
||||||
|
|
||||||
activity = None
|
apply("terminal", lambda: terminal_block(cfg, stacks, hosts, man_block(cfg)))
|
||||||
try:
|
|
||||||
activity = current_activity(cfg, tok)
|
|
||||||
except Exception as exc:
|
|
||||||
errors.append(f"activity: {type(exc).__name__}: {exc}")
|
|
||||||
if activity is None:
|
|
||||||
# no signal at all: keep the previous card rather than print a stale lie
|
|
||||||
errors.append("activity: no signal, keeping the previous terminal card")
|
|
||||||
else:
|
|
||||||
journal = journal_line(cfg, activity)
|
|
||||||
apply("terminal", lambda: terminal_block(cfg, stacks, hosts, journal))
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
up, total = kuma_counts(cfg)
|
up, total = kuma_counts(cfg)
|
||||||
|
|||||||
+98
-7
@@ -1,5 +1,9 @@
|
|||||||
{
|
{
|
||||||
"featured_repos": ["qbit-maid", "jonbio", "crane"],
|
"featured_repos": [
|
||||||
|
"qbit-maid",
|
||||||
|
"jonbio",
|
||||||
|
"crane"
|
||||||
|
],
|
||||||
"limits": {
|
"limits": {
|
||||||
"activity": 3,
|
"activity": 3,
|
||||||
"prs": 3,
|
"prs": 3,
|
||||||
@@ -17,14 +21,101 @@
|
|||||||
"target": "jonb.io",
|
"target": "jonb.io",
|
||||||
"target_ip": "198.23.237.22",
|
"target_ip": "198.23.237.22",
|
||||||
"hops": [
|
"hops": [
|
||||||
{"name": "internet", "ms": [0.412, 0.388, 0.401]},
|
{
|
||||||
{"name": "cloudflare", "ms": [1.204, 1.188, 1.231]},
|
"name": "internet",
|
||||||
{"name": "pangolin (vps)", "ms": [8.771, 8.640, 8.902]},
|
"ms": [
|
||||||
{"name": "newt tunnel", "ms": [12.338, 12.201, 12.455]},
|
0.412,
|
||||||
{"name": "core", "ms": [12.902, 12.744, 12.988]},
|
0.388,
|
||||||
{"name": "container", "ms": [13.115, 13.002, 13.240]}
|
0.401
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "cloudflare",
|
||||||
|
"ms": [
|
||||||
|
1.204,
|
||||||
|
1.188,
|
||||||
|
1.231
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "pangolin (vps)",
|
||||||
|
"ms": [
|
||||||
|
8.771,
|
||||||
|
8.64,
|
||||||
|
8.902
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "newt tunnel",
|
||||||
|
"ms": [
|
||||||
|
12.338,
|
||||||
|
12.201,
|
||||||
|
12.455
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "core",
|
||||||
|
"ms": [
|
||||||
|
12.902,
|
||||||
|
12.744,
|
||||||
|
12.988
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "container",
|
||||||
|
"ms": [
|
||||||
|
13.115,
|
||||||
|
13.002,
|
||||||
|
13.24
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"man": {
|
||||||
|
"header": "JONATHAN(1) General Commands Manual JONATHAN(1)",
|
||||||
|
"sections": [
|
||||||
|
[
|
||||||
|
"NAME",
|
||||||
|
[
|
||||||
|
" jonathan - software engineer, mostly self-taught"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"SYNOPSIS",
|
||||||
|
[
|
||||||
|
" jonathan [--homelab] [--family] [--travel]"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"DESCRIPTION",
|
||||||
|
[
|
||||||
|
" Jonathan Branan is a Software Engineer. He is mostly",
|
||||||
|
" self-taught, though he did attend a vocational class at",
|
||||||
|
" Rackspace Open Cloud Academy. He has worked for Geek",
|
||||||
|
" Squad repairing computers, GlobalScape as a Lead of the",
|
||||||
|
" Client Services department, a Product Owner of MFT",
|
||||||
|
" applications, and as a Software Engineer at Fortra. He",
|
||||||
|
" is currently a Technical Support Engineer at Teramind."
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"ENVIRONMENT",
|
||||||
|
[
|
||||||
|
" HOME San Antonio, TX - wife, daughter, two dogs",
|
||||||
|
" HOBBIES basketball, video games, cooking, camping,",
|
||||||
|
" kayaking, movies, mixed drinks, Lego",
|
||||||
|
" TRAVEL frequently, with his wife"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"SEE ALSO",
|
||||||
|
[
|
||||||
|
" git(1), docker(1), journalctl(1)"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"footer": " JONATHAN(1)"
|
||||||
|
},
|
||||||
"kuma": {
|
"kuma": {
|
||||||
"base": "https://up.jonb.io/api",
|
"base": "https://up.jonb.io/api",
|
||||||
"page": "homelab"
|
"page": "homelab"
|
||||||
|
|||||||
Reference in new issue
Block a user