diff options
author | Akshay <[email protected]> | 2020-03-11 18:23:26 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2020-03-11 18:23:26 +0000 |
commit | 9e8fbb5f2bb41e712e9680f825d238181876f45c (patch) | |
tree | 6df6c5b784b68ae3d06103939d46f5860ce1e9e7 | |
parent | 64cc97395d0541c1bbfc1df58f0351d9b8332c6b (diff) |
finish up rss feeds
-rw-r--r-- | docs/index.xml | 519 | ||||
-rwxr-xr-x | generate.sh | 7 | ||||
-rw-r--r-- | rss.esh | 37 |
3 files changed, 562 insertions, 1 deletions
diff --git a/docs/index.xml b/docs/index.xml new file mode 100644 index 0000000..cb23ad8 --- /dev/null +++ b/docs/index.xml | |||
@@ -0,0 +1,519 @@ | |||
1 | <rss version="2.0"> | ||
2 | <channel> | ||
3 | <title>nerdypepper's μblog</title> | ||
4 | <link>https://peppe.rs</link> | ||
5 | <description>programming, design, software</description> | ||
6 | <link href="https://peppe.rs/index.xml" rel="self" type="application/xml"/> | ||
7 | <image> | ||
8 | <title>nerdypepper logo</title> | ||
9 | <url>https://u.peppe.rs/n.png</url> | ||
10 | <link>https://peppe.rs</link> | ||
11 | </image> | ||
12 | <language>en-us</language> | ||
13 | <copyright>Creative Commons BY-NC-SA 4.0</copyright> | ||
14 | <item> | ||
15 | <title>Termux Tandem</title> | ||
16 | <description><p>I learnt about <code>termux</code> from a friend on IRC recently. | ||
17 | It looked super gimmicky to me at first, but it eventually | ||
18 | proved to be useful. Here's what I use it for:</p> | ||
19 | |||
20 | <h3 id="rsync">rsync</h3> | ||
21 | |||
22 | <p>Ever since I degoogled my android device, syncing files | ||
23 | between my phone and my PC has always been a pain. I’m | ||
24 | looking at you MTP. But, with <code>termux</code> and <code>sshd</code> all set up, | ||
25 | it's as simple as:</p> | ||
26 | |||
27 | <pre><code>$ arp | ||
28 | Address HWtype HWad ... | ||
29 | 192.168.43.187 ether d0:0 ... | ||
30 | |||
31 | $ rsync -avz 192.168.43.187:~/frogs ~/pics/frogs | ||
32 | </code></pre> | ||
33 | |||
34 | <h3 id="ssh%20&#38;%20tmux">ssh & tmux</h3> | ||
35 | |||
36 | <p>My phone doubles as a secondary view into my main machine | ||
37 | with <code>ssh</code> and <code>tmux</code>. When I am away from my PC (read: | ||
38 | sitting across the room), I check build status and IRC | ||
39 | messages by <code>ssh</code>ing into a tmux session running the said | ||
40 | build or weechat.</p> | ||
41 | |||
42 | <h3 id="file%20uploads">file uploads</h3> | ||
43 | |||
44 | <p>Not being able to access my (ssh-only) file host was | ||
45 | crippling. With a <code>bash</code> instance on my phone, I just copied | ||
46 | over my ssh keys, and popped in a file upload script (a | ||
47 | glorified <code>scp</code>). Now I just have to figure out a way to | ||
48 | clean up these file names …</p> | ||
49 | |||
50 | <pre><code>~/storage/pictures/ $ ls | ||
51 | 02muf5g7b2i41.jpg 7alt3cwg77841.jpg cl4bsrge7id11.png | ||
52 | mtZabXG.jpg p8d5c584f2841.jpg vjUxGjq.jpg | ||
53 | </code></pre> | ||
54 | |||
55 | <h3 id="cmus">cmus</h3> | ||
56 | |||
57 | <p>Alright, I don't really listen to music via <code>cmus</code>, but I | ||
58 | did use it a couple times when my default music player was | ||
59 | acting up. <code>cmus</code> is a viable option:</p> | ||
60 | |||
61 | <p><a href="https://u.peppe.rs/CP.jpg"><img src="https://u.peppe.rs/CP.jpg" alt="cmus.png" /></a></p></description> | ||
62 | <link>https://peppe.rs/posts/termux_tandem/</link> | ||
63 | <pubDate>Sun, 08 Mar 20 16:47:00 +0000</pubDate> | ||
64 | <guid>https://peppe.rs/posts/termux_tandem/</guid> | ||
65 | </item> | ||
66 | <item> | ||
67 | <title>Call To ARMs</title> | ||
68 | <description><p>My 4th semester involves ARM programming. And proprietary | ||
69 | tooling (Keil C). But we don't do that here.</p> | ||
70 | |||
71 | <h3 id="Building">Building</h3> | ||
72 | |||
73 | <p>Assembling and linking ARM binaries on non-ARM architecture | ||
74 | devices is fairly trivial. I went along with the GNU cross | ||
75 | bare metal toolchain binutils, which provides <code>arm-as</code> and | ||
76 | <code>arm-ld</code> (among a bunch of other utils that I don't care | ||
77 | about for now). </p> | ||
78 | |||
79 | <p>Assemble <code>.s</code> files with:</p> | ||
80 | |||
81 | <pre><code class="language-shell">arm-none-eabi-as main.s -g -march=armv8.1-a -o main.out | ||
82 | </code></pre> | ||
83 | |||
84 | <p>The <code>-g</code> flag generates extra debugging information that | ||
85 | <code>gdb</code> picks up. The <code>-march</code> option establishes target | ||
86 | architecture.</p> | ||
87 | |||
88 | <p>Link <code>.o</code> files with:</p> | ||
89 | |||
90 | <pre><code class="language-shell">arm-none-eabi-ld main.out -o main | ||
91 | </code></pre> | ||
92 | |||
93 | <h3 id="Running%20(and%20Debugging)">Running (and Debugging)</h3> | ||
94 | |||
95 | <p>Things get interesting here. <code>gdb</code> on your x86 machine | ||
96 | cannot read nor execute binaries compiled for ARM. So, we | ||
97 | simulate an ARM processor using <code>qemu</code>. Now qemu allows you | ||
98 | to run <code>gdbserver</code> on startup. Connecting our local <code>gdb</code> | ||
99 | instance to <code>gdbserver</code> gives us a view into the program’s | ||
100 | execution. Easy!</p> | ||
101 | |||
102 | <p>Run <code>qemu</code>, with <code>gdbserver</code> on port <code>1234</code>, with our ARM | ||
103 | binary, <code>main</code>:</p> | ||
104 | |||
105 | <pre><code class="language-shell">qemu-arm -singlestep -g 1234 main | ||
106 | </code></pre> | ||
107 | |||
108 | <p>Start up <code>gdb</code> on your machine, and connect to <code>qemu</code>’s | ||
109 | <code>gdbserver</code>:</p> | ||
110 | |||
111 | <pre><code>(gdb) set architecture armv8-a | ||
112 | (gdb) target remote localhost:1234 | ||
113 | (gdb) file main | ||
114 | Reading symbols from main... # yay! | ||
115 | </code></pre> | ||
116 | |||
117 | <h3 id="GDB%20Enhanced">GDB Enhanced</h3> | ||
118 | |||
119 | <p><code>gdb</code> is cool, but it's not nearly as comfortable as well | ||
120 | fleshed out emulators/IDEs like Keil. Watching registers, | ||
121 | CPSR and memory chunks update <em>is</em> pretty fun. </p> | ||
122 | |||
123 | <p>I came across <code>gdb</code>'s TUI mode (hit <code>C-x C-a</code> or type <code>tui | ||
124 | enable</code> at the prompt). TUI mode is a godsend. It highlights | ||
125 | the current line of execution, shows you disassembly | ||
126 | outputs, updated registers, active breakpoints and more.</p> | ||
127 | |||
128 | <p><em>But</em>, it is an absolute eyesore.</p> | ||
129 | |||
130 | <p>Say hello to <a href="https://github.com/hugsy/gef">GEF</a>! “GDB | ||
131 | Enhanced Features” teaches our old dog some cool new tricks. | ||
132 | Here are some additions that made my ARM debugging | ||
133 | experience loads better:</p> | ||
134 | |||
135 | <ul> | ||
136 | <li>Memory watches</li> | ||
137 | <li>Register watches, with up to 7 levels of deref (overkill, | ||
138 | I agree)</li> | ||
139 | <li>Stack tracing</li> | ||
140 | </ul> | ||
141 | |||
142 | <p>And it's pretty! See for yourself:</p> | ||
143 | |||
144 | <p><a href="https://u.peppe.rs/wq.png"><img src="https://u.peppe.rs/wq.png" alt="gef.png" /></a></p> | ||
145 | |||
146 | <h3 id="Editing">Editing</h3> | ||
147 | |||
148 | <p>Vim, with <code>syntax off</code> because it | ||
149 | dosen't handle GNU ARM syntax too well.</p></description> | ||
150 | <link>https://peppe.rs/posts/call_to_ARMs/</link> | ||
151 | <pubDate>Fri, 07 Feb 20 18:30:00 +0000</pubDate> | ||
152 | <guid>https://peppe.rs/posts/call_to_ARMs/</guid> | ||
153 | </item> | ||
154 | <item> | ||
155 | <title>Color Conundrum</title> | ||
156 | <description><p>This piece aims to highlight (pun intended) some of the | ||
157 | reasons behind my <a href="https://u.peppe.rs/bF.png">color | ||
158 | free</a> editor setup.</p> | ||
159 | |||
160 | <p>Imagine highlighting an entire book because <em>all</em> of it is | ||
161 | important. That is exactly what (most) syntax highlighting | ||
162 | does. It is difficult for the human eye to filter out noise | ||
163 | in rainbow barf. Use color to draw attention, not diverge | ||
164 | it.</p> | ||
165 | |||
166 | <p>At the same time, a book devoid of color is <em>boring!</em> What | ||
167 | is the takeaway from this 10 line paragraph? What are the | ||
168 | technical terms used?</p> | ||
169 | |||
170 | <p>Prose and code are certainly different, but the fickle | ||
171 | minded human eye is the same. The eye constantly looks for a | ||
172 | frame of reference, a focal point. It grows tired when it | ||
173 | can't find one.</p> | ||
174 | |||
175 | <p>The following comparison does a better job of explaining | ||
176 | (none, ample and over-the-top highlighting, from left to | ||
177 | right):</p> | ||
178 | |||
179 | <p><a href="https://u.peppe.rs/lt.png"><img src="https://u.peppe.rs/lt.png" alt="hi.png" /></a></p> | ||
180 | |||
181 | <p>Without highlighting (far left), it is hard to differentiate | ||
182 | between comments and code! The florid color scheme (far | ||
183 | right) is no good either, it contains too many attention | ||
184 | grabbers. The center sample is a healthy balance of both. | ||
185 | Function calls and constants stand out, and repetitive | ||
186 | keywords and other noise (<code>let</code>, <code>as</code>) are mildly dimmed | ||
187 | out. Comments and non-code text (sign column, status text) | ||
188 | are dimmed further.</p> | ||
189 | |||
190 | <p>I'll stop myself before I rant about color contrast and | ||
191 | combinations.</p></description> | ||
192 | <link>https://peppe.rs/posts/color_conundrum/</link> | ||
193 | <pubDate>Mon, 30 Dec 19 18:30:00 +0000</pubDate> | ||
194 | <guid>https://peppe.rs/posts/color_conundrum/</guid> | ||
195 | </item> | ||
196 | <item> | ||
197 | <title>Static Sites With Bash</title> | ||
198 | <description><p>After going through a bunch of static site generators | ||
199 | (<a href="https://blog.getpelican.com/">pelican</a>, | ||
200 | <a href="https://gohugo.io">hugo</a>, | ||
201 | <a href="https://github.com/icyphox/vite">vite</a>), I decided to roll | ||
202 | my own. If you are more of the ‘show me the code’ kinda guy, | ||
203 | <a href="https://github.com/nerdypepper/site">here</a> you go.</p> | ||
204 | |||
205 | <h3 id="Text%20formatting">Text formatting</h3> | ||
206 | |||
207 | <p>I chose to write in markdown, and convert | ||
208 | to html with <a href="https://kristaps.bsd.lv/lowdown/">lowdown</a>.</p> | ||
209 | |||
210 | <h3 id="Directory%20structure">Directory structure</h3> | ||
211 | |||
212 | <p>I host my site on GitHub pages, so | ||
213 | <code>docs/</code> has to be the entry point. Markdown formatted posts | ||
214 | go into <code>posts/</code>, get converted into html, and end up in | ||
215 | <code>docs/index.html</code>, something like this:</p> | ||
216 | |||
217 | <pre><code>posts=$(ls -t ./posts) # chronological order! | ||
218 | for f in $posts; do | ||
219 | file="./posts/"$f # `ls` mangled our file paths | ||
220 | echo "generating post $file" | ||
221 | |||
222 | html=$(lowdown "$file") | ||
223 | echo -e "html" >> docs/index.html | ||
224 | done | ||
225 | </code></pre> | ||
226 | |||
227 | <h3 id="Assets">Assets</h3> | ||
228 | |||
229 | <p>Most static site generators recommend dropping image | ||
230 | assets into the site source itself. That does have it’s | ||
231 | merits, but I prefer hosting images separately:</p> | ||
232 | |||
233 | <pre><code># strip file extension | ||
234 | ext="${1##*.}" | ||
235 | |||
236 | # generate a random file name | ||
237 | id=$( cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 2 | head -n 1 ) | ||
238 | id="$id.$ext" | ||
239 | |||
240 | # copy to my file host | ||
241 | scp -P 443 "$1" emerald:files/"$id" | ||
242 | echo "https://u.peppe.rs/$id" | ||
243 | </code></pre> | ||
244 | |||
245 | <h3 id="Templating">Templating</h3> | ||
246 | |||
247 | <p><a href="https://github.com/NerdyPepper/site/blob/master/generate.sh"><code>generate.sh</code></a> | ||
248 | brings the above bits and pieces together (with some extra | ||
249 | cruft to avoid javascript). It uses <code>sed</code> to produce nice | ||
250 | titles from the file names (removes underscores, | ||
251 | title-case), and <code>date(1)</code> to add the date to each post | ||
252 | listing!</p></description> | ||
253 | <link>https://peppe.rs/posts/static_sites_with_bash/</link> | ||
254 | <pubDate>Fri, 22 Nov 19 18:30:00 +0000</pubDate> | ||
255 | <guid>https://peppe.rs/posts/static_sites_with_bash/</guid> | ||
256 | </item> | ||
257 | <item> | ||
258 | <title>My Setup</title> | ||
259 | <description><p>Decided to do one of these because everyone does one of | ||
260 | these.</p> | ||
261 | |||
262 | <p><img src="https://u.peppe.rs/Hb.png" alt="scrot" /></p> | ||
263 | |||
264 | <p>My entire setup is managed with GNU <code>stow</code>, making it easier | ||
265 | to replicate on fresh installations. You can find my | ||
266 | configuration files on <a href="https://github.com/nerdypepper">GitHub</a>.</p> | ||
267 | |||
268 | <p>I run Void Linux (glibc) on my | ||
269 | <a href="https://store.hp.com/us/en/mdp/laptops/envy-13">HP Envy 13” (2018)</a>. | ||
270 | To keep things simple, I run a raw X session with <code>2bwm</code> as my | ||
271 | window manager, along with <code>dunst</code> (notification daemon) and | ||
272 | Sam's <a href="https://github.com/sdhand/compton"><code>compton</code></a> | ||
273 | (compositor) fork.</p> | ||
274 | |||
275 | <p>I am a fan of GNU tools, so I use <code>bash</code> as my shell, and | ||
276 | <code>coreutils</code> to manage files, archives, strings, paths etc. I | ||
277 | edit files with <code>vim</code>, chat with <code>weechat</code>, listen to music | ||
278 | with <code>cmus</code>, monitor processes with <code>htop</code>, manage sessions | ||
279 | with <code>tmux</code>, read pdfs in <code>zathura</code>. I rarely ever leave | ||
280 | the comfort of my terminal emulator, <code>urxvt</code>.</p> | ||
281 | |||
282 | <p>Most of my academic typesetting is done with TeX, and | ||
283 | compiled with <code>xelatex</code>. Other <em>fun</em> documents are made with | ||
284 | GIMP :).</p></description> | ||
285 | <link>https://peppe.rs/posts/my_setup/</link> | ||
286 | <pubDate>Wed, 06 Nov 19 18:30:00 +0000</pubDate> | ||
287 | <guid>https://peppe.rs/posts/my_setup/</guid> | ||
288 | </item> | ||
289 | <item> | ||
290 | <title>WPA Woes</title> | ||
291 | <description><p>I finally got around to installing Void GNU/Linux on my main | ||
292 | computer. Rolling release, non-systemd, need I say more?</p> | ||
293 | |||
294 | <p>As with all GNU/Linux distributions, wireless networks had | ||
295 | me in a fix. If you can see this post, it means I've managed | ||
296 | to get online. It turns out, <code>wpa_supplicant</code> was detecting the | ||
297 | wrong interface by default (does it ever select the right | ||
298 | one?). Let us fix that:</p> | ||
299 | |||
300 | <pre><code>$ sudo rm -r /var/service/wpa_supplicant | ||
301 | $ sudo killall dhcpcd | ||
302 | </code></pre> | ||
303 | |||
304 | <p>What is the right interface though?</p> | ||
305 | |||
306 | <pre><code>$ iw dev | ||
307 | ... | ||
308 | Interface wlp2s0 | ||
309 | ... | ||
310 | </code></pre> | ||
311 | |||
312 | <p>Aha! Let us run <code>wpa_supplicant</code> on that interface, as a | ||
313 | background process:</p> | ||
314 | |||
315 | <pre><code>$ sudo wpa_supplicant -B -i wlp2s0 -c /etc/wpa_supplicant/wpa_supplicant.conf | ||
316 | $ sudo dhcpcd -B wlp2s0 | ||
317 | $ ping google.com | ||
318 | PING ... | ||
319 | </code></pre> | ||
320 | |||
321 | <p>Yay! Make those changes perpetual by enabling the service:</p> | ||
322 | |||
323 | <pre><code>------------------------------------------------------ | ||
324 | # Add these to /etc/wpa_supplicant/wpa_supplicant.conf | ||
325 | OPTS="-B" | ||
326 | WPA_INTERFACE="wlp2s0" | ||
327 | ------------------------------------------------------ | ||
328 | $ sudo ln -s /etc/sv/wpa_supplicant /var/service/ | ||
329 | $ sudo ln -s /etc/sv/dhcpcd /var/service/ | ||
330 | $ sudo sv restart wpa_supplicant | ||
331 | $ sudo sv restart dhcpcd | ||
332 | </code></pre></description> | ||
333 | <link>https://peppe.rs/posts/WPA_woes/</link> | ||
334 | <pubDate>Sat, 12 Oct 19 16:18:00 +0000</pubDate> | ||
335 | <guid>https://peppe.rs/posts/WPA_woes/</guid> | ||
336 | </item> | ||
337 | <item> | ||
338 | <title>Bye Bye BDFs</title> | ||
339 | <description><p>Glyph Bitmap Distribution Format is no more, as the creators of | ||
340 | <a href="https://pango.org">Pango</a>, one of the most widely used text rendering | ||
341 | libraries, | ||
342 | <a href="https://blogs.gnome.org/mclasen/2019/05/25/pango-future-directions/">announced</a> | ||
343 | their plans for Pango 1.44.</p> | ||
344 | |||
345 | <p>Until recently, Pango used FreeType to draw fonts. They will be moving over | ||
346 | to <a href="https://harfbuzz.org">Harfbuzz</a>, an evolution of FreeType.</p> | ||
347 | |||
348 | <p><em>Why?</em></p> | ||
349 | |||
350 | <p>In short, FreeType was hard to work with. It required complex logic, and | ||
351 | provided no advantage over Harfbuzz (other than being able to fetch | ||
352 | opentype metrics with ease).</p> | ||
353 | |||
354 | <p>Upgrading to Pango v1.44 will break your GTK applications (if you use a | ||
355 | <code>bdf</code>/<code>pcf</code> bitmap font). Harfbuzz <em>does</em> support bitmap-only OpenType fonts, | ||
356 | <code>otb</code>s. Convert your existing fonts over to <code>otb</code>s using | ||
357 | <a href="https://fontforge.github.io">FontForge</a>. It is to be noted that applications | ||
358 | such as <code>xterm</code> and <code>rxvt</code> use <code>xft</code> (X FreeType) to render fonts, and will | ||
359 | remain unaffected by the update.</p> | ||
360 | |||
361 | <p>Both <a href="https://github.com/nerdypepper/scientifica">scientifica</a> and | ||
362 | <a href="https://github.com/nerdypepper/curie">curie</a> will soon ship with bitmap-only | ||
363 | OpenType font formats.</p></description> | ||
364 | <link>https://peppe.rs/posts/bye_bye_BDFs/</link> | ||
365 | <pubDate>Wed, 07 Aug 19 12:31:00 +0000</pubDate> | ||
366 | <guid>https://peppe.rs/posts/bye_bye_BDFs/</guid> | ||
367 | </item> | ||
368 | <item> | ||
369 | <title>Onivim Sucks</title> | ||
370 | <description><p><a href="https://v2.onivim.io">Onivim</a> is a ‘modern modal editor’, combining fancy | ||
371 | interface and language features with vim-style modal editing. What's wrong you | ||
372 | ask?</p> | ||
373 | |||
374 | <p>Apart from <a href="https://github.com/onivim/oni2/issues/550">buggy syntax highlighting</a>, | ||
375 | <a href="https://github.com/onivim/oni2/issues/519">broken scrolling</a> and | ||
376 | <a href="https://github.com/onivim/oni2/issues?q=is%3Aissue+label%3A%22daily+editor+blocker%22+is%3Aopen">others</a>, | ||
377 | Onivim is <strong>proprietary</strong> software. It is licensed under a commercial | ||
378 | <a href="https://github.com/onivim/oni1/blob/master/Outrun-Labs-EULA-v1.1.md">end user agreement license</a>, | ||
379 | which prohibits redistribution in both object code and source code formats.</p> | ||
380 | |||
381 | <p>Onivim's core editor logic (bits that belong to vim), have been separated from | ||
382 | the interface, into <a href="https://github.com/onivim/libvim">libvim</a>. libvim is | ||
383 | licensed under MIT, which means, this ‘extension’ of vim is perfectly in | ||
384 | adherence to <a href="http://vimdoc.sourceforge.net/htmldoc/uganda.html#license">vim's license text</a>! | ||
385 | Outrun Labs are exploiting this loophole (distributing vim as a library) to | ||
386 | commercialize Onivim.</p> | ||
387 | |||
388 | <p>Onivim's source code is available on <a href="https://github.com/onivim/oni2">GitHub</a>. | ||
389 | They do mention that the source code trickles down to the | ||
390 | <a href="https://github.com/onivim/oni2-mit">oni2-mit</a> repository, which (not yet) contains | ||
391 | MIT-licensed code, <strong>18 months</strong> after each commit to the original repository.</p> | ||
392 | |||
393 | <p>Want to contribute to Onivim? Don't. They make a profit out of your contributions. | ||
394 | Currently, Onivim is priced at $19.99, ‘pre-alpha’ pricing which is 80% off the | ||
395 | final price! If you are on the lookout for an editor, I would suggest using | ||
396 | <a href="https://vim.org">Vim</a>, charity ware that actually works, and costs $100 lesser.</p></description> | ||
397 | <link>https://peppe.rs/posts/onivim_sucks/</link> | ||
398 | <pubDate>Fri, 02 Aug 19 12:31:00 +0000</pubDate> | ||
399 | <guid>https://peppe.rs/posts/onivim_sucks/</guid> | ||
400 | </item> | ||
401 | <item> | ||
402 | <title>Bash Harder With Vim</title> | ||
403 | <description><p>Bash is tricky, don't let your editor get in your way. Here's a couple of neat | ||
404 | additions you could make to your <code>vimrc</code> for a better shell programming | ||
405 | experience.</p> | ||
406 | |||
407 | <h3 id="Man%20pages%20inside%20vim">Man pages inside vim</h3> | ||
408 | |||
409 | <p>Source this script to get started: </p> | ||
410 | |||
411 | <pre><code>runtime ftplugin/man.vim | ||
412 | </code></pre> | ||
413 | |||
414 | <p>Now, you can open manpages inside vim with <code>:Man</code>! It adds nicer syntax highlighting | ||
415 | and the ability to jump around with <code>Ctrl-]</code> and <code>Ctrl-T</code>.</p> | ||
416 | |||
417 | <p>By default, the manpage is opened in a horizontal split, I prefer using a new tab:</p> | ||
418 | |||
419 | <pre><code>let g:ft_man_open_mode = 'tab' | ||
420 | </code></pre> | ||
421 | |||
422 | <h3 id="Scratchpad%20to%20test%20your%20commands">Scratchpad to test your commands</h3> | ||
423 | |||
424 | <p>I often test my <code>sed</code> substitutions, here is | ||
425 | a sample from the script used to generate this site: </p> | ||
426 | |||
427 | <pre><code># a substitution to convert snake_case to Title Case With Spaces | ||
428 | echo "$1" | sed -E -e "s/\..+$//g" -e "s/_(.)/ \u\1/g" -e "s/^(.)/\u\1/g" | ||
429 | </code></pre> | ||
430 | |||
431 | <p>Instead of dropping into a new shell, just test it out directly from vim!</p> | ||
432 | |||
433 | <ul> | ||
434 | <li><p>Yank the line into a register:</p> | ||
435 | |||
436 | <pre><code>yy | ||
437 | </code></pre></li> | ||
438 | <li><p>Paste it into the command-line window:</p> | ||
439 | |||
440 | <pre><code>q:p | ||
441 | </code></pre></li> | ||
442 | <li><p>Make edits as required:</p> | ||
443 | |||
444 | <pre><code>syntax off # previously run commands | ||
445 | edit index.html # in a buffer! | ||
446 | w | so % | ||
447 | !echo "new_post.md" | sed -E -e "s/\..+$//g" --snip-- | ||
448 | ^--- note the use of '!' | ||
449 | </code></pre></li> | ||
450 | <li><p>Hit enter with the cursor on the line containing your command!</p> | ||
451 | |||
452 | <pre><code>$ vim | ||
453 | New Post # output | ||
454 | Press ENTER or type command to continue | ||
455 | </code></pre></li> | ||
456 | </ul></description> | ||
457 | <link>https://peppe.rs/posts/bash_harder_with_vim/</link> | ||
458 | <pubDate>Wed, 31 Jul 19 06:30:00 +0000</pubDate> | ||
459 | <guid>https://peppe.rs/posts/bash_harder_with_vim/</guid> | ||
460 | </item> | ||
461 | <item> | ||
462 | <title>Hold Position!</title> | ||
463 | <description><p>Often times, when I run a vim command that makes “big” changes to a file (a | ||
464 | macro or a <code>:vimgrep</code> command) I lose my original position and feel disoriented.</p> | ||
465 | |||
466 | <p><em>Save position with <code>winsaveview()</code>!</em></p> | ||
467 | |||
468 | <p>The <code>winsaveview()</code> command returns a <code>Dictionary</code> that contains information | ||
469 | about the view of the current window. This includes the cursor line number, | ||
470 | cursor coloumn, the top most line in the window and a couple of other values, | ||
471 | none of which concern us.</p> | ||
472 | |||
473 | <p>Before running our command (one that jumps around the buffer, a lot), we save | ||
474 | our view, and restore it once its done, with <code>winrestview</code>.</p> | ||
475 | |||
476 | <pre><code>let view = winsaveview() | ||
477 | s/\s\+$//gc " find and (confirm) replace trailing blanks | ||
478 | winrestview(view) " restore our original view! | ||
479 | </code></pre> | ||
480 | |||
481 | <p>It might seem a little overkill in the above example, just use `` (double | ||
482 | backticks) instead, but it comes in handy when you run your file through | ||
483 | heavier filtering.</p></description> | ||
484 | <link>https://peppe.rs/posts/hold_position!/</link> | ||
485 | <pubDate>Tue, 30 Jul 19 12:31:00 +0000</pubDate> | ||
486 | <guid>https://peppe.rs/posts/hold_position!/</guid> | ||
487 | </item> | ||
488 | <item> | ||
489 | <title>Get Better At Yanking And Putting In Vim</title> | ||
490 | <description><ol start="1"> | ||
491 | <li><p>reselecting previously selected text (i use this to fix botched selections):</p> | ||
492 | |||
493 | <pre><code>gv " :h gv for more | ||
494 | " you can use `o` in visual mode to go to the `Other` end of the selection | ||
495 | " use a motion to fix the selection | ||
496 | </code></pre></li> | ||
497 | <li><p>reselecting previously yanked text:</p> | ||
498 | |||
499 | <pre><code>`[v`] | ||
500 | `[ " marks the beginning of the previously yanked text :h `[ | ||
501 | `] " marks the end :h `] | ||
502 | v " visual select everything in between | ||
503 | |||
504 | nnoremap gb `[v`] " "a quick map to perform the above | ||
505 | </code></pre></li> | ||
506 | <li><p>pasting and indenting text (in one go):</p> | ||
507 | |||
508 | <pre><code>]p " put (p) and adjust indent to current line | ||
509 | ]P " put the text before the cursor (P) and adjust indent to current line | ||
510 | </code></pre></li> | ||
511 | </ol></description> | ||
512 | <link>https://peppe.rs/posts/get_better_at_yanking_and_putting_in_vim/</link> | ||
513 | <pubDate>Mon, 29 Jul 19 12:31:00 +0000</pubDate> | ||
514 | <guid>https://peppe.rs/posts/get_better_at_yanking_and_putting_in_vim/</guid> | ||
515 | </item> | ||
516 | |||
517 | |||
518 | </channel> | ||
519 | </rss> | ||
diff --git a/generate.sh b/generate.sh index ccae2dd..a836eb1 100755 --- a/generate.sh +++ b/generate.sh | |||
@@ -116,9 +116,14 @@ for f in $posts; do | |||
116 | title="$post_title" \ | 116 | title="$post_title" \ |
117 | read_time="$r_time" \ | 117 | read_time="$r_time" \ |
118 | height="$height" | 118 | height="$height" |
119 | |||
120 | done | 119 | done |
121 | 120 | ||
121 | # generate rss feeds | ||
122 | echo "generating RSS feeds ..." | ||
123 | esh -s /bin/bash \ | ||
124 | -o "./docs/index.xml" \ | ||
125 | "rss.esh" | ||
126 | |||
122 | cat >> ./docs/index.html << EOF | 127 | cat >> ./docs/index.html << EOF |
123 | </table> | 128 | </table> |
124 | <div class="separator"></div> | 129 | <div class="separator"></div> |
@@ -0,0 +1,37 @@ | |||
1 | <rss version="2.0"> | ||
2 | <channel> | ||
3 | <title>nerdypepper's μblog</title> | ||
4 | <link>https://peppe.rs</link> | ||
5 | <description>programming, design, software</description> | ||
6 | <link href="https://peppe.rs/index.xml" rel="self" type="application/xml"/> | ||
7 | <image> | ||
8 | <title>nerdypepper logo</title> | ||
9 | <url>https://u.peppe.rs/n.png</url> | ||
10 | <link>https://peppe.rs</link> | ||
11 | </image> | ||
12 | <language>en-us</language> | ||
13 | <copyright>Creative Commons BY-NC-SA 4.0</copyright> | ||
14 | <% for f in `ls -t ./posts`; do | ||
15 | file="./posts/"$f | ||
16 | post_date=$(date -u -r "$file" "+%a, %d %b %y %H:%M:00 %z") | ||
17 | html=$(lowdown "$file") | ||
18 | id="${file##*/}" | ||
19 | id="${id%.*}" | ||
20 | post_title=$(echo "$id" | sed -E -e "s/\..+$//g" -e "s/_(.)/ \u\1/g" -e "s/^(.)/\u\1/g") | ||
21 | post_link="https://peppe.rs/posts/$id/" | ||
22 | |||
23 | echo "<item>" | ||
24 | |||
25 | echo "<title>$post_title</title>" | ||
26 | echo "<description>$html</description>" | ||
27 | echo "<link>$post_link</link>" | ||
28 | echo "<pubDate>$post_date</pubDate>" | ||
29 | echo "<guid>$post_link</guid>" | ||
30 | |||
31 | echo "</item>" | ||
32 | |||
33 | done | ||
34 | %> | ||
35 | |||
36 | </channel> | ||
37 | </rss> | ||