Skip to content

Commit

Permalink
Add RSS feed to blog
Browse files Browse the repository at this point in the history
  • Loading branch information
purplesyringa committed Aug 13, 2024
1 parent 55cd14d commit 758a896
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 10 deletions.
6 changes: 6 additions & 0 deletions blog/_index_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
<link rel="stylesheet" type="text/css" href="../blog.css">
<link rel="stylesheet" type="text/css" href="../vendor/Temml-Local.css">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Roboto+Mono:ital,wght@0,100..700;1,100..700&family=Roboto:ital,wght@0,400;0,700;1,400;1,700&family=Slabo+27px&display=swap" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="../fonts/webfont.css">
<link rel="stylesheet" type="text/css" href="../vendor/atom-one-dark.min.css" media="screen and (prefers-color-scheme: dark">
<link rel="stylesheet" type="text/css" href="../vendor/atelier-cave-light.min.css" media="screen and (prefers-color-scheme: light">
<link rel="alternate" type="application/atom+xml" href="/blog/feed.rss" title="Blog posts">
</head>
<body>
<header>
Expand All @@ -28,6 +30,10 @@ <h1><a href="/">purplesyringa</a></h1>

<section>
<div class="viewport-container">
<p>
<a href="/blog/feed.rss"><i class="nf nf-fa-rss_square" title="RSS"></i> Subscribe to RSS</a>
</p>

