(finally) add thought

This commit is contained in:
gnat 2024-11-03 02:18:52 -08:00
parent 42834bdfd1
commit 8e69079b74
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1 @@
queering the beep/boop binary

View File

@ -0,0 +1,33 @@
<!-- TITLE: {blog,random-thoughts} deprecation -->
<!-- DATE: 2024-10-31 12:43:27 -->
<!-- CATEGORIES: changes to site -->
<!-- vim: ft=html -->
it rewrote the thought viewing interface. it is now comically slow, but a 2.3 second page load time really isn't that bad.
upon seeing the source code for the new interface ($[make-link "/html/view-thought.html"], replacing $[make-link "/html/random-thoughts.html"]), it is sure one will understand why it is so slow.
<pre>
<span class="-punctuation-bracket"><span class="MatchParen">(</span></span><span class="-function-macro">defun</span> <span class="-variable"><span class="-function">html</span></span> <span class="-punctuation-bracket">(</span><span class="-punctuation-bracket">)</span>
<span class="-punctuation-bracket">(</span><span class="-variable">page</span> <span class="String">&quot;$[echo $][test \&quot;$(echo '{' 'thought' '}' | sed 's/ //g')\&quot; != '{thought}' &amp;&amp; echo '{thought}' || echo thoughts index]&quot;</span>
<span class="-string-escape">`</span><span class="-punctuation-bracket">(</span><span class="-variable">section</span> <span class="-punctuation-bracket">(</span><span class="-punctuation-bracket">)</span>
<span class="String">&quot;$[echo $][echo &gt; /tmp/footnote_count]&quot;</span>
<span class="-punctuation-bracket">(</span><span class="-variable">h1</span> <span class="-punctuation-bracket">(</span><span class="SpecialChar"><span class="-punctuation-special">:</span>style</span> <span class="String">&quot;display: $[echo $][test \&quot;$(echo '{' 'thought' '}' | sed 's/ //g')\&quot; != '{thought}' &amp;&amp; echo block || echo none]&quot;</span><span class="-punctuation-bracket">)</span> <span class="String">&quot;$[echo $][cat ./html/thoughts/$(basename '{thought}') | grep '&lt;!-- TITLE:' | sed 's/&lt;!-- TITLE://; s/--&gt;//']&quot;</span><span class="-punctuation-bracket">)</span>
<span class="-punctuation-bracket">(</span><span class="-variable">div</span> <span class="-punctuation-bracket">(</span><span class="SpecialChar"><span class="-punctuation-special">:</span>style</span> <span class="String">&quot;height: 0; margin-top: 5px; justify-content: space-between; align-items: center; display: $[echo $][test \&quot;$(echo '{' 'thought' '}' | sed 's/ //g')\&quot; != '{thought}' &amp;&amp; echo flex || echo none;]&quot;</span><span class="-punctuation-bracket">)</span>
<span class="-punctuation-bracket">(</span><span class="-variable">p</span> <span class="-punctuation-bracket">(</span><span class="-punctuation-bracket">)</span> <span class="String">&quot;$[echo $][cat ./html/thoughts/$(basename '{thought}') | grep '&lt;!-- DATE:' | sed 's/&lt;!-- DATE://; s/--&gt;//']&quot;</span><span class="-punctuation-bracket">)</span>
<span class="-punctuation-bracket">(</span><span class="-variable">p</span> <span class="-punctuation-bracket">(</span><span class="-punctuation-bracket">)</span> <span class="String">&quot;categories: $[echo $][cat ./html/thoughts/$(basename '{thought}') | grep '&lt;!-- CATEGORIES: ' | sed 's/&lt;!-- CATEGORIES: //; s/--&gt;//' | awk -F';' '{ for (i=1; i&lt;=NF; i++) { sub(/^ +| +$/, \&quot;\&quot;, $i); if ($i != \&quot;\&quot;) printf \&quot;&lt;a href=\\\&quot;?filter-category=%s\\\&quot;&gt;%s&lt;/a&gt;, \&quot;, $i, $i } }' | sed 's/, $//']&quot;</span><span class="-punctuation-bracket">)</span><span class="-punctuation-bracket">)</span>
<span class="String">&quot;$[echo $][test \&quot;$(echo '{' 'thought' '}' | sed 's/ //g')\&quot; != '{thought}' &amp;&amp; echo '&lt;br&gt;' || true]&quot;</span>
<span class="-punctuation-bracket">(</span><span class="-variable">div</span> <span class="-punctuation-bracket">(</span><span class="-punctuation-bracket">)</span> <span class="String">&quot;$[echo $][include \&quot;./html/thoughts/$(basename '{thought}')\&quot;]&quot;</span><span class="-punctuation-bracket">)</span>
<span class="String">&quot;$[echo $][test \&quot;$(echo '{' 'thought' '}' | sed 's/ //g')\&quot; != '{thought}' || echo '&lt;h1&gt;posts:&lt;/h1&gt;']&quot;</span>
<span class="String">&quot;$[echo $][test \&quot;$(echo '{' 'filter-category' '}' | sed 's/ //g')\&quot; != '{filter-category}' || test \&quot;$(echo '{' 'thought' '}' | sed 's/ //g')\&quot; != '{thought}' || (ls ./html/thoughts | while read -r file; do echo \&quot;&lt;div&gt;$(cat ./html/thoughts/$file | grep '&lt;!-- DATE:' | sed 's/&lt;!-- DATE://; s/--&gt;//') &lt;a href=?thought=$file&gt;$(cat ./html/thoughts/$file | grep '&lt;!-- TITLE:' | sed 's/&lt;!-- TITLE://; s/--&gt;//')&lt;/a&gt;&lt;br&gt;categories: $(cat ./html/thoughts/$file | grep '&lt;!-- CATEGORIES: ' | sed 's/&lt;!-- CATEGORIES: //; s/--&gt;//' | awk -F';' '{ for (i=1; i&lt;=NF; i++) { sub(/^ +| +$/, \&quot;\&quot;, $i); if ($i != \&quot;\&quot;) printf \&quot;&lt;a href=\\\&quot;?filter-category=%s\\\&quot;&gt;%s&lt;/a&gt;, \&quot;, $i, $i } }' | sed 's/, $//')&lt;/div&gt;\&quot;; done | sort --numeric --reverse)]&quot;</span>
<span class="String">&quot;$[echo $][test \&quot;$(echo '{' 'filter-category' '}' | sed 's/ //g')\&quot; != '{filter-category}' &amp;&amp; test \&quot;$(echo '{' 'thought' '}' | sed 's/ //g')\&quot; != '{thought}' || (ls ./html/thoughts | while read -r file; do grep '&lt;!-- CATEGORIES: ' ./html/thoughts/$file | grep '{filter-category}' &amp;&amp; echo \&quot;&lt;div&gt;$(cat ./html/thoughts/$file | grep '&lt;!-- DATE:' | sed 's/&lt;!-- DATE://; s/--&gt;//') &lt;a href=?thought=$file&gt;$(cat ./html/thoughts/$file | grep '&lt;!-- TITLE:' | sed 's/&lt;!-- TITLE://; s/--&gt;//')&lt;/a&gt;&lt;br&gt;categories: $(cat ./html/thoughts/$file | grep '&lt;!-- CATEGORIES: ' | sed 's/&lt;!-- CATEGORIES: //; s/--&gt;//' | awk -F';' '{ for (i=1; i&lt;=NF; i++) { sub(/^ +| +$/, \&quot;\&quot;, $i); if ($i != \&quot;\&quot;) printf \&quot;&lt;a href=\\\&quot;?filter-category=%s\\\&quot;&gt;%s&lt;/a&gt;, \&quot;, $i, $i } }' | sed 's/, $//')&lt;/div&gt;\&quot;; done | sort --numeric --reverse)]&quot;</span><span class="-punctuation-bracket">)</span><span class="-punctuation-bracket">)</span><span class="-punctuation-bracket"><span class="MatchParen">)</span></span>
</pre>
bash is very slow. they should make bash, but with a JIT compiler. maybe natalie[ee] will invent a syntax for running lua code serverside instead of bash.
it has been thinking of rewriting sludge in lua, anyways.
<hr>
ignoring the prior tangent, it has decided it will never fix the blog. this will function as the new blog (which it is basically doing already). the old thought viewing interface will no longer be maintained, but will probably still mostly function.
<hr>
<pre>
~ λ hyperfine -m30 -M30 'curl https://natalieee.net/html/view-thought.html'
Benchmark 1: curl https://natalieee.net/html/view-thought.html
Time (mean ± σ): 2.354 s ± 0.170 s [User: 0.011 s, System: 0.006 s]
Range (min … max): 2.147 s … 2.964 s 30 runs
</pre>
amusing.