aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/posts/WPA_woes.html68
-rw-r--r--docs/posts/bash_harder_with_vim.html84
-rw-r--r--docs/posts/bye_bye_BDFs.html51
-rw-r--r--docs/posts/color_conundrum.html62
-rw-r--r--docs/posts/get_better_at_yanking_and_putting_in_vim.html48
-rw-r--r--docs/posts/hold_position!.html47
-rw-r--r--docs/posts/my_setup.html52
-rw-r--r--docs/posts/onivim_sucks.html53
-rw-r--r--docs/posts/static_sites_with_bash.html74
-rwxr-xr-xgenerate.sh38
10 files changed, 558 insertions, 19 deletions
diff --git a/docs/posts/WPA_woes.html b/docs/posts/WPA_woes.html
new file mode 100644
index 0000000..f4f8d8e
--- /dev/null
+++ b/docs/posts/WPA_woes.html
@@ -0,0 +1,68 @@
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <link rel="stylesheet" href="/style.css">
5 <meta charset="UTF-8">
6 <meta name="viewport" content="initial-scale=1">
7 <meta content="#ffffff" name="theme-color">
8 <meta name="HandheldFriendly" content="true">
9 <meta property="og:title" content="nerdypepper">
10 <meta property="og:type" content="website">
11 <meta property="og:description" content="a static site {for, by, about} me ">
12 <meta property="og:url" content="https://nerdypepper.tech">
13 <body>
14 <div class="post posts">
15 <div class="date">12/10 2019</div>
16 <span style="font-size: 2rem; font-weight: 600">
17 WPA Woes
18 </span>
19 <div class="post-text">
20 <p>I finally got around to installing Void GNU/Linux on my main
21computer. Rolling release, non-systemd, need I say more?</p>
22
23<p>As with all GNU/Linux distributions, wireless networks had
24me in a fix. If you can see this post, it means I&#8217;ve managed
25to get online. It turns out, <code>wpa_supplicant</code> was detecting the
26wrong interface by default (does it ever select the right
27one?). Let us fix that:</p>
28
29<pre><code>$ sudo rm -r /var/service/wpa_supplicant
30$ sudo killall dhcpcd
31</code></pre>
32
33<p>What is the right interface though?</p>
34
35<pre><code>$ iw dev
36 ...
37 Interface wlp2s0
38 ...
39</code></pre>
40
41<p>Aha! Let us run <code>wpa_supplicant</code> on that interface, as a
42background process:</p>
43
44<pre><code>$ sudo wpa_supplicant -B -i wlp2s0 -c /etc/wpa_supplicant/wpa_supplicant.conf
45$ sudo dhcpcd -B wlp2s0
46$ ping google.com
47PING ...
48</code></pre>
49
50<p>Yay! Make those changes perpetual by enabling the service:</p>
51
52<pre><code>------------------------------------------------------
53# Add these to /etc/wpa_supplicant/wpa_supplicant.conf
54OPTS=&quot;-B&quot;
55WPA_INTERFACE=&quot;wlp2s0&quot;
56------------------------------------------------------
57$ sudo ln -s /etc/sv/wpa_supplicant /var/service/
58$ sudo ln -s /etc/sv/dhcpcd /var/service/
59$ sudo sv restart wpa_supplicant
60$ sudo sv restart dhcpcd
61</code></pre>
62
63 </div>
64 <a href="/index.html" class="post-end-link">‹ Back</a>
65 <div class="separator"></div>
66 </div>
67 </body>
68</html>
diff --git a/docs/posts/bash_harder_with_vim.html b/docs/posts/bash_harder_with_vim.html
new file mode 100644
index 0000000..6e0f9bd
--- /dev/null
+++ b/docs/posts/bash_harder_with_vim.html
@@ -0,0 +1,84 @@
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <link rel="stylesheet" href="/style.css">
5 <meta charset="UTF-8">
6 <meta name="viewport" content="initial-scale=1">
7 <meta content="#ffffff" name="theme-color">
8 <meta name="HandheldFriendly" content="true">
9 <meta property="og:title" content="nerdypepper">
10 <meta property="og:type" content="website">
11 <meta property="og:description" content="a static site {for, by, about} me ">
12 <meta property="og:url" content="https://nerdypepper.tech">
13 <body>
14 <div class="post posts">
15 <div class="date">31/07 2019</div>
16 <span style="font-size: 2rem; font-weight: 600">
17 Bash Harder With Vim
18 </span>
19 <div class="post-text">
20 <p>Bash is tricky, don&#8217;t let your editor get in your way. Here&#8217;s a couple of neat
21additions you could make to your <code>vimrc</code> for a better shell programming
22experience.</p>
23
24<hr/>
25
26<h4 id="Man%20pages%20inside%20vim">Man pages inside vim</h4>
27
28<p>Source this script to get started: </p>
29
30<pre><code>runtime ftplugin/man.vim
31</code></pre>
32
33<p>Now, you can open manpages inside vim with <code>:Man</code>! It adds nicer syntax highlighting
34and the ability to jump around with <code>Ctrl-]</code> and <code>Ctrl-T</code>.</p>
35
36<p>By default, the manpage is opened in a horizontal split, I prefer using a new tab:</p>
37
38<pre><code>let g:ft_man_open_mode = &#39;tab&#39;
39</code></pre>
40
41<hr/>
42
43<h4 id="Scratchpad%20to%20test%20your%20commands">Scratchpad to test your commands</h4>
44
45<p>I often test my <code>sed</code> substitutions, here is
46a sample from the script used to generate this site: </p>
47
48<pre><code># a substitution to convert snake_case to Title Case With Spaces
49echo &quot;$1&quot; | sed -E -e &quot;s/\..+$//g&quot; -e &quot;s/_(.)/ \u\1/g&quot; -e &quot;s/^(.)/\u\1/g&quot;
50</code></pre>
51
52<p>Instead of dropping into a new shell, just test it out directly from vim!</p>
53
54<ul>
55<li><p>Yank the line into a register:</p>
56
57<pre><code>yy
58</code></pre></li>
59<li><p>Paste it into the command-line window:</p>
60
61<pre><code>q:p
62</code></pre></li>
63<li><p>Make edits as required:</p>
64
65<pre><code>syntax off # previously run commands
66edit index.html # in a buffer!
67w | so %
68!echo &quot;new_post.md&quot; | sed -E -e &quot;s/\..+$//g&quot; --snip--
69^--- note the use of &#39;!&#39;
70</code></pre></li>
71<li><p>Hit enter with the cursor on the line containing your command!</p>
72
73<pre><code>$ vim
74New Post # output
75Press ENTER or type command to continue
76</code></pre></li>
77</ul>
78
79 </div>
80 <a href="/index.html" class="post-end-link">‹ Back</a>
81 <div class="separator"></div>
82 </div>
83 </body>
84</html>
diff --git a/docs/posts/bye_bye_BDFs.html b/docs/posts/bye_bye_BDFs.html
new file mode 100644
index 0000000..e323c9d
--- /dev/null
+++ b/docs/posts/bye_bye_BDFs.html
@@ -0,0 +1,51 @@
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <link rel="stylesheet" href="/style.css">
5 <meta charset="UTF-8">
6 <meta name="viewport" content="initial-scale=1">
7 <meta content="#ffffff" name="theme-color">
8 <meta name="HandheldFriendly" content="true">
9 <meta property="og:title" content="nerdypepper">
10 <meta property="og:type" content="website">
11 <meta property="og:description" content="a static site {for, by, about} me ">
12 <meta property="og:url" content="https://nerdypepper.tech">
13 <body>
14 <div class="post posts">
15 <div class="date">07/08 2019</div>
16 <span style="font-size: 2rem; font-weight: 600">
17 Bye Bye BDFs
18 </span>
19 <div class="post-text">
20 <p>Glyph Bitmap Distribution Format is no more, as the creators of
21<a href="https://pango.org">Pango</a>, one of the most widely used text rendering
22libraries,
23<a href="https://blogs.gnome.org/mclasen/2019/05/25/pango-future-directions/">announced</a>
24their plans for Pango 1.44.</p>
25
26<p>Until recently, Pango used FreeType to draw fonts. They will be moving over
27to <a href="https://harfbuzz.org">Harfbuzz</a>, an evolution of FreeType.</p>
28
29<p><em>Why?</em></p>
30
31<p>In short, FreeType was hard to work with. It required complex logic, and
32provided no advantage over Harfbuzz (other than being able to fetch
33opentype metrics with ease).</p>
34
35<p>Upgrading to Pango v1.44 will break your GTK applications (if you use a
36<code>bdf</code>/<code>pcf</code> bitmap font). Harfbuzz <em>does</em> support bitmap-only OpenType fonts,
37<code>otb</code>s. Convert your existing fonts over to <code>otb</code>s using
38<a href="https://fontforge.github.io">FontForge</a>. It is to be noted that applications
39such as <code>xterm</code> and <code>rxvt</code> use <code>xft</code> (X FreeType) to render fonts, and will
40remain unaffected by the update.</p>
41
42<p>Both <a href="https://github.com/nerdypepper/scientifica">scientifica</a> and
43<a href="https://github.com/nerdypepper/curie">curie</a> will soon ship with bitmap-only
44OpenType font formats.</p>
45
46 </div>
47 <a href="/index.html" class="post-end-link">‹ Back</a>
48 <div class="separator"></div>
49 </div>
50 </body>
51</html>
diff --git a/docs/posts/color_conundrum.html b/docs/posts/color_conundrum.html
new file mode 100644
index 0000000..979dc9c
--- /dev/null
+++ b/docs/posts/color_conundrum.html
@@ -0,0 +1,62 @@
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <link rel="stylesheet" href="/style.css">
5 <meta charset="UTF-8">
6 <meta name="viewport" content="initial-scale=1">
7 <meta content="#ffffff" name="theme-color">
8 <meta name="HandheldFriendly" content="true">
9 <meta property="og:title" content="nerdypepper">
10 <meta property="og:type" content="website">
11 <meta property="og:description" content="a static site {for, by, about} me ">
12 <meta property="og:url" content="https://nerdypepper.tech">
13 <body>
14 <div class="post posts">
15 <div class="date">31/12 2019</div>
16 <span style="font-size: 2rem; font-weight: 600">
17 Color Conundrum
18 </span>
19 <div class="post-text">
20 <p>This piece aims to highlight (pun intended) some of the
21reasons behind my <a href="https://files.nerdypepper.tech/bF.png">color
22free</a> editor setup.</p>
23
24<p>Imagine highlighting an entire book because <em>all</em> of it is
25important. That is exactly what (most) syntax highlighting
26does. It is difficult for the human eye to filter out noise
27in rainbow barf. Use color to draw attention, not diverge
28it.</p>
29
30<p>At the same time, a book devoid of color is <em>boring!</em> What
31is the takeaway from this 10 line paragraph? What are the
32technical terms used?</p>
33
34<p>Prose and code are certainly different, but the fickle
35minded human eye is the same. The eye constantly looks for a
36frame of reference, a focal point. It grows tired when it
37can&#8217;t find one.</p>
38
39<p>The following comparison does a better job of explaining
40(none, ample and over-the-top highlighting, from left to
41right):</p>
42
43<p><a href="https://files.nerdypepper.tech/lt.png"><img src="https://files.nerdypepper.tech/lt.png" alt="hi.png" /></a></p>
44
45<p>Without highlighting (far left), it is hard to differentiate
46between comments and code! The florid color scheme (far
47right) is no good either, it contains too many attention
48grabbers. The center sample is a healthy balance of both.
49Function calls and constants stand out, and repetitive
50keywords and other noise (<code>let</code>, <code>as</code>) are mildly dimmed
51out. Comments and non-code text (sign column, status text)
52are dimmed further.</p>
53
54<p>I&#8217;ll stop myself before I rant about color contrast and
55combinations.</p>
56
57 </div>
58 <a href="/index.html" class="post-end-link">‹ Back</a>
59 <div class="separator"></div>
60 </div>
61 </body>
62</html>
diff --git a/docs/posts/get_better_at_yanking_and_putting_in_vim.html b/docs/posts/get_better_at_yanking_and_putting_in_vim.html
new file mode 100644
index 0000000..82b283f
--- /dev/null
+++ b/docs/posts/get_better_at_yanking_and_putting_in_vim.html
@@ -0,0 +1,48 @@
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <link rel="stylesheet" href="/style.css">
5 <meta charset="UTF-8">
6 <meta name="viewport" content="initial-scale=1">
7 <meta content="#ffffff" name="theme-color">
8 <meta name="HandheldFriendly" content="true">
9 <meta property="og:title" content="nerdypepper">
10 <meta property="og:type" content="website">
11 <meta property="og:description" content="a static site {for, by, about} me ">
12 <meta property="og:url" content="https://nerdypepper.tech">
13 <body>
14 <div class="post posts">
15 <div class="date">29/07 2019</div>
16 <span style="font-size: 2rem; font-weight: 600">
17 Get Better At Yanking And Putting In Vim
18 </span>
19 <div class="post-text">
20 <ol start="1">
21<li><p>reselecting previously selected text (i use this to fix botched selections):</p>
22
23<pre><code>gv &quot; :h gv for more
24 &quot; you can use `o` in visual mode to go to the `Other` end of the selection
25 &quot; use a motion to fix the selection
26</code></pre></li>
27<li><p>reselecting previously yanked text:</p>
28
29<pre><code>`[v`]
30`[ &quot; marks the beginning of the previously yanked text :h `[
31`] &quot; marks the end :h `]
32 v &quot; visual select everything in between
33
34nnoremap gb `[v`] &quot; &quot;a quick map to perform the above
35</code></pre></li>
36<li><p>pasting and indenting text (in one go):</p>
37
38<pre><code>]p &quot; put (p) and adjust indent to current line
39]P &quot; put the text before the cursor (P) and adjust indent to current line
40</code></pre></li>
41</ol>
42
43 </div>
44 <a href="/index.html" class="post-end-link">‹ Back</a>
45 <div class="separator"></div>
46 </div>
47 </body>
48</html>
diff --git a/docs/posts/hold_position!.html b/docs/posts/hold_position!.html
new file mode 100644
index 0000000..a0f3fdf
--- /dev/null
+++ b/docs/posts/hold_position!.html
@@ -0,0 +1,47 @@
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <link rel="stylesheet" href="/style.css">
5 <meta charset="UTF-8">
6 <meta name="viewport" content="initial-scale=1">
7 <meta content="#ffffff" name="theme-color">
8 <meta name="HandheldFriendly" content="true">
9 <meta property="og:title" content="nerdypepper">
10 <meta property="og:type" content="website">
11 <meta property="og:description" content="a static site {for, by, about} me ">
12 <meta property="og:url" content="https://nerdypepper.tech">
13 <body>
14 <div class="post posts">
15 <div class="date">30/07 2019</div>
16 <span style="font-size: 2rem; font-weight: 600">
17 Hold Position!
18 </span>
19 <div class="post-text">
20 <p>Often times, when I run a vim command that makes &#8220;big&#8221; changes to a file (a
21macro or a <code>:vimgrep</code> command) I lose my original position and feel disoriented.</p>
22
23<p><em>Save position with <code>winsaveview()</code>!</em></p>
24
25<p>The <code>winsaveview()</code> command returns a <code>Dictionary</code> that contains information
26about the view of the current window. This includes the cursor line number,
27cursor coloumn, the top most line in the window and a couple of other values,
28none of which concern us.</p>
29
30<p>Before running our command (one that jumps around the buffer, a lot), we save
31our view, and restore it once its done, with <code>winrestview</code>.</p>
32
33<pre><code>let view = winsaveview()
34s/\s\+$//gc &quot; find and (confirm) replace trailing blanks
35winrestview(view) &quot; restore our original view!
36</code></pre>
37
38<p>It might seem a little overkill in the above example, just use &#8220; (double
39backticks) instead, but it comes in handy when you run your file through
40heavier filtering.</p>
41
42 </div>
43 <a href="/index.html" class="post-end-link">‹ Back</a>
44 <div class="separator"></div>
45 </div>
46 </body>
47</html>
diff --git a/docs/posts/my_setup.html b/docs/posts/my_setup.html
new file mode 100644
index 0000000..4eb6605
--- /dev/null
+++ b/docs/posts/my_setup.html
@@ -0,0 +1,52 @@
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <link rel="stylesheet" href="/style.css">
5 <meta charset="UTF-8">
6 <meta name="viewport" content="initial-scale=1">
7 <meta content="#ffffff" name="theme-color">
8 <meta name="HandheldFriendly" content="true">
9 <meta property="og:title" content="nerdypepper">
10 <meta property="og:type" content="website">
11 <meta property="og:description" content="a static site {for, by, about} me ">
12 <meta property="og:url" content="https://nerdypepper.tech">
13 <body>
14 <div class="post posts">
15 <div class="date">07/11 2019</div>
16 <span style="font-size: 2rem; font-weight: 600">
17 My Setup
18 </span>
19 <div class="post-text">
20 <p>Decided to do one of these because everyone does one of
21these.</p>
22
23<p><img src="https://files.nerdypepper.tech/Hb.png" alt="scrot" /></p>
24
25<p>My entire setup is managed with GNU <code>stow</code>, making it easier
26to replicate on fresh installations. You can find my
27configuration files on <a href="https://github.com/nerdypepper">GitHub</a>.</p>
28
29<p>I run Void Linux (glibc) on my
30<a href="https://store.hp.com/us/en/mdp/laptops/envy-13">HP Envy 13&quot; (2018)</a>.
31To keep things simple, I run a raw X session with <code>2bwm</code> as my
32window manager, along with <code>dunst</code> (notification daemon) and
33Sam&#8217;s <a href="https://github.com/sdhand/compton"><code>compton</code></a>
34(compositor) fork.</p>
35
36<p>I am a fan of GNU tools, so I use <code>bash</code> as my shell, and
37<code>coreutils</code> to manage files, archives, strings, paths etc. I
38edit files with <code>vim</code>, chat with <code>weechat</code>, listen to music
39with <code>cmus</code>, monitor processes with <code>htop</code>, manage sessions
40with <code>tmux</code>, read pdfs in <code>zathura</code>. I rarely ever leave
41the comfort of my terminal emulator, <code>urxvt</code>.</p>
42
43<p>Most of my academic typesetting is done with TeX, and
44compiled with <code>xelatex</code>. Other <em>fun</em> documents are made with
45GIMP :).</p>
46
47 </div>
48 <a href="/index.html" class="post-end-link">‹ Back</a>
49 <div class="separator"></div>
50 </div>
51 </body>
52</html>
diff --git a/docs/posts/onivim_sucks.html b/docs/posts/onivim_sucks.html
new file mode 100644
index 0000000..ea621c4
--- /dev/null
+++ b/docs/posts/onivim_sucks.html
@@ -0,0 +1,53 @@
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <link rel="stylesheet" href="/style.css">
5 <meta charset="UTF-8">
6 <meta name="viewport" content="initial-scale=1">
7 <meta content="#ffffff" name="theme-color">
8 <meta name="HandheldFriendly" content="true">
9 <meta property="og:title" content="nerdypepper">
10 <meta property="og:type" content="website">
11 <meta property="og:description" content="a static site {for, by, about} me ">
12 <meta property="og:url" content="https://nerdypepper.tech">
13 <body>
14 <div class="post posts">
15 <div class="date">02/08 2019</div>
16 <span style="font-size: 2rem; font-weight: 600">
17 Onivim Sucks
18 </span>
19 <div class="post-text">
20 <p><a href="https://v2.onivim.io">Onivim</a> is a &#8216;modern modal editor&#8217;, combining fancy
21interface and language features with vim-style modal editing. What&#8217;s wrong you
22ask?</p>
23
24<p>Apart from <a href="https://github.com/onivim/oni2/issues/550">buggy syntax highlighting</a>,
25<a href="https://github.com/onivim/oni2/issues/519">broken scrolling</a> and
26<a href="https://github.com/onivim/oni2/issues?q=is%3Aissue+label%3A%22daily+editor+blocker%22+is%3Aopen">others</a>,
27Onivim is <strong>proprietary</strong> software. It is licensed under a commercial
28<a href="https://github.com/onivim/oni1/blob/master/Outrun-Labs-EULA-v1.1.md">end user agreement license</a>,
29which prohibits redistribution in both object code and source code formats.</p>
30
31<p>Onivim&#8217;s core editor logic (bits that belong to vim), have been separated from
32the interface, into <a href="https://github.com/onivim/libvim">libvim</a>. libvim is
33licensed under MIT, which means, this &#8216;extension&#8217; of vim is perfectly in
34adherence to <a href="http://vimdoc.sourceforge.net/htmldoc/uganda.html#license">vim&#8217;s license text</a>!
35Outrun Labs are exploiting this loophole (distributing vim as a library) to
36commercialize Onivim.</p>
37
38<p>Onivim&#8217;s source code is available on <a href="https://github.com/onivim/oni2">GitHub</a>.
39They do mention that the source code trickles down to the
40<a href="https://github.com/onivim/oni2-mit">oni2-mit</a> repository, which (not yet) contains
41MIT-licensed code, <strong>18 months</strong> after each commit to the original repository.</p>
42
43<p>Want to contribute to Onivim? Don&#8217;t. They make a profit out of your contributions.
44Currently, Onivim is priced at $19.99, &#8216;pre-alpha&#8217; pricing which is 80% off the
45final price! If you are on the lookout for an editor, I would suggest using
46<a href="https://vim.org">Vim</a>, charity ware that actually works, and costs $100 lesser.</p>
47
48 </div>
49 <a href="/index.html" class="post-end-link">‹ Back</a>
50 <div class="separator"></div>
51 </div>
52 </body>
53</html>
diff --git a/docs/posts/static_sites_with_bash.html b/docs/posts/static_sites_with_bash.html
new file mode 100644
index 0000000..70eda1a
--- /dev/null
+++ b/docs/posts/static_sites_with_bash.html
@@ -0,0 +1,74 @@
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <link rel="stylesheet" href="/style.css">
5 <meta charset="UTF-8">
6 <meta name="viewport" content="initial-scale=1">
7 <meta content="#ffffff" name="theme-color">
8 <meta name="HandheldFriendly" content="true">
9 <meta property="og:title" content="nerdypepper">
10 <meta property="og:type" content="website">
11 <meta property="og:description" content="a static site {for, by, about} me ">
12 <meta property="og:url" content="https://nerdypepper.tech">
13 <body>
14 <div class="post posts">
15 <div class="date">23/11 2019</div>
16 <span style="font-size: 2rem; font-weight: 600">
17 Static Sites With Bash
18 </span>
19 <div class="post-text">
20 <p>After going through a bunch of static site generators
21(<a href="https://blog.getpelican.com/">pelican</a>,
22<a href="https://gohugo.io">hugo</a>,
23<a href="https://github.com/icyphox/vite">vite</a>), I decided to roll
24my own. If you are more of the &#8216;show me the code&#8217; kinda guy,
25<a href="https://github.com/nerdypepper/site">here</a> you go.</p>
26
27<p><strong>Text formatting</strong>: I chose to write in markdown, and convert
28to html with <a href="https://kristaps.bsd.lv/lowdown/">lowdown</a>.</p>
29
30<p><strong>Directory structure</strong>: I host my site on GitHub pages, so
31<code>docs/</code> has to be the entry point. Markdown formatted posts
32go into <code>posts/</code>, get converted into html, and end up in
33<code>docs/index.html</code>, something like this:</p>
34
35<pre><code>posts=$(ls -t ./posts) # chronological order!
36for f in $posts; do
37 file=&quot;./posts/&quot;$f # `ls` mangled our file paths
38 echo &quot;generating post $file&quot;
39
40 html=$(lowdown &quot;$file&quot;)
41 echo -e &quot;html&quot; &gt;&gt; docs/index.html
42done
43</code></pre>
44
45<p><strong>Assets</strong>: Most static site generators recommend dropping image
46assets into the site source itself. That does have it&#8217;s
47merits, but I prefer hosting images separately:</p>
48
49<pre><code># strip file extension
50ext=&quot;${1##*.}&quot;
51
52# generate a random file name
53id=$( cat /dev/urandom | tr -dc &#39;a-zA-Z0-9&#39; | fold -w 2 | head -n 1 )
54id=&quot;$id.$ext&quot;
55
56# copy to my file host
57scp -P 443 &quot;$1&quot; emerald:files/&quot;$id&quot;
58echo &quot;https://files.nerdypepper.tech/$id&quot;
59</code></pre>
60
61<p><strong>Templating</strong>:
62<a href="https://github.com/NerdyPepper/site/blob/master/generate.sh"><code>generate.sh</code></a>
63brings the above bits and pieces together (with some extra
64cruft to avoid javascript). It uses <code>sed</code> to produce nice
65titles from the file names (removes underscores,
66title-case), and <code>date(1)</code> to add the date to each post
67listing!</p>
68
69 </div>
70 <a href="/index.html" class="post-end-link">‹ Back</a>
71 <div class="separator"></div>
72 </div>
73 </body>
74</html>
diff --git a/generate.sh b/generate.sh
index af70b33..5399b3a 100755
--- a/generate.sh
+++ b/generate.sh
@@ -1,28 +1,23 @@
1#! /usr/bin/env bash 1#! /usr/bin/env bash
2 2
3 3
4post_title() { 4title_wrapper() {
5 # remove extension 5 # remove extension
6 # snake to title case 6 # snake to title case
7 echo "$1" | sed -E -e "s/\..+$//g" -e "s/_(.)/ \u\1/g" -e "s/^(.)/\u\1/g" 7 echo "$1" | sed -E -e "s/\..+$//g" -e "s/_(.)/ \u\1/g" -e "s/^(.)/\u\1/g"
8} 8}
9 9
10post_wrapper() { 10link_wrapper() {
11 # 1 - post id 11 # 1 - id
12 # 2 - post content 12 # 2 - title
13 # 3 - date 13 # 2 - date
14 title="$( post_title $1 )"
15 echo -ne " 14 echo -ne "
16 <details class=\"post\"> 15 <div class=\"post\">
17 <summary> 16 <div class=\"date\">$3</div>
18 <div class=\"date\">$3</div> 17 <a href=\"/posts/$1.html\" class=\"post-link\">
19 <span class=\"post-link\">$title</span> 18 <span class=\"post-link\">$2</span>
20 </summary> 19 </a>
21 <div class=\"post-text\"> 20 </div>
22 $2
23 <div class="separator"></div>
24 </div>
25 </details>
26 " 21 "
27} 22}
28 23
@@ -57,17 +52,22 @@ echo "
57 52
58# posts 53# posts
59posts=$(ls -t ./posts); 54posts=$(ls -t ./posts);
55mkdir -p docs/posts
56
60for f in $posts; do 57for f in $posts; do
61 file="./posts/"$f 58 file="./posts/"$f
62 echo "generating post $file" 59 echo "generating post $file"
63 id="${file##*/}" # ill name my posts just fine 60 id="${file##*/}" # ill name my posts just fine
64 61
65 html=$(lowdown "$file")
66 62
67 # generate posts 63 # generate posts
64 html=$(lowdown "$file")
65 post_title=$(title_wrapper "$id")
68 post_date=$(date -r "$file" "+%d/%m %Y") 66 post_date=$(date -r "$file" "+%d/%m %Y")
69 post_div=$(post_wrapper "$id" "$html" "$post_date") 67 post_link=$(link_wrapper "${id%.*}" "$post_title" "$post_date")
70 echo -ne "$post_div" >> docs/index.html 68
69 echo -ne "$post_link" >> docs/index.html
70 esh -s /bin/bash -o "docs/posts/${id%.*}.html" "./post.esh" file="$file" date="$post_date" title="$post_title"
71 first_visible="0" 71 first_visible="0"
72done 72done
73 73