aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/index.xml519
1 files changed, 519 insertions, 0 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.
17It looked super gimmicky to me at first, but it eventually
18proved to be useful. Here&#39;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
23between my phone and my PC has always been a pain. I&#8217;m
24looking at you MTP. But, with <code>termux</code> and <code>sshd</code> all set up,
25it&#39;s as simple as:</p>
26
27<pre><code>$ arp
28Address HWtype HWad ...
29192.168.43.187 ether d0:0 ...
30
31$ rsync -avz 192.168.43.187:~&#47;frogs ~&#47;pics&#47;frogs
32</code></pre>
33
34<h3 id="ssh%20&amp;#38;%20tmux">ssh &#38; tmux</h3>
35
36<p>My phone doubles as a secondary view into my main machine
37with <code>ssh</code> and <code>tmux</code>. When I am away from my PC (read:
38sitting across the room), I check build status and IRC
39messages by <code>ssh</code>ing into a tmux session running the said
40build 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
45crippling. With a <code>bash</code> instance on my phone, I just copied
46over my ssh keys, and popped in a file upload script (a
47glorified <code>scp</code>). Now I just have to figure out a way to
48clean up these file names &#8230;</p>
49
50<pre><code>~&#47;storage&#47;pictures&#47; $ ls
5102muf5g7b2i41.jpg 7alt3cwg77841.jpg cl4bsrge7id11.png
52mtZabXG.jpg p8d5c584f2841.jpg vjUxGjq.jpg
53</code></pre>
54
55<h3 id="cmus">cmus</h3>
56
57<p>Alright, I don&#39;t really listen to music via <code>cmus</code>, but I
58did use it a couple times when my default music player was
59acting 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
69tooling (Keil C). But we don&#39;t do that here.</p>
70
71<h3 id="Building">Building</h3>
72
73<p>Assembling and linking ARM binaries on non-ARM architecture
74devices is fairly trivial. I went along with the GNU cross
75bare metal toolchain binutils, which provides <code>arm-as</code> and
76<code>arm-ld</code> (among a bunch of other utils that I don&#39;t care
77about 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
86architecture.</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
96cannot read nor execute binaries compiled for ARM. So, we
97simulate an ARM processor using <code>qemu</code>. Now qemu allows you
98to run <code>gdbserver</code> on startup. Connecting our local <code>gdb</code>
99instance to <code>gdbserver</code> gives us a view into the program&#8217;s
100execution. Easy!</p>
101
102<p>Run <code>qemu</code>, with <code>gdbserver</code> on port <code>1234</code>, with our ARM
103binary, <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>&#8217;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
114Reading 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&#39;s not nearly as comfortable as well
120fleshed out emulators&#47;IDEs like Keil. Watching registers,
121CPSR and memory chunks update <em>is</em> pretty fun. </p>
122
123<p>I came across <code>gdb</code>&#39;s TUI mode (hit <code>C-x C-a</code> or type <code>tui
124enable</code> at the prompt). TUI mode is a godsend. It highlights
125the current line of execution, shows you disassembly
126outputs, 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>! &#8220;GDB
131Enhanced Features&#8221; teaches our old dog some cool new tricks.
132Here are some additions that made my ARM debugging
133experience loads better:</p>
134
135<ul>
136<li>Memory watches</li>
137<li>Register watches, with up to 7 levels of deref (overkill,
138I agree)</li>
139<li>Stack tracing</li>
140</ul>
141
142<p>And it&#39;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
149dosen&#39;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
157reasons behind my <a href="https://u.peppe.rs/bF.png">color
158free</a> editor setup.</p>
159
160<p>Imagine highlighting an entire book because <em>all</em> of it is
161important. That is exactly what (most) syntax highlighting
162does. It is difficult for the human eye to filter out noise
163in rainbow barf. Use color to draw attention, not diverge
164it.</p>
165
166<p>At the same time, a book devoid of color is <em>boring!</em> What
167is the takeaway from this 10 line paragraph? What are the
168technical terms used?</p>
169
170<p>Prose and code are certainly different, but the fickle
171minded human eye is the same. The eye constantly looks for a
172frame of reference, a focal point. It grows tired when it
173can&#39;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
177right):</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
182between comments and code! The florid color scheme (far
183right) is no good either, it contains too many attention
184grabbers. The center sample is a healthy balance of both.
185Function calls and constants stand out, and repetitive
186keywords and other noise (<code>let</code>, <code>as</code>) are mildly dimmed
187out. Comments and non-code text (sign column, status text)
188are dimmed further.</p>
189
190<p>I&#39;ll stop myself before I rant about color contrast and
191combinations.</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
202my own. If you are more of the &#8216;show me the code&#8217; 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
208to 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&#47;</code> has to be the entry point. Markdown formatted posts
214go into <code>posts&#47;</code>, get converted into html, and end up in
215<code>docs&#47;index.html</code>, something like this:</p>
216
217<pre><code>posts=$(ls -t .&#47;posts) # chronological order!
218for f in $posts; do
219 file=&#34;.&#47;posts&#47;&#34;$f # `ls` mangled our file paths
220 echo &#34;generating post $file&#34;
221
222 html=$(lowdown &#34;$file&#34;)
223 echo -e &#34;html&#34; &#62;&#62; docs&#47;index.html
224done
225</code></pre>
226
227<h3 id="Assets">Assets</h3>
228
229<p>Most static site generators recommend dropping image
230assets into the site source itself. That does have it&#8217;s
231merits, but I prefer hosting images separately:</p>
232
233<pre><code># strip file extension
234ext=&#34;${1##*.}&#34;
235
236# generate a random file name
237id=$( cat &#47;dev&#47;urandom | tr -dc &#39;a-zA-Z0-9&#39; | fold -w 2 | head -n 1 )
238id=&#34;$id.$ext&#34;
239
240# copy to my file host
241scp -P 443 &#34;$1&#34; emerald:files&#47;&#34;$id&#34;
242echo &#34;https:&#47;&#47;u.peppe.rs&#47;$id&#34;
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>
248brings the above bits and pieces together (with some extra
249cruft to avoid javascript). It uses <code>sed</code> to produce nice
250titles from the file names (removes underscores,
251title-case), and <code>date(1)</code> to add the date to each post
252listing!</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
260these.</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
265to replicate on fresh installations. You can find my
266configuration 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&#8221; (2018)</a>.
270To keep things simple, I run a raw X session with <code>2bwm</code> as my
271window manager, along with <code>dunst</code> (notification daemon) and
272Sam&#39;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
277edit files with <code>vim</code>, chat with <code>weechat</code>, listen to music
278with <code>cmus</code>, monitor processes with <code>htop</code>, manage sessions
279with <code>tmux</code>, read pdfs in <code>zathura</code>. I rarely ever leave
280the comfort of my terminal emulator, <code>urxvt</code>.</p>
281
282<p>Most of my academic typesetting is done with TeX, and
283compiled with <code>xelatex</code>. Other <em>fun</em> documents are made with
284GIMP :).</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&#47;Linux on my main
292computer. Rolling release, non-systemd, need I say more?</p>
293
294<p>As with all GNU&#47;Linux distributions, wireless networks had
295me in a fix. If you can see this post, it means I&#39;ve managed
296to get online. It turns out, <code>wpa_supplicant</code> was detecting the
297wrong interface by default (does it ever select the right
298one?). Let us fix that:</p>
299
300<pre><code>$ sudo rm -r &#47;var&#47;service&#47;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
313background process:</p>
314
315<pre><code>$ sudo wpa_supplicant -B -i wlp2s0 -c &#47;etc&#47;wpa_supplicant&#47;wpa_supplicant.conf
316$ sudo dhcpcd -B wlp2s0
317$ ping google.com
318PING ...
319</code></pre>
320
321<p>Yay! Make those changes perpetual by enabling the service:</p>
322
323<pre><code>------------------------------------------------------
324# Add these to &#47;etc&#47;wpa_supplicant&#47;wpa_supplicant.conf
325OPTS=&#34;-B&#34;
326WPA_INTERFACE=&#34;wlp2s0&#34;
327------------------------------------------------------
328$ sudo ln -s &#47;etc&#47;sv&#47;wpa_supplicant &#47;var&#47;service&#47;
329$ sudo ln -s &#47;etc&#47;sv&#47;dhcpcd &#47;var&#47;service&#47;
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
341libraries,
342<a href="https://blogs.gnome.org/mclasen/2019/05/25/pango-future-directions/">announced</a>
343their plans for Pango 1.44.</p>
344
345<p>Until recently, Pango used FreeType to draw fonts. They will be moving over
346to <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
351provided no advantage over Harfbuzz (other than being able to fetch
352opentype 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>&#47;<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
358such as <code>xterm</code> and <code>rxvt</code> use <code>xft</code> (X FreeType) to render fonts, and will
359remain 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
363OpenType 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 &#8216;modern modal editor&#8217;, combining fancy
371interface and language features with vim-style modal editing. What&#39;s wrong you
372ask?</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>,
377Onivim 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>,
379which prohibits redistribution in both object code and source code formats.</p>
380
381<p>Onivim&#39;s core editor logic (bits that belong to vim), have been separated from
382the interface, into <a href="https://github.com/onivim/libvim">libvim</a>. libvim is
383licensed under MIT, which means, this &#8216;extension&#8217; of vim is perfectly in
384adherence to <a href="http://vimdoc.sourceforge.net/htmldoc/uganda.html#license">vim&#39;s license text</a>!
385Outrun Labs are exploiting this loophole (distributing vim as a library) to
386commercialize Onivim.</p>
387
388<p>Onivim&#39;s source code is available on <a href="https://github.com/onivim/oni2">GitHub</a>.
389They 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
391MIT-licensed code, <strong>18 months</strong> after each commit to the original repository.</p>
392
393<p>Want to contribute to Onivim? Don&#39;t. They make a profit out of your contributions.
394Currently, Onivim is priced at $19.99, &#8216;pre-alpha&#8217; pricing which is 80% off the
395final 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&#39;t let your editor get in your way. Here&#39;s a couple of neat
404additions you could make to your <code>vimrc</code> for a better shell programming
405experience.</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&#47;man.vim
412</code></pre>
413
414<p>Now, you can open manpages inside vim with <code>:Man</code>! It adds nicer syntax highlighting
415and 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 = &#39;tab&#39;
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
425a 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
428echo &#34;$1&#34; | sed -E -e &#34;s&#47;\..+$&#47;&#47;g&#34; -e &#34;s&#47;_(.)&#47; \u\1&#47;g&#34; -e &#34;s&#47;^(.)&#47;\u\1&#47;g&#34;
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
445edit index.html # in a buffer!
446w | so %
447!echo &#34;new_post.md&#34; | sed -E -e &#34;s&#47;\..+$&#47;&#47;g&#34; --snip--
448^--- note the use of &#39;!&#39;
449</code></pre></li>
450<li><p>Hit enter with the cursor on the line containing your command!</p>
451
452<pre><code>$ vim
453New Post # output
454Press 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 &#8220;big&#8221; changes to a file (a
464macro 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
469about the view of the current window. This includes the cursor line number,
470cursor coloumn, the top most line in the window and a couple of other values,
471none of which concern us.</p>
472
473<p>Before running our command (one that jumps around the buffer, a lot), we save
474our view, and restore it once its done, with <code>winrestview</code>.</p>
475
476<pre><code>let view = winsaveview()
477s&#47;\s\+$&#47;&#47;gc &#34; find and (confirm) replace trailing blanks
478winrestview(view) &#34; restore our original view!
479</code></pre>
480
481<p>It might seem a little overkill in the above example, just use `` (double
482backticks) instead, but it comes in handy when you run your file through
483heavier 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 &#34; :h gv for more
494 &#34; you can use `o` in visual mode to go to the `Other` end of the selection
495 &#34; 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`[ &#34; marks the beginning of the previously yanked text :h `[
501`] &#34; marks the end :h `]
502 v &#34; visual select everything in between
503
504nnoremap gb `[v`] &#34; &#34;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 &#34; put (p) and adjust indent to current line
509]P &#34; 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>