From 3c00cfd4e803fd27361c8e66b5d3406e38e9e064 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Mon, 28 Feb 2022 13:41:24 -0800 Subject: [PATCH] Internal: markdown extension for adding link attrs More concise than using every time i need to add an attr to a link --- content/_index.md | 8 +++---- content/about/index.md | 4 +--- content/posts/floss-security.md | 6 ++--- layouts/_default/_markup/render-link.html | 15 ++++++++++++ .../functions/parse-title-attribute.html | 23 +++++++++++++++++++ 5 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 layouts/_default/_markup/render-link.html create mode 100644 layouts/partials/functions/parse-title-attribute.html diff --git a/content/_index.md b/content/_index.md index 5c73d75..47750b3 100644 --- a/content/_index.md +++ b/content/_index.md @@ -17,7 +17,7 @@ It me! This is the personal website for , a "rough draft" of this website also exists on my Tildeverse page. This site's content also appears on my Gemini space. +In addition to its [canonical url](https://seirdy.one "{rel='me canonical author' class='u-url'}"), a "rough draft" of this website also exists on my [Tildeverse page](https://envs.net/~seirdy "{itemprop='sameAs' class='u-url' rel='me'}").net/~seirdy" rel="me">Tildeverse page. This site's content also appears on my [Gemini capsule](gemini://seirdy.one "{itemprop='sameAs' class='u-syndication' rel='me'}").one" rel="me">Gemini space. About me -------- @@ -28,14 +28,14 @@ The Director's Cut of my bio is at my [About page](/about.html). I'm a FLOSS enthusiast, software minimalist, and a CS+Math undergrad who likes watching anime and tweaking his Linux setup.

-Git repos: Sourcehut, GitHub, and GitLab +Git repos: [Sourcehut](https://sr.ht/~seirdy "{rel='me'}"), [GitHub](https://github.com/Seirdy "{rel='me'}") , and [GitLab](https://gitlab.com/Seirdy "{rel='me'}") Contact ------- -Contact me via email (PGP), or on the Fediverse where I'm @Seirdy@pleroma.envs.net. +Contact me via [email](mailto:seirdy@seirdy.one "{class='u-email' itemprop='email' rel='me'}") ([PGP](./publickey.asc "{rel='pgpkey authn' type='application/pgp-keys' class='u-key'}")), or on the Fediverse where I'm [@Seirdy@pleroma.envs.net](https://pleroma.envs.net/seirdy "{rel='me' itemprop='sameAs' class='u-url'}"). -Chat with me: I prefer IRC, where my nick is Seirdy on Libera.chat, Snoonet, OFTC, Tilde.Chat, and a few smaller networks. Alternatively, I'm @seirdy:seirdy.one on Matrix. My secondary Matrix account for Synapse-only rooms is `@seirdy:fairydust.space`. I was previously `@seirdy:envs.net`. +Chat with me: I prefer IRC, where my nick is Seirdy on Libera.chat, Snoonet, OFTC, Tilde.Chat, and a few smaller networks. Alternatively, I'm [@seirdy:seirdy.one](https://matrix.to/#/@seirdy:seirdy.one "{class='u-url' rel='me'}") on Matrix. My secondary Matrix account for Synapse-only rooms is `@seirdy:fairydust.space`. I was previously `@seirdy:envs.net`. diff --git a/content/about/index.md b/content/about/index.md index 1199e88..c1796bf 100644 --- a/content/about/index.md +++ b/content/about/index.md @@ -23,8 +23,6 @@ Location (Rohan, meatspace) Currently living at home in Cupertino, CA -Would normally be in Portland, OR during the school year, but COVID-19 happened. - Location (Seirdy, online) ------------------------- @@ -32,7 +30,7 @@ My handle is "Seirdy" on all the platforms I use. - The [Tildeverse](https://envs.net/~seirdy). - Software forges: [Sourcehut](https://sr.ht/~seirdy), [GitHub](https://github.com/Seirdy), [GitLab](https://gitlab.com/Seirdy), and [Codeberg](https://codeberg.org/Seirdy). -- Social (federated): I'm [@Seirdy @pleroma.envs.net](https://pleroma.envs.net/seirdy) on the Fediverse. +- Social (federated): I'm [@Seirdy@pleroma.envs.net](https://pleroma.envs.net/seirdy) on the Fediverse. - Social (non-federated): I'm Seirdy on [Hacker News](https://news.ycombinator.com/user?id=Seirdy), [Lobsters](https://lobste.rs/u/Seirdy), [Reddit](https://www.reddit.com/user/Seirdy/), [Tildes.net](https://tildes.net/user/Seirdy), and Linux Weekly News. - Email: my address is . I typically sign my emails with my public PGP key: [1E892DB2A5F84479](./publickey.asc). My key is also available via WKD. - Chat: for IRC, my nick is Seirdy on Libera.chat, Snoonet, OFTC, Tilde.Chat, and a few smaller networks. I'm also [@seirdy:seirdy.one](https://matrix.to/#/@seirdy:seirdy.one) on Matrix. diff --git a/content/posts/floss-security.md b/content/posts/floss-security.md index d94353f..33a03e7 100644 --- a/content/posts/floss-security.md +++ b/content/posts/floss-security.md @@ -155,9 +155,9 @@ If you want to get started with fuzzing, I recommend checking out [the quick-sta A recent example of how fuzzing helps spot a vulnerability in an open-source project is [CVE-2022-0185](https://www.openwall.com/lists/oss-security/2022/01/18/7): a Linux 0-day found by the Crusaders of Rust a few weeks ago. It was discovered using the [syzkaller](https://github.com/google/syzkaller) kernel fuzzer. The process was documented on Will's Root: - - CVE-2022-0185 - Winning a $31337 Bounty after Pwning Ubuntu and Escaping Google's KCTF Containers by - +

+ CVE-2022-0185 - Winning a $31337 Bounty after Pwning Ubuntu and Escaping Google's KCTF Containers by {{

I _highly_ encourage giving it a read; it's the perfect example of fuzzing with sanitizers to find a vulnerability, reproducing the vulnerability (by writing a tiny C program), _then_ diving into the source code to find and fix the cause, and finally reporting the issue (with a patch!). When source isn't available, the vendor would assume responsibility for the "find and fix" steps. diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html new file mode 100644 index 0000000..4dc2a43 --- /dev/null +++ b/layouts/_default/_markup/render-link.html @@ -0,0 +1,15 @@ +{{- $parsedTitle := dict -}} +{{- with .Title -}} + {{- $parsedTitle = partial "functions/parse-title-attribute.html" . -}} +{{- end -}} + +{{ .Text | safeHTML }} + +{{- /* Strip trailing space. */ -}} diff --git a/layouts/partials/functions/parse-title-attribute.html b/layouts/partials/functions/parse-title-attribute.html new file mode 100644 index 0000000..09832a1 --- /dev/null +++ b/layouts/partials/functions/parse-title-attribute.html @@ -0,0 +1,23 @@ +{{/* Split .Title into two parts, title and attributes. */}} +{{- $parts := split . "{" -}} +{{- $parts = apply $parts "trim" "." " " -}} +{{- $parts = apply $parts "trim" "." "}" -}} + +{{/* Extract title into a string. */}} +{{- $title := index $parts 0 -}} + +{{/* Extract attributes into a dictionary. */}} +{{- $temp := index $parts 1 -}} +{{- $temp = split $temp "'" -}} +{{- $temp = first (sub (len $temp) 1) $temp -}} +{{- $temp = apply $temp "replace" "." "=" "" -}} +{{- $temp = apply $temp "trim" "." " " -}} +{{- $attributes := dict -}} +{{- if $temp -}} + {{- range (seq 0 2 (sub (len $temp) 1)) -}} + {{- $attributes = merge $attributes (dict (index $temp . ) (index $temp (add 1 .))) -}} + {{- end -}} +{{- end -}} + +{{- $parsedTitle := dict "title" $title "attributes" $attributes -}} +{{- return $parsedTitle -}}