From 65e681742d27c222d97a879876028453f2b3df9d Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Wed, 21 Feb 2024 11:40:55 +0000 Subject: [PATCH] Replace link with sources, and actually show them --- docs/notes/database/long-running-queries.md | 3 ++- docs/notes/database/redis-monitor.md | 3 +-- docs/notes/database/running-queries.md | 3 ++- docs/notes/infrastructure/assume-role-credentials.md | 3 ++- docs/notes/infrastructure/cross-account-transfer.md | 4 +++- docs/notes/mitm-port-forward.md | 3 ++- docs/notes/rebase-onto.md | 3 ++- docs/notes/shell/ffmpeg-downmixing-audio.md | 3 ++- docs/notes/shell/ffmpeg-remove-stream.md | 3 ++- hooks/notes.py | 4 ++++ theme/main.html | 8 ++++++++ 11 files changed, 30 insertions(+), 10 deletions(-) diff --git a/docs/notes/database/long-running-queries.md b/docs/notes/database/long-running-queries.md index 182790e..99dacb5 100644 --- a/docs/notes/database/long-running-queries.md +++ b/docs/notes/database/long-running-queries.md @@ -2,7 +2,8 @@ title: Find and kill long running queries tags: - PostgreSQL -link: https://medium.com/little-programming-joys/finding-and-killing-long-running-queries-on-postgres-7c4f0449e86d +sources: + - https://medium.com/little-programming-joys/finding-and-killing-long-running-queries-on-postgres-7c4f0449e86d --- # Running queries diff --git a/docs/notes/database/redis-monitor.md b/docs/notes/database/redis-monitor.md index e9225c4..992c427 100644 --- a/docs/notes/database/redis-monitor.md +++ b/docs/notes/database/redis-monitor.md @@ -2,10 +2,9 @@ title: Monitor redis commands tags: - Redis -link: https://redis.io/commands/monitor/ --- It's often useful to view what Redis is working on. 1. Connect to redis -2. `MONITOR` +2. [`MONITOR`](https://redis.io/commands/monitor/) diff --git a/docs/notes/database/running-queries.md b/docs/notes/database/running-queries.md index 2ab1968..d07cb5d 100644 --- a/docs/notes/database/running-queries.md +++ b/docs/notes/database/running-queries.md @@ -2,7 +2,8 @@ title: Monitor running queries tags: - PostgreSQL -link: https://techmango.org/2017/11/04/monitor-running-queries-postgresql/ +sources: + - https://techmango.org/2017/11/04/monitor-running-queries-postgresql/ --- View a list of running queries: diff --git a/docs/notes/infrastructure/assume-role-credentials.md b/docs/notes/infrastructure/assume-role-credentials.md index 6061cbe..489a86d 100644 --- a/docs/notes/infrastructure/assume-role-credentials.md +++ b/docs/notes/infrastructure/assume-role-credentials.md @@ -2,7 +2,8 @@ title: Get credentials for an assumed role tags: - AWS -link: https://aws.amazon.com/premiumsupport/knowledge-center/iam-assume-role-cli/ +sources: + - https://aws.amazon.com/premiumsupport/knowledge-center/iam-assume-role-cli/ --- It's often useful to get regular access keys as if you were assumed into another role. This is possible: diff --git a/docs/notes/infrastructure/cross-account-transfer.md b/docs/notes/infrastructure/cross-account-transfer.md index a5e0b72..62a4067 100644 --- a/docs/notes/infrastructure/cross-account-transfer.md +++ b/docs/notes/infrastructure/cross-account-transfer.md @@ -2,7 +2,9 @@ title: Cross-account data transfer tags: - AWS -link: https://aws.amazon.com/premiumsupport/knowledge-center/cross-account-access-s3/ +sources: + - https://aws.amazon.com/premiumsupport/knowledge-center/cross-account-access-s3/ + - https://stackoverflow.com/a/63804619 --- To copy bucket contents from a bucket in account A to a bucket in account B: diff --git a/docs/notes/mitm-port-forward.md b/docs/notes/mitm-port-forward.md index bf6a92c..1d8e599 100644 --- a/docs/notes/mitm-port-forward.md +++ b/docs/notes/mitm-port-forward.md @@ -2,9 +2,10 @@ title: Simple reverse proxy tags: - Networking -link: https://docs.mitmproxy.org/stable --- +This uses [`mitmproxy`](https://docs.mitmproxy.org/stable), which can proxy both HTTP and HTTPS. + ``` mitmproxy --mode reverse:http://localhost:8000 ``` diff --git a/docs/notes/rebase-onto.md b/docs/notes/rebase-onto.md index b3f8dca..a935b3c 100644 --- a/docs/notes/rebase-onto.md +++ b/docs/notes/rebase-onto.md @@ -2,7 +2,6 @@ title: Rebase commits done on the wrong branch tags: - Git -link: https://git-scm.com/book/en/v2/Git-Branching-Rebasing#_more_interesting_rebases --- ```sh @@ -10,3 +9,5 @@ git rebase --onto master server client ``` > Take the `client` branch, figure out the patches since it diverged from the `server` branch, and replay these patches in the client branch as if it was based directly off the `master` branch instead. + +See also ["more interesting rebases"](https://git-scm.com/book/en/v2/Git-Branching-Rebasing#_more_interesting_rebases) diff --git a/docs/notes/shell/ffmpeg-downmixing-audio.md b/docs/notes/shell/ffmpeg-downmixing-audio.md index afcecd4..621821c 100644 --- a/docs/notes/shell/ffmpeg-downmixing-audio.md +++ b/docs/notes/shell/ffmpeg-downmixing-audio.md @@ -2,7 +2,8 @@ title: Downmixing audio channels tags: - Media -link: https://trac.ffmpeg.org/wiki/AudioChannelManipulation +sources: + - https://trac.ffmpeg.org/wiki/AudioChannelManipulation --- ```bash diff --git a/docs/notes/shell/ffmpeg-remove-stream.md b/docs/notes/shell/ffmpeg-remove-stream.md index 76015db..4f65248 100644 --- a/docs/notes/shell/ffmpeg-remove-stream.md +++ b/docs/notes/shell/ffmpeg-remove-stream.md @@ -2,7 +2,8 @@ title: Strip audio / subtitle stream with ffmpeg tags: - Media -link: https://stackoverflow.com/a/38162168 +sources: + - https://stackoverflow.com/a/38162168 --- ```bash diff --git a/hooks/notes.py b/hooks/notes.py index 7cf9f4e..5b6c39d 100644 --- a/hooks/notes.py +++ b/hooks/notes.py @@ -1,5 +1,6 @@ import jinja2 from mkdocs.structure.nav import Navigation +from urllib.parse import urlparse @jinja2.pass_context def get_page(context, slug): @@ -25,8 +26,11 @@ def get_notes(context): return sorted(notes, key=lambda p: p.meta["git_creation_date_localized_raw_iso_date"], reverse=True) +def get_domain(url): + return urlparse(url).netloc def on_env(env, config, files): env.tests["startswith"] = str.startswith env.globals["get_page"] = get_page env.globals["get_notes"] = get_notes + env.filters["domain"] = get_domain diff --git a/theme/main.html b/theme/main.html index 4aec1c1..fecae3f 100644 --- a/theme/main.html +++ b/theme/main.html @@ -30,3 +30,11 @@ GitHub . {% endblock %} + +{% block content %} + {{ super() }} + + {% if page.meta.sources %} + Sources: {% for source in page.meta.sources %}{{ source|domain }}{% endfor %} + {% endif %} +{% endblock %}