{{ content }}
</div>
</section>
Expand Down
1 change: 1 addition & 0 deletions blog/_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Roboto+Mono:ital,wght@0,100..700;1,100..700&family=Roboto:ital,wght@0,400;0,700;1,400;1,700&family=Slabo+27px&display=swap" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="{{ root }}/vendor/atom-one-dark.min.css" media="screen and (prefers-color-scheme: dark">
<link rel="stylesheet" type="text/css" href="{{ root }}/vendor/atelier-cave-light.min.css" media="screen and (prefers-color-scheme: light">
<link rel="alternate" type="application/atom+xml" href="{{ root }}/blog/feed.rss" title="Blog posts">
</head>
<body>
<header>
Expand Down
29 changes: 28 additions & 1 deletion blog/build-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const addFromDir = dir => {
const parsedYamlHeader = YAML.parse(yamlHeader);
posts.push({
path: `${dir}/${name}`,
parsedDate: new Date(parsedYamlHeader.time + " UTC"),
...parsedYamlHeader
});
}
Expand All @@ -48,7 +49,7 @@ const addFromDir = dir => {
addFromDir(".");
addFromDir("ru");

posts.sort((a, b) => b.ordering - a.ordering);
posts.sort((a, b) => b.parsedDate - a.parsedDate);

let content = posts.map(post => {
return `
Expand All @@ -69,3 +70,29 @@ html = html.replace(/{{ content }}/g, content);
html = minifyHtml.minify(Buffer.from(html), {});

fs.writeFileSync("index.html", html);

fs.writeFileSync("feed.rss", `<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>purplesyringa's blog</title>
<link>https://purplesyringa.moe/blog/</link>
<description>Posts from purplesyringa's blog.</description>
<copyright>CC BY</copyright>
<managingEditor>[email protected]</managingEditor>
<webMaster>[email protected]</webMaster>
<lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
<docs>https://www.rssboard.org/rss-specification</docs>
<ttl>60</ttl>
${posts.map(post => `
<item>
<title>${escapeHTML(post.title)}</title>
<link>${escapeHTML(`https://purplesyringa.moe/blog/${post.path}/`)}</link>
<description>Here is some text containing an interesting description.</description>
<author>[email protected]</author>
${"" /* <comments>URL to hackernews</comments> */}
<guid>${escapeHTML(`https://purplesyringa.moe/blog/${post.path}/`)}</guid>
<pubDate>${post.parsedDate.toUTCString()}</pubDate>
</item>
`).join("")}
</channel>
</rss>`);
45 changes: 45 additions & 0 deletions blog/feed.rss
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>purplesyringa's blog</title>
<link>https://purplesyringa.moe/blog/</link>
<description>Posts from purplesyringa's blog.</description>
<copyright>CC BY</copyright>
<managingEditor>[email protected]</managingEditor>
<webMaster>[email protected]</webMaster>
<lastBuildDate>Tue, 13 Aug 2024 10:33:06 GMT</lastBuildDate>
<docs>https://www.rssboard.org/rss-specification</docs>
<ttl>60</ttl>

<item>
<title>You might want to use panics for error handling</title>
<link>https://purplesyringa.moe/blog/./you-might-want-to-use-panics-for-error-handling/</link>
<description>Here is some text containing an interesting description.</description>
<author>[email protected]</author>

<guid>https://purplesyringa.moe/blog/./you-might-want-to-use-panics-for-error-handling/</guid>
<pubDate>Tue, 13 Aug 2024 00:00:00 GMT</pubDate>
</item>

<item>
<title>У base64 есть неподвижная точка</title>
<link>https://purplesyringa.moe/blog/ru/base64-has-a-fixed-point/</link>
<description>Here is some text containing an interesting description.</description>
<author>[email protected]</author>

<guid>https://purplesyringa.moe/blog/ru/base64-has-a-fixed-point/</guid>
<pubDate>Sat, 03 Aug 2024 00:00:00 GMT</pubDate>
</item>

<item>
<title>Recovering garbled Bitcoin addresses</title>
<link>https://purplesyringa.moe/blog/./recovering-garbled-bitcoin-addresses/</link>
<description>Here is some text containing an interesting description.</description>
<author>[email protected]</author>

<guid>https://purplesyringa.moe/blog/./recovering-garbled-bitcoin-addresses/</guid>
<pubDate>Tue, 23 Apr 2024 00:00:00 GMT</pubDate>
</item>

</channel>
</rss>
2 changes: 1 addition & 1 deletion blog/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctypehtml><meta charset=utf-8><meta content=width=device-width,initial-scale=1 name=viewport><title>purplesyringa's blog</title><link href=../all.css rel=stylesheet><link href=../blog.css rel=stylesheet><link href=../vendor/Temml-Local.css rel=stylesheet><link crossorigin href=https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Roboto+Mono:ital,wght@0,100..700;1,100..700&family=Roboto:ital,wght@0,400;0,700;1,400;1,700&family=Slabo+27px&display=swap rel=stylesheet><link media="screen and (prefers-color-scheme: dark"href=../vendor/atom-one-dark.min.css rel=stylesheet><link media="screen and (prefers-color-scheme: light"href=../vendor/atelier-cave-light.min.css rel=stylesheet><body><header><div class=viewport-container><div class=media><a href=https://github.com/purplesyringa><img src=../images/github-mark-white.svg></a></div><h1><a href=/>purplesyringa</a></h1><nav><a href=..>about</a><a class=current href>blog</a><a href=../sink/>kitchen sink</a></nav></div></header><section><div class=viewport-container><div class=post-entry><h2><a href=./you-might-want-to-use-panics-for-error-handling/>You might want to use panics for error handling</a></h2><time>August 13, 2024</time><p>Rust’s approach to error handling comes at a cost. The <code>Result</code> type often doesn’t fit in CPU registers, and callers of fallible functions have to check whether the returned value is <code>Ok</code> or <code>Err</code>. That’s a stack spill, a comparison, a branch, and a lot of error handling code intertwined with the hot path that <em>just shouldn’t be here</em>, which inhibits inlining, the most important optimization of all.<p>Exceptions and panics make it easy to forget about the occasional error, but they don’t suffer from inefficiency. Throwing an exception unwinds the stack automatically, without any cooperation from the functions except the one that throws the exception and the one that catches it. Wouldn’t it be <em>neat</em> if a mechanism with the performance of <code>panic!</code> and the ergonomics of <code>Result</code> existed?<p><a href=./you-might-want-to-use-panics-for-error-handling/>Keep reading</a></div><div class=post-entry><h2><a href=ru/base64-has-a-fixed-point/>У base64 есть неподвижная точка</a></h2><time>3 августа, 2024</time><pre><code class=language-shell><span class="hljs-meta prompt_">$ </span><span class=language-bash>&LT/dev/urandom <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> \
<!doctypehtml><meta charset=utf-8><meta content=width=device-width,initial-scale=1 name=viewport><title>purplesyringa's blog</title><link href=../all.css rel=stylesheet><link href=../blog.css rel=stylesheet><link href=../vendor/Temml-Local.css rel=stylesheet><link crossorigin href=https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Roboto+Mono:ital,wght@0,100..700;1,100..700&family=Roboto:ital,wght@0,400;0,700;1,400;1,700&family=Slabo+27px&display=swap rel=stylesheet><link href=../fonts/webfont.css rel=stylesheet><link media="screen and (prefers-color-scheme: dark"href=../vendor/atom-one-dark.min.css rel=stylesheet><link media="screen and (prefers-color-scheme: light"href=../vendor/atelier-cave-light.min.css rel=stylesheet><link title="Blog posts"href=/blog/feed.rss rel=alternate type=application/atom+xml><body><header><div class=viewport-container><div class=media><a href=https://github.com/purplesyringa><img src=../images/github-mark-white.svg></a></div><h1><a href=/>purplesyringa</a></h1><nav><a href=..>about</a><a class=current href>blog</a><a href=../sink/>kitchen sink</a></nav></div></header><section><div class=viewport-container><p><a href=/blog/feed.rss><i class="nf nf-fa-rss_square"title=RSS></i> Subscribe to RSS</a><div class=post-entry><h2><a href=./you-might-want-to-use-panics-for-error-handling/>You might want to use panics for error handling</a></h2><time>August 13, 2024</time><p>Rust’s approach to error handling comes at a cost. The <code>Result</code> type often doesn’t fit in CPU registers, and callers of fallible functions have to check whether the returned value is <code>Ok</code> or <code>Err</code>. That’s a stack spill, a comparison, a branch, and a lot of error handling code intertwined with the hot path that <em>just shouldn’t be here</em>, which inhibits inlining, the most important optimization of all.<p>Exceptions and panics make it easy to forget about the occasional error, but they don’t suffer from inefficiency. Throwing an exception unwinds the stack automatically, without any cooperation from the functions except the one that throws the exception and the one that catches it. Wouldn’t it be <em>neat</em> if a mechanism with the performance of <code>panic!</code> and the ergonomics of <code>Result</code> existed?<p><a href=./you-might-want-to-use-panics-for-error-handling/>Keep reading</a></div><div class=post-entry><h2><a href=ru/base64-has-a-fixed-point/>У base64 есть неподвижная точка</a></h2><time>August 3, 2024</time><pre><code class=language-shell><span class="hljs-meta prompt_">$ </span><span class=language-bash>&LT/dev/urandom <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> \
| <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> \
| <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>head</span> -1</span>
Vm0wd2QyUXlVWGxWV0d4V1YwZDRWMVl3WkRSV01WbDNXa1JTVjAxV2JETlhhMUpUVmpBeFYySkVU
Expand Down
2 changes: 1 addition & 1 deletion blog/recovering-garbled-bitcoin-addresses/index.html

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion blog/recovering-garbled-bitcoin-addresses/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: Recovering garbled Bitcoin addresses
time: April 23, 2024
ordering: 1
intro: |
[ZeroNet](https://zeronet.io/) is a decentralized network that enables dynamic sites, such as blogs and forums, unlike popular content-addressed storage networks that came later. Sites aren't addressed by immutable hashes; instead, site updates are signed by Bitcoin addresses.
Expand Down
2 changes: 1 addition & 1 deletion blog/ru/base64-has-a-fixed-point/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctypehtml><meta charset=utf-8><meta content=width=device-width,initial-scale=1 name=viewport><title>У base64 есть неподвижная точка | purplesyringa's blog</title><link href=../../../all.css rel=stylesheet><link href=../../../blog.css rel=stylesheet><link href=../../../vendor/Temml-Local.css rel=stylesheet><link crossorigin href=https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Roboto+Mono:ital,wght@0,100..700;1,100..700&family=Roboto:ital,wght@0,400;0,700;1,400;1,700&family=Slabo+27px&display=swap rel=stylesheet><link media="screen and (prefers-color-scheme: dark"href=../../../vendor/atom-one-dark.min.css rel=stylesheet><link media="screen and (prefers-color-scheme: light"href=../../../vendor/atelier-cave-light.min.css rel=stylesheet><body><header><div class=viewport-container><div class=media><a href=https://github.com/purplesyringa><img src=../../../images/github-mark-white.svg></a></div><h1><a href=/>purplesyringa</a></h1><nav><a href=../../..>about</a><a class=current href=../../../blog/>blog</a><a href=../../../sink/>kitchen sink</a></nav></div></header><section><div class=viewport-container><h2>У base64 есть неподвижная точка</h2><time>3 августа, 2024</time><p><em>Пост написан по мотивам <a href=https://www.reddit.com/r/compsci/comments/18234a/the_base64_encoder_has_a_fixed_point/>давнего треда на Reddit</a>.</em><pre><code class=language-shell><span class="hljs-meta prompt_">$ </span><span class=language-bash>&LT/dev/urandom <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> \
<!doctypehtml><meta charset=utf-8><meta content=width=device-width,initial-scale=1 name=viewport><title>У base64 есть неподвижная точка | purplesyringa's blog</title><link href=../../../all.css rel=stylesheet><link href=../../../blog.css rel=stylesheet><link href=../../../vendor/Temml-Local.css rel=stylesheet><link crossorigin href=https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Roboto+Mono:ital,wght@0,100..700;1,100..700&family=Roboto:ital,wght@0,400;0,700;1,400;1,700&family=Slabo+27px&display=swap rel=stylesheet><link media="screen and (prefers-color-scheme: dark"href=../../../vendor/atom-one-dark.min.css rel=stylesheet><link media="screen and (prefers-color-scheme: light"href=../../../vendor/atelier-cave-light.min.css rel=stylesheet><link title="Blog posts"href=../../../blog/feed.rss rel=alternate type=application/atom+xml><body><header><div class=viewport-container><div class=media><a href=https://github.com/purplesyringa><img src=../../../images/github-mark-white.svg></a></div><h1><a href=/>purplesyringa</a></h1><nav><a href=../../..>about</a><a class=current href=../../../blog/>blog</a><a href=../../../sink/>kitchen sink</a></nav></div></header><section><div class=viewport-container><h2>У base64 есть неподвижная точка</h2><time>August 3, 2024</time><p><em>Пост написан по мотивам <a href=https://www.reddit.com/r/compsci/comments/18234a/the_base64_encoder_has_a_fixed_point/>давнего треда на Reddit</a>.</em><pre><code class=language-shell><span class="hljs-meta prompt_">$ </span><span class=language-bash>&LT/dev/urandom <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> \
| <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>base64</span> \
| <span class=hljs-built_in>base64</span> | <span class=hljs-built_in>head</span> -1</span>
Vm0wd2QyUXlVWGxWV0d4V1YwZDRWMVl3WkRSV01WbDNXa1JTVjAxV2JETlhhMUpUVmpBeFYySkVU
Expand Down
3 changes: 1 addition & 2 deletions blog/ru/base64-has-a-fixed-point/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: У base64 есть неподвижная точка
time: 3 августа, 2024
ordering: 2
time: August 3, 2024
intro: |
```shell
$ </dev/urandom base64 | base64 | base64 | base64 | base64 | base64 | base64 | base64 | base64 \
Expand Down
Loading

0 comments on commit 758a896

Please sign in to comment.