-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatom.xml
3925 lines (3637 loc) · 624 KB
/
atom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<title>Diéssica Gurskas</title>
<subtitle>My home in the internet where I muse about life and computers.</subtitle>
<link rel="self" type="application/atom+xml" href="/atom.xml"/>
<link rel="alternate" type="text/html" href="/"/>
<generator uri="https://www.getzola.org/">Zola</generator>
<updated>2024-09-29T14:00:15+00:00</updated>
<id>/atom.xml</id>
<entry xml:lang="en">
<title>Learning vim: From VS Code to neovim (Part 1)</title>
<published>2024-09-29T14:00:15+00:00</published>
<updated>2024-09-29T14:00:15+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="/blog/learning-vim/"/>
<id>/blog/learning-vim/</id>
<content type="html" xml:base="/blog/learning-vim/"><p>I’ve been a VS Code user for years, but today, I am giving vim (motions &amp; editor) another try. Why?</p>
<ul>
<li>I love keyboard navigation, and vim motions invite you to use your entire keyboard not only to type, going beyond the Ctrl+Shift+Command+Fn+^+{+/ hell.</li>
<li>neovim’s plugin ecosystem is GOLD for keyboard enthusiasts e.g. <a href="https://github.com/stevearc/oil.nvim">stevearc/oil.nvim</a>.</li>
<li>There’s a gap between my terminal and VS Code. No matter what extensions I throw at it, I can’t bridge it. Since I spend a lot of time in the terminal anyway, why not edit in it too?</li>
</ul>
<p class="note">Disclaimer: Not a beginner tutorial. Rather a (hopefully inspiring) diary of my vim journey. But if you're curious, I've dropped some learning resources below.</p>
<h2 id="today-i-learned">Today I learned</h2>
<h3 id="which-vim-editor">which vim editor?</h3>
<p>Many editors support vim motions, including VS Code itself. Technically, I could just <a href="https://www.reddit.com/r/vscode/comments/1enlqx1/my_minimal_vscode_setup_heavily_inspired_by_neovim/">make my VS Code more keyboard-centric</a> without switching editors. But right now, I’m exploring <a href="https://neovim.io/">neovim</a>, and learning vim motions across both VS Code and neovim. neovim is cute: small, fast, portable, extendable, widely supported, and not again owned by Microsoft.</p>
<h3 id="vim-kinda-has-4-modes">vim kinda has 4 modes</h3>
<ul>
<li>insert mode (<code>i</code> key; also other keys, see “the normal mode”): where you type and insert text, just like a traditional text editor.</li>
<li>visual mode (<code>v</code> key): where you select/highlight text visually, handy for copying/deleting/moving.</li>
<li>normal mode (<code>esc</code> key): where you navigate around the file, most of the time and most efficiently. Keys become “motions” and “operators” that move the cursor and act on text (deleting, finding, replacing).</li>
<li>command-line mode (<code>:</code> key): execute commands on vim, mostly editor-related, e.g. saving files, exiting vim.</li>
</ul>
<p>Traditional text editors offer ways to do the above in a permanent “insert mode”, but vim separates that across modes. Many mistakes happen because you’re not in the mode you thought you were, it helped me that the “normal” mode cursor looks different than the other modes.</p>
<h3 id="the-normal-mode">the normal mode</h3>
<p>There’s nothing normal about the normal mode, so I will say again: in vim’s normal mode, keys turn into “motions” (move you around the file) and “operators” (act on text, e.g. deleting, finding, replacing). Think of it as a mode with permanently enabled “Cmd” or “Ctrl” keys which you use to move around in a regular text editor (I hope?).</p>
<ol>
<li>navigating up (k), down (j), left (h), right (k). (Try not to <a href="https://en.wikipedia.org/wiki/Touch_typing">press l with your pinky finger</a>)</li>
<li>creating new lines under the cursor (o) and above (O)</li>
<li>jumping to next word (w), end of the word (e), or previous word (b)</li>
<li>jumping around lines of code with gg (line 0), G (end of file), {line number you wanna go to}G, {N}j to go down N lines, {N}k to go up N lines</li>
<li>inserting before cursor (i), inserting after cursor (a), insert in the beginning of line (I) or end of line (A)</li>
<li>jumping to beginning of the line (0), end of line ($), or beginning of word (_)</li>
<li>replacing a char (r) or word (R), deleting current character (x), deleting (d) e.g. a line (dd), next word (dw), previous word (db), basically a lot of the commands I’ve already learned above</li>
<li>searching within a line with f(character), plus next (n) and previous (N) occurrence</li>
<li>undo (u), redo (ctl+r). Pretty damn important, you make mistakes all the time.</li>
</ol>
<p>I practiced these commands in roughly that order, moving on once I felt <em>mostly accurate, though still slow</em>. It might seem like a lot, but it’s easier when it’s about muscle memory and not memorizing a cheatsheet. Once you start combining motions and operators, things get fun. For example: I already use <code>j</code> to move down, could <code>10j</code> jump down 10 lines? Yes (first I tried <code>j10</code> lol). Deleting 3 words backwards? <code>d3b</code>.</p>
<h3 id="little-vim-config">little vim config</h3>
<p>Feeling a bit lost in my editor, had to change some things. I said earlier I was curious about the ecosystem, but now I’m a little overwhelmed. For now, keeping it minimal:</p>
<pre data-lang="lua" style="background-color:#282a36;color:#f8f8f2;" class="language-lua "><code class="language-lua" data-lang="lua"><span style="color:#6272a4;">-- ~/.config/nvim/init.lua
</span><span style="color:#ff79c6;">local </span><span style="color:#ffffff;">o </span><span style="color:#ff79c6;">= </span><span style="color:#ffffff;">vim</span><span style="color:#ff79c6;">.</span><span>opt
</span><span>
</span><span style="color:#ffffff;">o</span><span style="color:#ff79c6;">.</span><span>number </span><span style="color:#ff79c6;">= </span><span style="color:#bd93f9;">true </span><span style="color:#6272a4;">-- Print the line number in front of each line
</span><span style="color:#ffffff;">o</span><span style="color:#ff79c6;">.</span><span>syntax </span><span style="color:#ff79c6;">= </span><span style="color:#f1fa8c;">&quot;on&quot; </span><span style="color:#6272a4;">-- When this option is set, the syntax with this name is loaded.
</span><span style="color:#ffffff;">o</span><span style="color:#ff79c6;">.</span><span>mouse </span><span style="color:#ff79c6;">= </span><span style="color:#f1fa8c;">&quot;a&quot; </span><span style="color:#6272a4;">-- Enable the use of the mouse. &quot;a&quot; you can use on all modes
</span><span style="color:#ffffff;">o</span><span style="color:#ff79c6;">.</span><span>termguicolors </span><span style="color:#ff79c6;">= </span><span style="color:#bd93f9;">true
</span></code></pre>
<p>(By the way, neovim uses Lua for configuration, if you’re wondering where the good old vimrc went…)</p>
<h2 id="references-for-slow-digestion-only">References for SLOW DIGESTION ONLY</h2>
<ul>
<li><a href="https://github.com/mhinz/vim-galore#first-steps">Everything you need to know about vim (GitHub)</a></li>
<li>CLI vimtutor (see above), or <a href="https://openvim.com/">Web interactive vim tutorial</a></li>
<li><a href="https://quickref.me/vim">QuickRef vim cheatsheet</a> / - <a href="http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html">Graphical vi-vim Cheat Sheet and Tutorial</a></li>
<li><a href="https://www.youtube.com/watch?v=X6AR2RMB5tE&amp;list=PLm323Lc7iSW_wuxqmKx_xxNtJC_hJbQ7R">“vim as your editor” (YouTube), by ThePrimeagen</a></li>
</ul>
<h2 id="that-s-all-for-now">That’s all for now</h2>
<p>Back in my teenage years, I tried to learn vim and quickly gave up. Coding was already confusing enough, and I figured, “what’s the point of typing faster if I don’t even know what to type?”. Which was pretty wise, in hindsight. Pretty sure I peaked in wisdom right there.</p>
<p>Jokes aside (it was not a joke), I’m still far from hyper-productive on vim. But I wrote this blog post with it, felt focused and felt plenty of fun, which is productive enough I guess? Whether this is novelty, or the vim advantage, only time will tell. Plenty of people go from VS Code to neovim and then back again. Who knows.</p>
<p>Now, the text column width on this editor has been full screen since I started this post, and I’m on the edge of installing <a href="https://github.com/folke/zen-mode.nvim">zen-mode.nvim</a>. Just gotta figure out what is this lazy nvim vs. packer thing.</p>
<p>:wq</p>
</content>
</entry>
<entry xml:lang="en">
<title>Misc(ellaneous)</title>
<published>2024-09-20T11:02:00+00:00</published>
<updated>2024-09-20T11:02:00+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="/misc/"/>
<id>/misc/</id>
<content type="html" xml:base="/misc/"><h2 id="open-to-work-dove">Open to work 🕊️</h2>
<p>Beyond my silly online presence, <strong>I’m a multidisciplinary creative partner in projects</strong> and can likely assist you from idea to launch! With over a decade of experience as a computer programmer, I’ve honed my skills in web development, led engineering teams, managed projects, and even designed UI/UX. Just get in touch :-)</p>
<h2 id="get-in-touch">Get in touch</h2>
<p>I’m happy to hear from most humans on most things. Say hi!</p>
<ul>
<li><a href="https://bsky.app/profile/diessica.bsky.social">Bluesky</a> for silly stuff.</li>
<li><strong><a href="https://useplaintext.email/">Plain text email</a></strong>: <a href="mailto:[email protected]">[email protected]</a>.</li>
<li><strong><a href="https://signal.org">Signal</a></strong> for serious stuff. <strong>⭐ Preferred as it’s encrypted ⭐</strong>
<ul>
<li>Don’t have my Signal? Please email me with your name and your reason to contact me.</li>
</ul>
</li>
</ul>
<h2 id="metadata">Metadata</h2>
<div class="flex flex-wrap not-prose">
<img src="/badges/browser.png" width="80" height="41" alt="Viewable with any browser" />
<!-- <img src="/badges/js.png" alt="JavaScript-free page" /> -->
<img src="/badges/screen.gif" width="80" height="41" alt="Best viewed in hi-colors 800x600 screens" />
<img src="/badges/nocookie.png" width="80" height="41" alt="This site is certified 100% cookie-free" />
<a href="https://diessi.ca/atom.xml"><img src="/badges/rss.gif" width="80" height="41" alt="Valid RSS" /></a>
<img src="/badges/trapped.gif" width="80" height="41" alt="Trapped inside da web" />
<a href="https://github.com/diessica/diessica.github.io"><img src="/badges/github.gif" width="80" height="41" alt="GitHub" /></a>
</div>
<p>This is my independent home on the internet. On my blog, I try to share knowledge and perspectives on what I find interesting – sometimes computers. When I write, please assume <a href="https://en.wiktionary.org/wiki/IMHO">IMHO</a>/<a href="https://en.wiktionary.org/wiki/IMNSHO">IMNHSO</a> and openness for dialogue.</p>
<p>You may receive my blog updates by subscribing to <a href="https://diessi.ca/atom.xml">my RSS Feed</a>.</p>
<h3 id="license-attribution">License &amp; Attribution</h3>
<ul>
<li>Pages are statically generated with <a href="https://www.getzola.org/">Zola</a> as engine.</li>
<li>88x31 buttons by <a href="https://cyber.dabamos.de/88x31/">The 88x31 GIF Collection</a>.</li>
<li>All my content licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a>.</li>
</ul>
<h3 id="your-privacy">Your Privacy</h3>
<ul>
<li>No analytics tracking. No cookies.</li>
<li>Third-parties usage: Hosted by <a href="https://github.com/diessica/diessica.github.io">GitHub Pages</a> behind <a href="https://www.cloudflare.com/en-gb/privacypolicy/">Cloudflare</a> as CDN.</li>
</ul>
</content>
</entry>
<entry xml:lang="en">
<title>We Misunderstand Learning</title>
<published>2024-09-19T13:13:42+00:00</published>
<updated>2024-09-19T13:13:42+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="/blog/we-misunderstand-learning/"/>
<id>/blog/we-misunderstand-learning/</id>
<content type="html" xml:base="/blog/we-misunderstand-learning/"><p><em>We misunderstand learning.</em> We think learning happens as we consume information, so we insist on consumption, hoping it will make sense. Reading sparks new ideas—yet often we merely seek out validation for the ones we already have. <em>We misunderstand learning.</em> We cling to theory like a lifeline, as though it can stand on its own, while overlooking the experimental space where it transforms: practice. Perhaps we gamify it. (Unlearning our addictions is another matter entirely.) We escape the confusion that must linger–it slips us that lingering isn’t forever. <em>We misunderstand learning.</em> Through edutainment, we satisfy the illusion of smooth progress, estimated reading times, chapter after chapter. True learning is too disjointed, unpredictable, and fraught with setbacks. We obsess over minimising gaps between repetitions, but are these gaps learning breaks, or learning itself? I recall the first time I picked up a guitar: my fingers aching to stretch, shredding like crazy against the strings. The morning after, I played the chord—not through conscious effort or passion, but because my fingers developed dexterity and calluses overnight. <em>We misunderstand learning.</em> Technique matters, yes, but some processes of embedding patterns are handled by our bodies in their own time. Others always seem to have it easier, so we feel ashamed. I won’t lie–some do have it easier. But most often we don’t know, we weren’t there to see behind the ease, and nobody’s quite vulnerable these days.</p>
<p>We misunderstand learning, but once, we were in intimate touch with it. Back when we hadn’t yet been subjected to environments of comparison, deadlines, narrow molds, and had our complexities and neuro-diversities amassed into pure functions. I’m still not immune to this. At times, learning as an adult feels like a endless chase of the instinctive dance of curiosity it once was. Throw at it: Pomodoro timers, habit trackers and productivity hacks. Yet, it’s only when I sit down to an unmysterious learning practice and truly welcome confusion, chaos, and seeming non-productivity that I feel like I can dance with curiosity again, and learn.</p>
</content>
</entry>
<entry xml:lang="en">
<title>Fetch a npm package on GitHub without npm install</title>
<published>2024-08-25T16:30:00+00:00</published>
<updated>2024-08-25T16:30:00+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="/blog/fetch-npm-package-without-npm-install/"/>
<id>/blog/fetch-npm-package-without-npm-install/</id>
<content type="html" xml:base="/blog/fetch-npm-package-without-npm-install/"><p>The other day, a npm package was released broken to a private GitHub registry and it wouldn’t install:</p>
<pre style="background-color:#282a36;color:#f8f8f2;"><code><span>&gt; npm install @company/my-package
</span><span>This error happened while installing the dependencies of @company/[email protected]
</span><span>
</span><span>another-package is not in the npm registry, or you have no permission to fetch it.
</span></code></pre>
<p>The error message is clear: the released package <code>@company/my-package</code> I’m trying to install depends on a package <code>another-package</code> expected to exist in the npm registry somewhere. But <code>another-package</code> is not there. I already knew those packages came from a monorepo, so likely <code>another-package</code> was only an internal dependency in the monorepo, left unreleased. I wanted to inspect the package contents before releasing any fix to be sure, but couldn’t rely on <code>npm install</code> for that. There used to be an option to download npm packages via GitHub UI, but that’s no longer the case.</p>
<h2 id="finding-the-package-tarball">Finding the package tarball</h2>
<p>One can read the package’s metadata to find a download URL for the package’s latest version. Here’s how:</p>
<ol>
<li>
<p>(For private GitHub registries) Grab a <a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic">classic GitHub token</a> with <code>packages:read</code> permissions (hereafter <code>{GITHUB_TOKEN}</code>).</p>
</li>
<li>
<p>The URL of a npm package published to GitHub is <code>https://npm.pkg.github.com/{PACKAGE_NAME}</code>. Use that to fetch the package metadata, which contains the package tarball URL.</p>
</li>
</ol>
<pre data-lang="sh" style="background-color:#282a36;color:#f8f8f2;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#ff79c6;">&gt;</span><span> curl </span><span style="color:#50fa7b;">-L</span><span style="font-style:italic;color:#ffb86c;"> -H </span><span style="color:#f1fa8c;">&quot;Authorization: Bearer {GITHUB_TOKEN}&quot; &quot;https://npm.pkg.github.com/@company%2Fmy-package&quot; </span><span style="color:#ff79c6;">| </span><span style="color:#50fa7b;">grep</span><span style="font-style:italic;color:#ffb86c;"> -o </span><span style="color:#f1fa8c;">&#39;&quot;tarball&quot;:&quot;[^&quot;]*&quot;&#39;
</span><span style="color:#f1fa8c;">&quot;tarball&quot;</span><span style="color:#50fa7b;">:</span><span style="color:#f1fa8c;">&quot;https://npm.pkg.github.com/download/@company/my-package/0.0.34/3d0304f38791214b09ec92a2262ca1697f&quot;
</span></code></pre>
<ol start="3">
<li>Download the package using the tarball URL.</li>
</ol>
<pre data-lang="sh" style="background-color:#282a36;color:#f8f8f2;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#ff79c6;">&gt;</span><span> curl </span><span style="color:#50fa7b;">-L</span><span style="font-style:italic;color:#ffb86c;"> -H </span><span style="color:#f1fa8c;">&quot;Authorization: Bearer {GITHUB_TOKEN}&quot; &quot;https://npm.pkg.github.com/download/@company/my-package/0.0.34/3d0304f38791214b09ec92a2262ca1697f&quot; </span><span style="color:#ff79c6;">| </span><span style="color:#50fa7b;">tar</span><span> zx
</span></code></pre>
<p>That will download the package to your current folder, and you may inspect the package contents now. :-)</p>
</content>
</entry>
<entry xml:lang="en">
<title>The Bitter Reality of Ebooks and the Kindle Model</title>
<published>2023-08-16T13:55:00+00:00</published>
<updated>2023-08-16T13:55:00+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="/blog/the-bitter-reality-of-ebooks/"/>
<id>/blog/the-bitter-reality-of-ebooks/</id>
<content type="html" xml:base="/blog/the-bitter-reality-of-ebooks/"><p>A few years back, I jumped into the world of ebooks to broaden my reading without stacking so many physical books. I went with the ever-popular Kindle; yet the full weight of “owning” ebooks, particularly from Amazon, was not something I understood.</p>
<p>…Until I decided to break up with Amazon, despite its convenience. You know the drill: Amazon <a href="https://www.theguardian.com/technology/2020/feb/05/amazon-workers-protest-unsafe-grueling-conditions-warehouse">exploits workers</a>, <a href="https://fairtaxmark.net/tax-gap-of-silicon-six-over-100-billion-so-far-this-decade/">aggressively avoids taxes</a>, <a href="https://www.bloomberg.com/graphics/2019-amazon-reach-across-markets/">dominates markets</a>, and I was just itching to explore alternative bookstores. The hiccup? My Kindle was firmly rooted and entangled in Amazon’s ecosystem. Without Amazon, I could no longer conveniently <em>or legally</em> read books on my Kindle, and without Kindle, I could not legally read books I once purchased on Amazon.</p>
<p>Here’s what I’ve learned while attempting to part ways.</p>
<h2 id="it-all-begins-with-drm">It all begins with “DRM”</h2>
<p>Digital Rights Management (“DRM”) might not be a household term, yet its fingerprints are everywhere. <strong>Ever wondered how we consume content via proprietary software, rather than owning the content?</strong></p>
<p>Think Spotify (you never own the music), Netflix (you never own the film), Adobe Creative Cloud (you never own the software), Steam (you never own the game), and Amazon Kindle (you never own the ebook). You download those proprietary software on your device, not the content itself. While you may have a license to the content, but it’s not <em>truly</em> yours.</p>
<p>The use and distribution of the copyrighted content provided by those services (and many others) are restricted by DRM (“<em>Digital Rights Management</em>”) technologies, <a href="https://en.wikipedia.org/wiki/Digital_rights_management#Technologies">implemented in various ways, increasingly restrictive and controversial</a>. While DRM aims to address the legitimate need of copyright protection, it fundamentally reshapes the landscape of intellectual consumption, often at the expense of user privacy and freedom. For example:</p>
<ul>
<li>
<p><strong>Content Sharing</strong>: DRM often limits, or restricts altogether, the ability to share, lend and gift content outside of the same ecosystem.</p>
</li>
<li>
<p><strong>Content Portability</strong>: DRM can authorise content to only a specific set of devices or apps, and restrict the supported file formats (even to a proprietary format). That limits content migration across platforms, technologies and devices that better suit you.</p>
</li>
</ul>
<p class="note">The points above reveal an alarming side-effect: dependency on the ecosystem, or "<b>vendor lock-in</b>", which is detrimental to individual freedom and market competition. When content is tightly bound to the platform, disengaging becomes challenging. And when you're limited to sharing only within an ecosystem, your social circle gets roped in too. Kinda seem like cute digital mutualism until it's a toxic relationship you can't leave.</p>
<ul>
<li>
<p><strong>Content Perpetuity</strong>: DRM cannot guarantee perpetual access to content. If a service or platform discontinues the content or themselves entirely, you may simply lose what you purchased. In fact, <a href="https://www.bbc.com/news/technology-47810367">that has already happened</a>, <a href="https://www.nytimes.com/2009/07/18/technology/companies/18amazon.html">more than once</a> or <a href="https://www.bekkelund.net/2012/10/22/outlawed-by-amazon-drm/">twice</a>.</p>
</li>
<li>
<p><strong>Content Geographical Restrictions</strong>: DRM can prevent access to certain content based on location. With the internet alone, we could technically provide equal access to cultural and educational resources – DRM kills that.</p>
</li>
<li>
<p><strong>Content Offline Access</strong>: DRM often requires <em>online</em> authentication or periodic online checks. Not very nice in low connectivity areas or during travel.</p>
</li>
<li>
<p><strong>Personal Identification</strong>: DRM requires authentication to consume content. By withholding identifiable information, DRM systems may also monitor behavior and consumption patterns and then profile you. <a href="https://en.wikipedia.org/wiki/Nothing_to_hide_argument">You’ve got nothing to hide</a>? Well, perhaps it at least bothers you to have to login? <a href="https://en.wikipedia.org/wiki/Straw_man">(And if that keeps going on we might soon have login on physical books too?! And there will be no refresh token cookie irl?!?????)</a></p>
</li>
</ul>
<p>All those “side-effects” (given they are actually unintended 😉) of copyright protection through DRM conveniences corporations. Corporations may not only protect their profit but also <em>actively profit</em> through DRM, charging high customer cost while delivering zero customer value.</p>
<p>Finally, because DRM implementations vary so much, it’s nearly impossible to determine your rights without diving into lengthy terms of use agreements. The restrictions are rather obscured by clever marketing – you’ll soon see.</p>
<h2 id="leaving-amazon-and-failing">Leaving Amazon, and failing</h2>
<p>Do you still remember I was trying to break up with Kindle? I get too hung up sometimes but let’s not forget why we’re both here, right!!?!</p>
<p>First things first, let me make it clear – I did not want to give up ebooks. It’d been a pleasure to be able to dive into new literature and keep only the gems in my bedroom bookshelf. And I could also carry a multitude of stories effortlessly during my travels.</p>
<p>Secondly, I had no intention of trashing my Kindle. It was a fully functional piece of hardware, and it worked well.</p>
<p>So here was my grand plan: I’d log out of my Amazon account on the Kindle, and source my ebooks somewhere else. Seems pretty straightforward, right? But the hurdles kicked in right from the very first step.</p>
<p class="note">FuN fACt: <a href="https://www.bbc.com/news/technology-19907546">Kindle sales are not very profitable to Amazon</a>, as they hope to make up for it with e-book and app sales.</p>
<p>As it turns out, signing out of my Amazon account meant every single piece of content I’d ever acquired through Kindle would vanish into thin air. On Kindle, your books are tied to your Amazon account.</p>
<p>That was an unforeseen repercussion. I naïvely expected to hold rights over books I’d purchased regardless of whether they were digitally or physically distributed. So I was disappointed and surprised – with myself, the state of things; both. And yes, I clearly had not read Kindle terms of use back when I got into the ecosystem (otherwise you wouldn’t be reading this! 😉).</p>
<h3 id="finally-reading-kindle-terms-of-use">FINALLY reading Kindle Terms of Use</h3>
<p>The latest <strong><a href="https://www.amazon.com/gp/help/customer/display.html?nodeId=201014950">Kindle Store Terms of Use</a></strong> (Last updated: November 30, 2022), determines a set of restrictions you buy into when you decide to buy Kindle and Kindle content, DRM-protected or not. The “Use of Kindle Content” section states a couple of DRM-ish things:</p>
<ol>
<li>ebooks are meant to be consumed only on Kindle, or Kindle apps.</li>
</ol>
<p class="note">Upon your download or access of Kindle Content and payment of any applicable fees (including applicable taxes), the Content Provider grants you a non-exclusive right to view, use, and display such Kindle Content an unlimited number of times (for Subscription Content, only as long as you remain an active member of the underlying membership or subscription program), <b>solely through a Kindle Application or as otherwise permitted as part of the Service, solely on the number of Supported Devices specified in the Kindle Store</b>, and solely for your personal, non-commercial use. [...]</p>
<ol start="2">
<li>when you click “Buy Now”<sup class="footnote-reference"><a href="#1">1</a></sup>, you are actually buying a license i.e. renting.</li>
</ol>
<p class="note">Kindle Content is licensed, not sold, to you by the Content Provider. [...]</p>
<p>Coming from DRM-based services like Spotify or Netflix, where you subscribe for access to a collection of music or film, the Kindle model might be a surprise.</p>
<p>Within the Kindle ecosystem, you are able to buy <em>individual</em> content, which does evoke a stronger sense of direct ownership. Yet, when you do so, you’re essentially obtaining a license: every ebook is an one-off payment to a mini-subscription. And that was absolutely not straightforward or intuitive to me.</p>
<ol start="3">
<li>you may not lend or sell your ebooks.</li>
</ol>
<p class="note">Unless specifically indicated otherwise, you may not sell, rent, lease, distribute, broadcast, sublicense, or otherwise assign any rights to the Kindle Content or any portion of it to any third party [...]</p>
<ol start="4">
<li>your books might disappear anytime.</li>
</ol>
<p class="note">We may change, suspend, or discontinue the Service, in whole or in part, including adding or removing Subscription Content from a Service, at any time without notice.</p>
<p>(Funny enough, I checked <a href="https://web.archive.org/">Wayback Machine</a> and noticed that one was amended around March 2015, after reports of disappearing ebooks years before. 🤷)</p>
<h3 id="and-embracing-the-sacrifice">…And embracing the sacrifice</h3>
<p>Delving into the Kindle’s terms brought the truth crashing down on me: I never really had a choice to transition away from Amazon while retaining my content. Severing ties with Kindle came at a cost I hadn’t anticipated, and I felt very exploited for it.</p>
<p>Some might argue I <em>actually</em> had the “choice” to enter Kindle’s ecosystem. And sure, it’s true – I did it willingly, no one coerced me into becoming a Kindle user. But, hey, there’s a nuanced reality here you can’t brush aside: we make our individual choices <em>within systems</em>. There’s an entire environment lying behind the notion of individual choice.</p>
<p>Systems can be designed to subtly exert control or exploit personal choice in ways that aren’t always apparent. You can’t look at individual choice alone overseeing the environment in which those decisions are made. In no defensiveness, blaming on individual choice is, I dare to say, exactly how exploitative systems maintain their facade of legitimacy. And I don’t think being exploited or not should be a choice to be made.</p>
<p>Yeah, a bitter pill to swallow, but a new plan has to emerge out of my anger: to log out of my Amazon account, <strong>and therefore leave books I’ve purchased behind</strong>, and use Kindle only as an e-reader, not a shop.</p>
<h2 id="leaving-amazon-and-failing-less">Leaving Amazon, and failing less</h2>
<p>After logging out of my Amazon account, I’m left with an anonymised Kindle (I hope). At this point I wonder if I even have the right to keep the hardware I’ve purchased, but so far nobody hasn’t taken it away from me. 😉 So, how can I rebuild my e-book library?</p>
<h3 id="using-kindle-with-other-bookstores">Using Kindle with other bookstores</h3>
<p>Before buying ebooks elsewhere, one needs to understand what file formats are supported by Kindle. The file formats supported by Kindle are MOBI, PRC, PDF, and primarily the proprietary AZW, and the files may or may not be DRM-protected depending on the publisher. <strong>Only Amazon sells AZW books<sup class="footnote-reference"><a href="#2">2</a></sup></strong>. So my options are:</p>
<ul>
<li>MOBI. But no bookstores sell them these days.</li>
<li>PDF. But formatting sucks for reading books.</li>
<li>PRC. I don’t know what that is.</li>
</ul>
<p>So I have no options. \😎/ Bookstores sell <a href="https://en.wikipedia.org/wiki/EPUB">EPUB</a> books, an open standard well supported by all e-readers in the market <strong>but Kindle</strong>. Fortunately, you can manually convert EPUB books into one of the Kindle-compatible formats above. Unfortunately, if the book is DRM-protected (very likely!), you would need to strip out DRM before conversion <strong>which is downright illegal LMAOOOOOO</strong>!!!!! This drives me CRAZY, but let’s move on.</p>
<p>For ebook format conversions, Amazon fortunately offers <a href="https://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765261">Kindle Previewer</a>, a publishing software, but it’s just a little too bloated for my goal. So I went with <a href="https://github.com/kovidgoyal/calibre">Calibre</a>, a free and open source e-book manager that does it all. It works wonders!</p>
<p class="note">If you keep your Amazon account, importing EPUB into is easier with <a href="https://www.amazon.com/gp/sendtokindle/email">Send to Kindle</a>. It's a more convenient option but it often messes up with the book formatting.</p>
<p>Ultimately, using non-Amazon ebooks on a Kindle device can involve various technical and legal considerations, especially when dealing with DRM-protected content. DRM-free book shopping is also limited – DRM <em>is</em> an industry standard! <strong>So using a Kindle without Amazon is not just very inconvenient, it’s barely legal.</strong> 😉</p>
<p>The most promising plan seems to be tossing Kindle altogether, and choose an open standard e-reader with less hostile DRM platforms, but that’s for another time.</p>
<h2 id="amazon-caters-for-publishers-not-consumers">Amazon caters for publishers, not consumers</h2>
<p>It all makes sense when you put it all together. When traditional publishing giants contemplated the world of e-readers and online stores, they had to be a bit careful about it. With physical distribution, they already had a model that offered a clear sense of ownership and control. Then, remember the music industry’s digital transformation, marked by piracy and revenue decline<sup class="footnote-reference"><a href="#3">3</a></sup>? Obviously publishers would be wary of a similar fate.</p>
<p>But in comes a compelling offer from Amazon: a tight grip on digital ownership of books, and a shortcut into an already profitable book marketplace. All or nothing. A captivating promise of control and access which publishers, late to digital transformation, did not pass up. And so seamlessly, Amazon paved the way towards market dominance. 👏</p>
<p>Today, Amazon also positions itself as a platform for emerging writers and attracts independent publishers. So does Spotify for musicians, and Steam for game developers. For both publishers and consumers, content discovery is what’s great about such platforms, despite their license model.</p>
<p>Alternatives like Bandcamp (music) and GOG.com (games) also promote publishers’ content. In contrast, their DRM-free<sup class="footnote-reference"><a href="#4">4</a></sup> model ethically caters to both consumers and publishers: the consumer has direct ownership to content, and publishers get their content secured, even earning more<sup class="footnote-reference"><a href="#5">5</a></sup>. How does that work? Fingerprinting content files (i.e. watermarks), but above all, cultivating consumer trust and transparency, and a sense of community and support for artists.</p>
<h2 id="final-words">Final words</h2>
<p>While writing this, an analogy came to mind.</p>
<p>Picture when you buy a physical book from a store. You know that book will patiently await you right where you left it and not vanish into thin air, whether you frequent the store or it eventually shuts down. That store is unaware of your identity. It doesn’t know when you open or close the book, nor does it know which passages you’ve highlighted. You can even lend the book to a friend, regardless of whether they shop at the same store or if the store recognizes them. And that both of you can go buy books elsewhere later with no strings attached.</p>
<p>But I know that’s kinda corny. It’s an oversimplification. Digital content IS different, and copying files is far easier technically than producing physical copies. We do have new challenges.</p>
<p>Yet, while the analogy might not outright invalidate DRM as a solution, it can serve as a reminder of the current asymmetry of our digital rights today. A nudge to the way our essential rights are exploited within the current framework of digital copyright protection. And, ultimately, it extends an invitation to reimagine it from the ground up. Perhaps looking at how other platforms like Bandcamp have already done so brilliantly, perhaps radically starting at copyright itself.</p>
<h2 id="keep-reading">Keep reading</h2>
<p>…on how despite massive technical effort and corporate interest, DRM is a flawed security model.</p>
<ul>
<li><a href="https://wiki.openrightsgroup.org/wiki/Digital_Rights_Management">Open Rights Group: Digital Rights Management</a></li>
<li><a href="https://www.defectivebydesign.org/guide/ebooks">Defective by Design: Guide to DRM-Free Literature</a></li>
<li><a href="https://www.defectivebydesign.org/faq">Defective by Design: DRM FAQ</a></li>
<li><a href="https://en.wikipedia.org/wiki/Comparison_of_e-readers#File_format_support">Comparison of e-readers: File format support</a></li>
<li><a href="https://meshedinsights.com/2017/07/09/drm-is-toxic-to-culture/">DRM is Toxic to Culture</a></li>
</ul>
<div class="footnote-definition" id="1"><sup class="footnote-definition-label">1</sup>
<p>As of 16/08/2023, Amazon’s checkout button for Kindle ebooks is labeled “Buy Now”.</p>
</div>
<div class="footnote-definition" id="2"><sup class="footnote-definition-label">2</sup>
<p><a href="https://s3-us-west-2.amazonaws.com/customerdocumentation/EM/Kindle_User_Guide_EN-US.pdf">“Kindle User Guide 4th Edition</a>, p. 39</p>
</div>
<div class="footnote-definition" id="3"><sup class="footnote-definition-label">3</sup>
<p><a href="https://www.sowi.uni-stuttgart.de/dokumente/forschung/soi/soi_2020_4_Dolata.digital.transformation.music.industry.pdf">Ulrich Dolata, “The Digital Transformation
of the Music Industry: The Second Decade: From Download to Streaming” (2020)</a>, p. 7</p>
</div>
<div class="footnote-definition" id="4"><sup class="footnote-definition-label">4</sup>
<p>See <a href="https://get.bandcamp.help/hc/en-us/articles/360013673153-Are-Bandcamp-s-download-formats-DRM-free-">Are Bandcamp’s download formats DRM-free?</a> and <a href="https://www.gog.com/news/bgog_2022_update_2b_our_commitment_to_drmfree_gaming">GOG 2022 UPDATE #2: OUR COMMITMENT TO DRM-FREE GAMING</a>.</p>
</div>
<div class="footnote-definition" id="5"><sup class="footnote-definition-label">5</sup>
<p>In comparison to Spotify, whose profit margin for publishers is often questioned. See <a href="https://www.nytimes.com/2021/05/07/arts/music/streaming-music-payments.html">Ben Sinano: Musicians Say Streaming Doesn’t Pay. Can the Industry Change?</a>.</p>
</div>
</content>
</entry>
<entry xml:lang="en">
<title>Long Time No See</title>
<published>2023-06-30T11:19:00+00:00</published>
<updated>2023-06-30T11:19:00+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="/blog/long-time-no-see/"/>
<id>/blog/long-time-no-see/</id>
<content type="html" xml:base="/blog/long-time-no-see/"><p>In the past three years, a wild mix of stuff dragged me away from writing. More time 🌳 offline ⛰️, which was great. Then a demanding role in a small team, the chaotic grip of a global pandemic, increasing perfectionism, and a blossoming and ultimately collapsing relationship – which all conspired to shake up my pursuits and thrust me into an introspective whirlwind. And as if that wasn’t difficult enough, I lost two years’ worth of drafts in a backup blunder.</p>
<p>Whenever I attempted to restart, I found myself entangled in a web of what still resonated with me and what no longer did. But hey, listing more excuses would only scratch the surface. I recognize now, after seeing how little it takes for me to be back, that parts of me were simply in disarray. Yet, as I come together again, so does my motivation to reclaim what I enjoy, and make time for it despite the busyness and excuses.</p>
<p>So, last night, I did what I do best: I embarked on an in-one-sitting endeavor! I migrated this blog to <a href="https://www.getzola.org/documentation/getting-started/overview/">Zola</a> (a speedy static generator written in Rust), so this WeBpAg3 remains therefore static and snappy af, joining the <a href="https://512kb.club/">&lt;512 kB club</a>. Letting my creativity flow with <a href="https://tailwindcss.com/">Tailwind</a>, I gave my WeBpAg3 an extravagant-outrageous look, and made sure it’s accessible. I rewrote my introduction like a million times. I sifted through my writings, organising and archiving some, and lo and behold!: I stumbled upon those lost drafts hidden away in the depths of my physical backups. <em>Pretty thrilling.</em> As a friend once told me, <strong>good things happen when good things happen</strong>.</p>
<p>Long time no see! It all feels quite nice, if you ask me. 😉</p>
</content>
</entry>
<entry xml:lang="en">
<title>What I've Learned by Simply Journaling</title>
<published>2020-04-20T00:10:15+00:00</published>
<updated>2020-04-20T00:10:15+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="/blog/journaling/"/>
<id>/blog/journaling/</id>
<content type="html" xml:base="/blog/journaling/"><p>In 2018, circumstances inevitably changed and I began taking up much more in life. I was under stress, regardless of being on the safe side, and the patterns that kept me grounded were no longer holding up.</p>
<p>Back then, seeing the big picture was unattainable with the stress snowballing and skewing my perspective. Dwelling in my head, paving the way to <a href="https://en.wikipedia.org/wiki/Learned_helplessness">learned helplessness</a>, I decided to try out journaling.</p>
<p>More than a year later, I can finally say <em>alles gut</em>. Although circumstances haven’t changed much, I certainly handle them better. I keep journaling as of today, and am excited to share my setup and (hopefully) motivating takeaways!</p>
<h2 id="how-i-journal">How I Journal</h2>
<p>I did not go for the traditional diary format. I decided to Bullet Journal, a flexible journal method founded in quick lifelogging by means of a pen, paper, and bullet points.</p>
<p>Pen and paper pull me out of my head and let me continuously evolve my notebook as my needs change, since there is no predefined template. As for bullet points, we all know their efficacy: hasty logging and later reviewing at a glimpse.</p>
<h3 id="method">Method</h3>
<p class="note">Peek into <a href="https://bulletjournal.com/pages/learn">Bullet Journal official page</a> for an overview, as I won't dive into the framework basics.</p>
<p>The Bullet Journal framework is made out of four fundamental “collections”: Index, Daily Log, Monthly Log, and Future Log, plus custom collections you find valuable. After a while of tinkering around, I came to some insights and tweaks.</p>
<ul>
<li>
<p><strong>Index</strong> turned out useful when I added custom collections, as those usually end up scattered across the journal and thus hard to find.</p>
</li>
<li>
<p><strong>Daily Logs</strong> is where I keep track of notes, events, tasks, thoughts, and ideas. (All mixed together, which portrays a day accurately if you ask me.) I recommend using signifiers and nesting (for a tree-like view) in bullet points to convey meaning with ease, as Bullet Journal suggests.</p>
</li>
<li>
<p><strong>Monthly Log</strong> didn’t work for me. I steer towards weekly or quarterly ranges. Also, my online calendar is more practical so I couldn’t bother drawing calendars every month.</p>
</li>
<li>
<p><strong>Future Logs</strong> are useful to migrate tasks or events to upcoming months, for when you don’t get something done but can’t “nevermind” it either.</p>
</li>
</ul>
<p>As for custom collections, the Bullet Journal ecosystem is huge! I’ve seen stuff of all kinds out there: finance/sleep/food/water trackers, recipes, trip planning, doodles, and whatnot. Yet, these are the ones I always come back to:</p>
<ul>
<li><strong>Diaries</strong>: longer diary entries or brain dumps without the limitation of bullet points, for when I feel like it.</li>
<li><strong>Habit Trackers</strong>: a simple daily tracker to monitor or develop habits across weeks, e.g. meditation, alcohol intake, call family.</li>
<li><strong>Weekly Logs</strong>: my weekly variation of “Monthly Log”, with upcoming events and small goals for the week. Usually done on Sunday or Monday.</li>
<li><strong>Quarterly Logs</strong>: my quarterly variation of “Monthly Log”, with upcoming events and big goals for the quarter.</li>
<li><strong>Year Retrospective</strong>: a straightforward year review regarding what did and did not go well, what to keep or let go from last year etc.
I journal spontaneously throughout the day, but mostly in mornings or evenings. I do it every day, even when I don’t feel like it. In the long run, that’s gotten me to fathom my anxieties by having them logged as well as what was up days before. It goes a long way to flip through logs of piled up chores, social isolation, binge drinking, and sleep deprivation, to later find yourself taking down “I am anxious. Can’t do shit”.</li>
</ul>
<p>Be that as it may, I don’t keep it all gloomy. With my throughput in mind, I may also soften up my daily logs with receipts from exquisite restaurants I come across, cute post-its from friends, or even silly useless quotes from fortune cookies.</p>
<p>At last, I have to say I’m not really a big planner so you can see that’s not what I optimise my journal for. All I strive for is a little awareness of whatever I’m doing for the time being. I enjoy a spontaneous and organic life, and that’s gotten me far enough to make me happy.</p>
<h3 id="pen-paper">Pen &amp; Paper</h3>
<figure class="text-center"><picture><img src="../../media/2020/bullet-journal.jpg" alt="Notebooks on desk. On the left: Camel brown notebook with bear symbol on cover. On the right: Forest green notebook with deer symbol on cover."></picture>
<figcaption>
My 2019 journal (left) and 2020 journal (right).</figcaption></figure>
<p>In 2019, I used an A5+ (slightly wider than regular A5) dot-grid notebook. It’s bulky to carry around but I don’t regret it: the pages are wide enough to encourage writing. The quality of its pleasing yellow paper is outstanding, thick enough to prevent ink from leaking through. I ended 2019 with a few pages empty.</p>
<p>This year, I went for something more portable: an A6 dot-grid notebook. It took me a while to get used to the size constraints, and I’ve been certainly more straightforward with my logs. I am pretty sure I will have no pages left this time. (Wondering what was the advantage of it all as I’m not going anywhere anyway thanks to COVID-19.)</p>
<p>As for pens, I use different colours of a 0.4 mm fineliner.</p>
<h2 id="what-i-ve-learned">What I’ve Learned</h2>
<p class="note">I'd not assume these stem necessarily from the way I set myself up. Audio or video recordings, traditional diary, and other journal formats are worth exploring and might help just as well.</p>
<ul>
<li>
<p><strong>Less overwhelm, more time.</strong> To truly chill out when life gets overwhelming, you gotta plan ahead. Especially in already busy weeks, I use my journal to put down chores I commit to get done, prioritising what I signify as deadline-sensitive. Before, with my tendency to overfocus, I’d take up activities without planning and end up neglecting my responsibilities and needs. Imagine how far this can go!</p>
</li>
<li>
<p><strong>Emotional awareness.</strong> I’ve gained a grasp of the phenomenology of my emotions and the lens through which I see life, markedly my cognitive distortions on stressful days. Attitudes like pessimism inevitably surface as you jot down negative thoughts all the time. Being mindful allowed me to reframe negative views, and turn obstacles into opportunities.</p>
</li>
<li>
<p><strong>Better retainment.</strong> It’s easy to fall into the trap of “I have a bad memory” when one has been busy and mooning for so long. Leading a busy life mindlessly is not what I strive for, and journaling only feeds into that: I hold dear people, moments, promises, and no longer miss so many appointments (planning helped here too!).</p>
</li>
<li>
<p><strong>Constant assessment.</strong> Journaling is a tool to assess the present as well as the past and the future. By peeping into where I’ve been, what did/didn’t go well, or who I have been with, for instance, I can ponder more sensibly on my growth and relationships. Early feedback on my own life, sort of, to leverage self-improvement in relationships, health, work, and so on.</p>
</li>
</ul>
<h3 id="pitfalls">Pitfalls</h3>
<ul>
<li>
<p><strong>Perfectionism.</strong> Obsession over constant logging or perfection is right at the door for you to slip into. On social media (Pinterest, YouTube), everyone’s journal seems visually-appealing every day without fail. Even Bullet Journal, a method dead straightforward, can be a rabbit hole. Remind yourself to solve your problem in a way that enhances your daily life, not burdens it. You gain absolutely nothing from buying into slices of life people sell online.</p>
</li>
<li>
<p><strong>Habit-building.</strong> When not a habit, journaling is just another chore. Make it effortless and engaging: establish a routine (if that’s your thing), designate it a place where it’s always within reach, or tailor the framework to your needs. If you enjoy drawing once in a while, why not? If you have no patience for 29872 different pen colours, why do it? If you want to write about your day with your partner in bullet points instead of coming up with a best-seller love story, who cares?</p>
</li>
<li>
<p><strong>Procrastination.</strong> Journaling constantly nudges you to look back at your life and how you’ve been spending your time and energy. That can be challenging and won’t change. For starters, you might come to the unpleasant realisation that you self-sabotage, or that a certain relationship is fading away. If you are avoidant, you will most likely put off journaling often; not because of the method or routine, but fear of what you may find – fertile soil for procrastination.</p>
</li>
<li>
<p>For pen &amp; paper… <strong>No backup</strong>. Some companies have tried, but what’s hand-written won’t sync with a cloud server. You do carry the weight if traveling or taking it to work, and it’s probably gone if you spill coffee on it. I, though, think the trade-off is worth it and haven’t looked back.</p>
</li>
</ul>
<h2 id="final-takeaway-takeout-box">Final Takeaway 🥡</h2>
<p>I am all for simplicity, yet that didn’t keep my mind from boggling when I realised such a simple tool turned out to be a game-changer. Starting off was not easy, but the benefits showed up and kept me motivated – a rewarding feeling I wouldn’t expect so hastily while building a new habit. Today, it’s just effortless and natural.</p>
<p>Ultimately, I hope this stimulates you to try journaling in whatever way and to deem simple tools as helpful to uncomplicate and improve our lives.</p>
<h2 id="references">References</h2>
<ul>
<li><a href="https://bulletjournal.com/pages/learn">Learn Bullet Journal</a></li>
</ul>
</content>
</entry>
<entry xml:lang="en">
<title>How to Spy on a React Prop with Jest</title>
<published>2019-10-31T14:15:42+00:00</published>
<updated>2019-10-31T14:15:42+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="/blog/how-to-spy-on-a-prop-with-jest/"/>
<id>/blog/how-to-spy-on-a-prop-with-jest/</id>
<content type="html" xml:base="/blog/how-to-spy-on-a-prop-with-jest/"><p>When we want to test whether a prop has been called, mocking the prop in the component is usually the preferred way. This is how it goes with <a href="https://jestjs.io/">Jest</a> and <a href="https://airbnb.io/enzyme/">Enzyme</a>:</p>
<pre data-lang="js" style="background-color:#282a36;color:#f8f8f2;" class="language-js "><code class="language-js" data-lang="js"><span style="font-style:italic;color:#8be9fd;">const </span><span style="color:#ffffff;">buy </span><span style="color:#ff79c6;">= </span><span style="color:#ffffff;">jest</span><span style="color:#ff79c6;">.</span><span style="color:#50fa7b;">fn</span><span>();
</span><span style="font-style:italic;color:#8be9fd;">const </span><span style="color:#ffffff;">wrapper </span><span style="color:#ff79c6;">= </span><span style="color:#ffffff;">enzyme</span><span style="color:#ff79c6;">.</span><span style="color:#50fa7b;">shallow</span><span>(&lt;button onClick={buy}&gt;</span><span style="color:#ffffff;">Buy</span><span style="color:#ff79c6;">&lt;/</span><span style="color:#ffffff;">button</span><span style="color:#ff79c6;">&gt;</span><span>);
</span><span>
</span><span style="color:#ffffff;">wrapper</span><span style="color:#ff79c6;">.</span><span style="color:#50fa7b;">simulate</span><span>(</span><span style="color:#f1fa8c;">&quot;click&quot;</span><span>);
</span><span>
</span><span style="color:#50fa7b;">expect</span><span>(</span><span style="color:#ffffff;">buy</span><span>)</span><span style="color:#ff79c6;">.</span><span style="color:#50fa7b;">toBeCalled</span><span>();
</span></code></pre>
<p>You may also want to spy on the prop directly, when the component is tested along with a provider passing down its props.</p>
<pre data-lang="js" style="background-color:#282a36;color:#f8f8f2;" class="language-js "><code class="language-js" data-lang="js"><span style="font-style:italic;color:#8be9fd;">const </span><span style="color:#ffffff;">wrapper </span><span style="color:#ff79c6;">= </span><span style="color:#ffffff;">enzyme</span><span style="color:#ff79c6;">.</span><span style="color:#50fa7b;">shallow</span><span>(
</span><span> &lt;ClickProvider&gt;
</span><span> &lt;button&gt;</span><span style="color:#ffffff;">Buy</span><span style="color:#ff79c6;">&lt;/</span><span style="color:#ffffff;">button</span><span style="color:#ff79c6;">&gt;
</span><span> </span><span style="color:#ff79c6;">&lt;/</span><span style="color:#ffffff;">ClickProvider</span><span style="color:#ff79c6;">&gt;
</span><span>);
</span><span style="font-style:italic;color:#8be9fd;">const </span><span style="color:#ffffff;">buy </span><span style="color:#ff79c6;">= </span><span style="color:#ffffff;">jest</span><span style="color:#ff79c6;">.</span><span style="color:#50fa7b;">spyOn</span><span>(</span><span style="color:#ffffff;">wrapper</span><span style="color:#ff79c6;">.</span><span style="color:#50fa7b;">instance</span><span>()</span><span style="color:#ff79c6;">.</span><span style="color:#ffffff;">props</span><span>, </span><span style="color:#f1fa8c;">&quot;onClick&quot;</span><span>);
</span><span>
</span><span style="color:#ffffff;">wrapper</span><span style="color:#ff79c6;">.</span><span style="color:#50fa7b;">simulate</span><span>(</span><span style="color:#f1fa8c;">&quot;click&quot;</span><span>);
</span><span>
</span><span style="color:#50fa7b;">expect</span><span>(</span><span style="color:#ffffff;">buy</span><span>)</span><span style="color:#ff79c6;">.</span><span style="color:#50fa7b;">toBeCalled</span><span>();
</span></code></pre>
<p>I am using Enzyme however you should be able to spy on similarly using other testing libraries – just make sure you are spying on a function in the props coming from the component prototype (as in <code>wrapper.instance()</code>).</p>
<p>That’s all. Just posting it here cuz I couldn’t find it easily anywhere else.</p>
</content>
</entry>
<entry xml:lang="en">
<title>Setup for Audio Interface with Guitar Rig 5 on macOS Mojave</title>
<published>2019-08-18T22:19:05+00:00</published>
<updated>2019-08-18T22:19:05+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="/blog/guitar-rig-macos-mojave-setup/"/>
<id>/blog/guitar-rig-macos-mojave-setup/</id>
<content type="html" xml:base="/blog/guitar-rig-macos-mojave-setup/"><p>Setting up <a href="https://www.native-instruments.com/en/products/komplete/guitar/guitar-rig-5-pro/">Guitar Rig 5</a> on macOS Mojave seems not to be straightforward.</p>
<p>Although I had gotten the signals to be sent from my guitar to the audio interface and from the interface to Guitar Rig, somehow it’d still not work. Instead of using my audio interface as the input <strong>and output</strong> device on Guitar Rig, I had to set up an “aggregate device”.</p>
<p>This how you can do it too.</p>
<p>(My specs, just so you know:)</p>
<pre data-lang="sh" style="background-color:#282a36;color:#f8f8f2;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#50fa7b;">macOS</span><span> Mojave Version 10.10.14
</span><span style="color:#50fa7b;">Guitar</span><span> Rig Pro 5.2.2
</span><span style="color:#50fa7b;">Audio</span><span> Interface Steinberg UR22mkII
</span></code></pre>
<h2 id="audio-midi-setup">Audio MIDI setup</h2>
<ol>
<li>
<p>Open “Audio MIDI setup” in your Mac. (It’s a tiny secret sound manager shipped along with the system, you’ll find it.)</p>
</li>
<li>
<p>At the very bottom of the app, there is a small + (“plus”) button wherein you should select <em>“Create an aggregate device”</em>.</p>
</li>
<li>
<p>Set up your “aggregate device” with your 1) audio inteface and 2) speakers/headphones/whatever – which should be all shown up there, given the setup is correct. Remember to give your device a remarkable name – I suggest <em>FUCK COMPUTERS AND AUDIO</em>.</p>
</li>
</ol>
<figure class="text-center"><picture><img src="../../media/2019/guitar-rig-macos-mojave-setup/audio-midi-setup.png" alt="Audio MIDI Setup app open showing audio device with both devices'"></picture>
<figcaption>My custom device in Audio MIDI Setup on macOS.</figcaption></figure>
<ol start="4">
<li>Go back to Guitar Rig. In the context menu “File”, go to <em>“Audio and MIDI Settings”</em>. In the “Audio” tab, select your aggregate device as the <strong>device</strong>, instead of only the audio interface as you were doing before; then configure input/output as expected in the “Routing” tab.</li>
</ol>
<p>Should work! If it doesn’t, <a href="https://support.native-instruments.com/hc/en-us/articles/210275885-I-Cannot-Get-Any-Sound-Output-from-GUITAR-RIG-5">this guide by Native Instruments on how to troubleshoot audio</a> and others guides on the website might help. Depending on your audio interface, make sure the right driver setup is in place – you can try out <a href="http://www.asio4all.org/">ASIO4ALL</a>.</p>
<img src="../../media/2019/guitar-rig-macos-mojave-setup/guitar-rig.png" alt="Guitar Rig app showing its custom amps">
<p>If it still doesn’t work, I am sorry and prolly have no idea. Have fun.</p>
</content>
</entry>
<entry xml:lang="en">
<title>OMG Climate: Reflecting Together on the Climate Catastrophe</title>
<published>2019-05-30T11:39:14+00:00</published>
<updated>2019-05-30T11:39:14+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="/blog/omg-climate/"/>
<id>/blog/omg-climate/</id>
<content type="html" xml:base="/blog/omg-climate/"><figure class="text-center"><picture><img src="../../media/2019/omg-climate/global-warming-nasa.gif" alt="NASA's illustration of Planet Earth warming process across the years"></picture>
<figcaption>Credits: NASA’s Scientific Visualization Studio/Kathryn Mersmann.</figcaption></figure>
<p>Planet Earth, May 2019. <a href="https://www.weforum.org/agenda/2019/05/the-uk-just-became-the-first-country-in-the-world-to-declare-a-state-of-emergency-on-climate-change">The UK has announced a state of emergency for climate change</a> and <a href="https://globalnews.ca/news/5280082/what-is-a-climate-emergency-canada/">Canada considers the same</a>; we are <a href="https://agupubs.onlinelibrary.wiley.com/doi/10.1029/2018JD029522">more confident about our model to capture rising global temperatures</a>, and <a href="https://www.theguardian.com/environment/gallery/2019/may/24/student-climate-strikes-around-the-world">students all around the world walk out of school protesting the lack of climate action</a>. Yet, not enough of us are genuinely concerned about the role we’ve played on this catastrophe.</p>
<p>A Saturday afternoon of May and a few square meters in Berlin were what a couple of people needed to open– and voluntarily discuss how we impact the Planet to change and how those changes impact us. Topics ranged from radical solarpunk utopia to more down-to-earth and short-term ideas within our generation’s reach today: musings about climate change awareness, sustainability policies for companies, traveling sustainably, tech tools for political change, and how to get out of our bubbles and active listen to other realities.</p>
<p>In this post, I’ll be sharing my personal notes on that engaging and constructive afternoon. There will be, also, references at the end of this post so you can keep yourself posted.</p>
<h2 id="pitching-and-picking-topics-for-discussion">Pitching and picking topics for discussion</h2>
<p><strong>OMG Climate</strong> is an unconference, meaning that attendees proactively come up with the agenda and topics to be discussed. To kick it off, we got instructed to pitch topics for discussion that’d be prioritised also by ourselves into tracks, attended based off our preferences. Everyone was expected to have at least a certain knowledge, even if rather tacit, about the challenges we’re facing right now with the climate emergency.</p>
<p>These were the tracks of the first OMG Climate:</p>
<ul>
<li><strong>Track 1</strong>: “Low-carbon travel” / “Green Mafia” / “How do you sleep at night? Coping with climate anxiety”</li>
<li><strong>Track 2</strong>: “Tech tools for political action” / “Circular economies: Re-use and tech” / “Company sustainability policy template”</li>
<li><strong>Track 3</strong>: “Solarpunk, imagination and excitement” / “CO2 Offsets as an API and tracking carbon” / “Climate change awareness in developing countries”</li>
</ul>
<p>We had enough attendees for tracks to make for productive discussions. Listening and talking to one another, while facilitated by a volunteer, did the job on keeping up an constructive flow between finding root causes and ways to take action.</p>
<figure class="text-center"><picture><img src="../../media/2019/omg-climate/discussion.jpg" alt="People sitting in a circle, listening attentively to one"></picture>
<figcaption>During the "Green Mafia" discussion.</figcaption></figure>
<p>I’ve joined “Low-carbon travel”, “Green mafia”, and “Climate change awareness in developing countries”, so these are the ones I have more insights about. Towards the end, we all got together to wrap it up, and I have to say: all tracks were interesting, so don’t restrain yourself to this post!</p>
<p class="note">The following notes don't reflect directly what's happened or everything that's been said in the event, it's rather my personal perspective. They are also somewhat vague, but I hope you can benefit from them somehow.</p>
<h2 id="low-carbon-travel">Low-carbon travel</h2>
<p>Air travel, even when occasional, has an <a href="https://en.wikipedia.org/wiki/Environmental_impact_of_aviation#Climate_change">environmental impact</a> difficult to make up for no matter how many bamboo toothbrushes we gift our friends, how often we commute by bike or how vegan is our diet.</p>
<p>With low airplane ticket prices getting more popular than ever and enabling people to travel more, how can we make traveling sustainable when <em>not traveling to begin with</em> is not an option? That was the question we kicked off the “low-carbon travel” discussion with.</p>
<h3 id="meeting-notes">Meeting notes</h3>
<figure class="text-center"><picture><img src="../../media/2019/omg-climate/low-carbon.jpg" alt="Piece of paper sticked to the wall with sketches"></picture>
<figcaption>Collective sketch notes about the low-carbon travel track</figcaption></figure>
<ul>
<li>In our circle, everyone seemed to have access to the privilege that is air flying.</li>
<li>We began exploring traveling by breaking it down into traveling for work vs. pleasure.</li>
<li><strong>Ground travel</strong> might be an option; however, it’s rather time-consuming and hence less appealing in a capitalist society where time translates to money. How can we shift the paradigm?</li>
<li>Instead of seeing longer trips as wasted time, we should begin seeing the journey as part of the trip.</li>
<li><strong>Traveling less</strong>: We often optimise our trips to visit as many places as possible; instead, we can optimise for depth and start going to fewer places for a longer time. Think: going to a European country and making the most of it, instead of going to 999 different countries just because they are 1-hour-flight away from each other.</li>
<li>Share practical solutions for people to make trade-offs, <a href="http://ecocostsvalue.com/"><strong>EcoCost</strong></a> rather than overwhelming scientific evidence.</li>
<li>What if companies supported employees whose carbon footprint is the least?</li>
<li>Green travel agencies and flying policies.</li>
<li>Search engines for flights obviously don’t suggest alternative ways to get to a place when a plane is definitely not the best option.</li>
<li><a href="https://bvg.de">BVG</a> app, on the other hand, recommends walking instead of taking public transport sometimes.</li>
<li>Transport apps could also order route options by the least environmental impact.</li>
<li>The car industry should be ashamed of its climate record.</li>
<li>The train industry is not modernised and integrated, rather rigid.</li>
<li>Investment on 10 km of autobahn could pay off the renovation for bike lanes all over Berlin.</li>
<li>Globalisation vs. environmental footprint: IT workers immigrating usually go back to their countries often since they have the need and resources. I asked whether there was data available on how that situation in particular could’ve increased our carbon emissions coming from aviation.</li>
<li>Business trips by train are possible only among those who have the privilege of a flexible work schedule, such as freelancers.</li>
<li>Making the most out of idle time: we tend to be more creative in idle times, while in a train; not hunching over a keyboard or in an office environment.</li>
<li>“Fast-moving home/office” as an alternative to turn the journey time into productive time.</li>
<li><strong>Frequent flyer levy</strong>: A fairer tax system according to how often people fly. Those that fly more should pay more. (More information: <a href="http://afreeride.org/">A Free Ride</a>)</li>
<li>Airline campaigns often promote the image that everyone should become part of a group of young, urban frequent flyers, visiting another city every few weeks for very low costs.</li>
</ul>
<h3 id="action-points">Action points</h3>
<ul>
<li>everyone to shift mindsets in regard to traveling.</li>
<li>everyone to vote instead of buying a bamboo toothbrush.</li>
<li>everyone to use and promote tools with different options of transport within a route, instead of blindly going to specific train or flight websites.</li>
<li>everyone to keep consuming local goods.</li>
<li>airline companies to stop promoting flying as a status symbol.</li>
<li>travel agencies to work out more sustainable ways to travel and consider it in their branding.</li>
</ul>
<h2 id="green-mafia">Green Mafia</h2>
<p>How corporate interests and ideologues work to undermine science and make countries doubt about the risks of climate change? Think <a href="https://www.theguardian.com/environment/planet-oz/2015/aug/06/how-australians-were-ready-to-act-on-climate-science-25-years-ago-and-what-happened-next">what stopped Australia, 25 years ago, to act on climate change</a>.</p>
<p>We should fight back! We mused about beating off lobby groups representing the coal, car, oil, electricity, and aluminium industries using their same sneaky techniques, as a <strong>Green Mafia</strong>. An intriguing and fun topic!</p>
<p>The brainstorming served as a tool to get a grasp on the way those mafias function, and discuss whether the ethical approach is always the way to go when facing a crisis.</p>
<h3 id="meeting-notes-1">Meeting notes</h3>
<figure class="text-center"><picture><img src="../../media/2019/omg-climate/green-mafia.jpg" alt="Piece of paper sticked to the wall with sketches"></picture>
<figcaption>Collective sketch notes about the Green Mafia track</figcaption></figure>
<ul>
<li>Leverage civil disobedience and tools of intimidation to influence green policies for the climate, fight extreme wealth and weaken existing mafias such as the oil industry.</li>
<li>How far should one go with non-ethical practices, such as blackmailing or public shaming of those who harm the planet?</li>
<li>What’s ethics after all?</li>
<li>Could we use illegal money to fund our causes?</li>
<li>Could we use legal money to fund our cases? There are ways to get money from the state in licit ways such as from green parties.</li>
<li>What if we made the green cause as profitable for the mafia as oil?</li>
<li>Sell a belief system, or use an existing one such as “harmony with nature”.</li>
<li>Cyber hacking/hijacking internet algorithms to spread awareness instead of climate change denial and fake news as it happens today.</li>
</ul>
<h2 id="awareness-in-developing-countries">Awareness in developing countries</h2>
<p>The rich, the poor and the Earth.</p>
<p><a href="https://www.theguardian.com/environment/2015/dec/02/worlds-richest-10-produce-half-of-global-carbon-emissions-says-oxfam">World’s richest 10% produce half of the global carbon emissions, while the poorest half contribute a mere 10%</a>; but climate change affects the poorest people the most. Moreover, developing countries are the most responsible for climate change now, and vulnerable too.<sup class="footnote-reference"><a href="#1">1</a></sup></p>
<p>Coming from a developing country, I was looking forward to this topic! Apart from Brazil, we had people from India too. There was a range of issues that could be tackled within this track, such as the risk of massive displacements of people in developing countries, the need of support to adapt, environment destruction for the sake of economic prosperity, how to approach climate change education etc.</p>
<h3 id="meeting-notes-2">Meeting notes</h3>
<ul>
<li>We are <strong>building awareness</strong>, not “teaching” others about climate change.</li>
<li>Climate change is an existential threat to life, but it seems rather remote if you think about poverty, disease and economic stagnation. How do we educate children for the long-term if, for some of them, not showing up at school tomorrow means not eating at all?</li>
<li>How do we let them know about the risk of massive displacements of people who have no resources whatsoever to move?</li>
<li>Just by existing in a developed country in Europe, our carbon footprint is more impactful than any developing country.</li>
<li>Indigenous people are already defenders and protectors of the environment more than we will ever be in our generation.</li>
<li>Economic development is a priority in developing countries, and politicians may ignore environmental impact for the sake of it. (See <a href="https://www.climatechangenews.com/2019/01/22/brazils-natural-resources-open-business-bolsonaro-says/">Brazil’s natural resources open for business, says Bolsonaro</a>)</li>
<li>Developing countries idealisation of economic development, influenced by “developed world standards”: tall buildings and industries all over the place, where often we don’t see the green implications of “success”.</li>
<li>What about a model of development thats puts together the simple living of developing countries with the green development of developed ones?</li>
<li>How waste affects developing countries; example of <a href="https://www.bangkokpost.com/news/world/1666380/philippines-duterte-says-to-sail-garbage-back-to-canada">Philippines to sail garbage back to Canada</a>.</li>
<li>We could shift the discussion to think about environmental impact in terms of social classes instead of countries. After all, rich lifestyles and “status” in general damage the environment in untold ways.</li>
<li>The <a href="https://en.wikipedia.org/wiki/Swadeshi_movement">Swadeshi movement</a> brought back self-manufactured clothing in India to boycott foreign goods, a part of a movement to liberate India from British control and industrialisation.</li>
<li>When teaching, consider what’s in people’s context, reach and language instead of what’s “out there”.</li>
<li>We should actively listen more to those communities and what’s happening in those countries. Sometimes, instead of thinking that there is something to be taught, we should rather learn from their realities so we can bring about a meaningful conversation.</li>
<li>This is a problem not to be approached by technology, remotely. It’s rather about Politics and Education.</li>
</ul>
<h3 id="action-points-1">Action points</h3>
<ul>
<li>everyone to assure inclusivity, cooperation and engagement across boundaries, <strong>first and foremost</strong>.</li>
<li>countries to keep cooperating efforts <em>internationally</em> through policies, institutional frameworks for development and investments in infrastructure.</li>
</ul>
<h2 id="conclusion">Conclusion</h2>
<p>Well-led communities that strive for welcoming environments enable the best out of people. OMG Climate has shown that – its <a href="https://en.wikipedia.org/wiki/Unconference">unconference format</a> got everyone to take responsibility and engage towards constructive and meaningful discussions about climate change.</p>
<figure class="text-center"><picture><img src="../../media/2019/omg-climate/presentation.jpg" alt="Participant presenting using microphone, all sketch notes of the unconference sticked to the wall, on background"></picture>
<figcaption>Final presentations wrapping up the tracks.</figcaption></figure>
<p>Although most of us had a tech background, everyone seemed aware: tech alone will not solve all problems, but we are eager to address them either way.</p>
<h2 id="learn-about-climate-change">Learn about Climate Change</h2>
<ul>
<li>Reddit: <a href="https://www.reddit.com/r/climatechange/">/r/climatechange</a> and <a href="https://www.reddit.com/r/globalwarming/">/r/globalwarming</a></li>
<li><a href="https://www.theguardian.com/environment/climate-change">The Guardian on Climate Change</a></li>
<li><a href="https://ourworldindata.org/co2-by-income-region">Global inequalities in CO₂ emissions</a></li>
<li><a href="https://anildash.com/2018/10/03/were-still-not-being-alarmist-enough-about-climate-change/">We’re (still) not being alarmist enough about climate change</a></li>
</ul>
<h2 id="more-on-omg-climate">More on OMG Climate</h2>
<ul>
<li><a href="https://ti.to/omg/climate/">OMG Climate Event page</a></li>
<li><a href="https://medium.com/omg-climate">OMG Climate Medium website</a></li>
<li><a href="https://twitter.com/search?q=%23omgclimate&amp;src=typed_query">#OMGCLIMATE on Twitter</a></li>
<li><a href="https://climateaction.tech/">ClimateAction.tech</a></li>
</ul>
<div class="footnote-definition" id="1"><sup class="footnote-definition-label">1</sup>
<p><a href="https://www.cgdev.org/blog/climate-change-and-development-three-charts">Climate Change and Development in Three Charts</a></p>
</div>
</content>
</entry>
<entry xml:lang="en">
<title>I've Sensory-Deprived Myself In a Tank</title>
<published>2018-12-02T08:01:00+00:00</published>
<updated>2018-12-02T08:01:00+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="/blog/isolation-tank/"/>
<id>/blog/isolation-tank/</id>
<content type="html" xml:base="/blog/isolation-tank/"><p>I struggle every day trying not to be one step ahead. Living everywhere else but the present and leaping through time have become part of how my brain is wired, so I often find myself not experiencing much anymore.</p>
<p>A while ago, a friend told me about his sensory-deprivation experience in some kind of pool, the so-called <a href="https://en.wikipedia.org/wiki/Isolation_tank"><em>Isolation Tank</em></a>. No sight, no hearing, no touch, no taste, no smell – the idea of getting absolutely no input from anywhere struck me as a way to get my perception back on track. I decided to try it out.</p>
<p>On a sunny Saturday of November, I, along with my endless stream of thoughts, floated for 1 hour straight in a soundproof egg-shaped tub shallowly filled up with salt water. This is my report.</p>
<h2 id="getting-in">Getting In</h2>
<p>With my bathing suit on and no expectations of anything, I showered, got into the tub and sealed down its cover. My body floated easily on that water that thermically felt like my own skin, and a relaxing sound was playing in the background up to the moment my surroundings got all pitch-black.</p>
<p>The first 15 minutes were all about withstanding how restlessly my mind wanted to get out of there. I’ve had done meditation before, but 1 hour was <em>something else</em>. I recalled I worked 8 hours a day, 5 days a week, and therefore I should be making the most out of my Saturday instead. Leisure time! In modern life, that usually means stimulation by means of binge-drinking with friends, uplifting music, delicious food, watching heart-breaking movies…. Quite the opposite of soul-crushingly doing nothing.</p>
<p>The mind just plays a lot of games on you all the time. It tricked me into being <em>physically</em> irritated by the water, its salt, that bogus zero-gravity environment, and that I’d be better off giving up <em>for my own survival</em> – at least, that was how my body anxiously (over-)reacted to it. But there was actually no physiological danger or whatsoever; truth be told, I was way safer than I had ever been throughout that week. I quit panicking.</p>
<p>I came upon different phases of denial, approval and mind-numbness from that onwards. Saw myself bringing up problems and drifting them away. Tried to work out situations I had no control over. Missed music, so made my own by tapping on the water. Went hyper-focused on how I had performed socially last week to what was going to happen in the next few weeks when I eventually hand over my old apartment’s keys to that spiteful Hausmeister who hates my German.</p>
<p>My thoughts just went on super randomly. After a while, I could draw the exact line where each one ended, and got mindful about my weary physical overreactions to them.</p>
<p>Towards the end, I sank into something else: weightlessness, timelessness, solitude were emerging from that isolation. Things started losing shape. Didn’t perceive water. I was either a floating head or a floating body. I had to touch my thighs, boobs, neck just to relieve myself from the uncertainty that being so relaxed made me feel about where I was.</p>
<p>I wanted to come back down to Earth from wherever I was, and, surprisingly, <strong>to be myself</strong> – the way I was. Then time was up.</p>
<h2 id="getting-out">Getting Out</h2>
<p>I showered again to wash the salt off. The spa provided a relaxation lounge that was essential to ease the transition, since I had neither desire nor need (important!) to rush anywhere. Hung out there for 1 hour.</p>
<p>The readjusting was an interesting and unexpected phase to me. Had an apple and felt how crispy in sound and taste it was. Drank a glass of water and sensed it going <em>right down through</em>. Read a book and couldn’t make sense of why we humans have ever brought up speed reading techniques in the first place.</p>
<p>Stepping out of the spa, I got savagely welcomed by a gloomy afternoon<sup class="footnote-reference"><a href="#1">1</a></sup> undergoing that life I was used to every day. A lot was happening out there: lights of apartments being turned on and out, cars groaning, people running around, traffic noise, the cozy energy of having my friend by my side, sharper textures of the sidewalks’ cobblestones, and the joy of a having a sky whose amount of stars doesn’t depend on the many times we screw up as human beings, thankfully.</p>
<p>Berlin-Schöneberg is quite chill so that’s helped to readjust. I was sensible and my thoughts were vivid and receptive – pretty much the actual poetic mood I strive for, where I settle and listen to what’s being said in order to write it down. A mood that is “highly disturbed by Philosophy”, as Goethe brilliantly summed up to Schiller once:</p>
<p><em>“I am still hoping for poetic hours, and philosophy, in my case, disturbs the poetic mood, probably because it drives me into the object, for I am never able to keep myself in a purely speculative mood, but have immediately to try and form a distinct conception, and on this account at once fly out into nature. […]</em><sup class="footnote-reference"><a href="#2">2</a></sup></p>
<p>I had finally my mind drifted towards just as much of the world as it was going on.</p>
<h2 id="lessons-learned">Lessons Learned</h2>
<p>My poetic mood didn’t last much – it wore off the day after.</p>
<p>I’ve realized how much we are externally stimulated and easily adapt to it as if it were natural. On top of that, we are internally stimulated by our worries and whatnot: have I paid my taxes? Am I persuading a career? Does my family still love even though I am thousands of kilometers from them? Have I been eating healthy enough?</p>
<p>It turns out it’s clear why we don’t feel much anymore. Our brain gets wired to parallelising stimuli, and we have less and less coming from our body to the head than the other way around. Apart from that, our experience of the world is barely passive: <strong>we actively generate it</strong> with our biases, mental models, what and how much we consume. Mind shortcuts are crucial, but might restrain us from genuinely experiencing life, getting us to either ignore ou hyper-focus unconsciously.</p>
<p>I, now, have a better grasp of what Erling Kagge meant in <a href="https://www.goodreads.com/book/show/36243813-silence">Silence: In the Age of Noise</a>, written after he had spent fifty days walking solo in Antarctica: <em>“Everything seemed completely flat and white. […] Eventually, in complete isolation, I began to notice that nothing was completely flat after all. The ice and snow formed small and large abstract shapes. The uniform whiteness was transformed into countless shades of white. […]”</em></p>
<p>Meditation is the absolute protagonist here, but floating got me into a different flow, and faster. The topic of <a href="https://en.wikipedia.org/wiki/Sensory_deprivation">sensory deprivation</a> is definitely worth-exploring. Think like: If you ditch sugar for a while, it tastes sweeter afterwards. ;-)</p>
<p>This is pretty much what floating offers: <strong>sensory starvation and you on your own</strong>. You may waste your time and never get to anything, or make even most out of that 1 hour than me.</p>
<p>Personally, I can’t wait to do nothing again.</p>
<hr />
<div class="footnote-definition" id="1"><sup class="footnote-definition-label">1</sup>
<p>Just another Autumn day in Berlin.</p>
</div>
<div class="footnote-definition" id="2"><sup class="footnote-definition-label">2</sup>
<p>Goethe (and Friedrich Schiller). <a href="https://archive.org/stream/correspondencebe01schi/correspondencebe01schi_djvu.txt">Correspondence Between Schiller and Goethe from 1794 to 1805</a>. Translated by George H. Calvert.</p>
</div>
</content>
</entry>
<entry xml:lang="en">
<title>How I Lock My Bike in Berlin</title>
<published>2018-08-30T07:00:00+00:00</published>
<updated>2018-08-30T07:00:00+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="/blog/how-i-lock-my-bike-in-berlin/"/>
<id>/blog/how-i-lock-my-bike-in-berlin/</id>
<content type="html" xml:base="/blog/how-i-lock-my-bike-in-berlin/"><p class="summary">1 year with a bike in Berlin, and counting...</p>
<p>I bought a bike 2 months after moving to Berlin, and a really good lock 1 day after.</p>
<p>With no clue about the theft scene in Europe – Berlin, in special –, I did myself some research on <a href="https://www.reddit.com/r/reddit/">/r/berlin</a>, <a href="https://www.reddit.com/r/bicycling/">/r/bycicling</a> and a few other places around the internet. What I did find out? Well, <a href="https://www.welovecycling.com/wide/2015/11/25/european-bike-stealing-championships-in-numbers/">the numbers on bike theft are quite concerning</a>.</p>
<p>Nevertheless, after witnessing some people getting their bikes stolen, I feel privileged to say that <strong>it’s been more than 1 year I’ve got my bike</strong>. If that is because of my good lock or my good luck, I’ll never know.</p>
<p>But I can tell you about the lock.</p>
<h2 id="my-lock-setup">My lock setup</h2>
<p>I generally agree that you should invest as much as you can afford in your lock setup. I’ve put a considerable amount of money on mine because I <em>deeply</em> care – in other words, I have no psychological resilience when it comes to bicycles so losing mine would definitely get me in tears.</p>
<p class="note">If you care about numbers without any trustable source, I've seen recommended somewhere that you should be investing between 10%-20% of the bike price in a lock. 🤷</p>
<p>Therefore, considering the price of having to go home by feet and with tears in my eyes, I did the best I could and went for the <a href="https://www.kryptonitelock.com/en/products/product-information/current-key/000990.html">Kryptonite Evolution Mini-7 with Double Loop Cable</a> (highly recommend you to check their website for more information).</p>
<p>I make sure my bike’s <strong>frame and both wheels</strong> are locked to a fixed rack – cemented into the ground, ideally.</p>
<figure class="text-center"><picture><img src="../../media/2018/yellow-bike-lock.jpg" alt="Yellow bike in a parking space locked with a U-lock and a flexible steel cable."></picture>
<figcaption>My tiny yellow bike parked and properly locked at the office's parking space! Locking up the U-lock to the front wheel instead is a good alternative. Also, I often wrap the steel cable through the rack.</figcaption></figure>
<p class="note">I had considered the <a href="https://www.kryptonitelock.com/en/products/product-information/current-key/997986.html">Kryptnonite's New York Fahgettaboutdit</a>, but I found it way too heavy and the safety factor difference didn't pay off for me at that time. I'd recommend it if an extra weight is no problem for you though.</p>
<p>For I still have my bike after 1 year, I am honestly happy with my choice. The lock came with:</p>
<ul>
<li>Three keys with an unique number. For your information, Kryptonite has a system where <a href="https://kryptonite.zendesk.com/hc/en-us/articles/231011287-Finding-My-Key-Number-">every key gets a number</a>, so you can order replacements online in case you mess up.</li>
<li>A handy mount made by Kryptonite: <a href="https://www.kryptonitelock.com/en/products/product-information/current-key/000730.html">Transit FlexFrame U-Bracket</a> (not visible in the photo because it’s in the top tube), so I don’t have to carry the U-lock in my backpack or whatever.</li>
<li>Manuals that I didn’t read and got recycled.</li>
<li>1 year coverage according to the <a href="https://www.kryptonitelock.com/en/customer-service/register-for-anti-theft.html">Kryptonte’s Anti-theft Program</a>, because the security rating is high enough.</li>
</ul>
<p>I’ve read a couple complaints about the lock not fitting both the wheel and frame to most city racks, however I’ve managed to do it in most racks around Berlin. It’s definitely not the most flexible and spacious lock, but thieves would love some extra space to do their work too, so I think it’s just the size it should be after all.</p>
<p>In the worst-case scenario, there is always the <a href="https://www.sheldonbrown.com/lock-strategy.html">Sheldon Method lock strategy</a> – or <a href="http://www.802bikeguy.com/2011/07/the-modified-sheldon-brown-bike-locking-strategy/">its modified version</a> – anyway!</p>
<h2 id="what-bike-locks-are-about">What bike locks are about</h2>
<p>When looking for a lock, instead of (only) asking yourself what’s the best lock ever, ask <em>“How much trouble am I putting a thief into with my lock strategy?”</em>.</p>
<p>It hasn’t been enough stressed that locks do NOT prevent determined thieves with their lock pics, cable cutters, bolt cutters and angle grinders to steal you bike. Period.</p>
<p>Locks do, though, make it harder for thieves to <em>pick</em> your bike, by increasing the “risk” factor in the risk/reward calculation done before they attempt to steal.</p>
<p><strong>It’s all about making it harder</strong>. And how do you do that? By having a <em>diverse</em> lock setup, and, just as important: by being extremely careful on where and how to park.</p>
<p>Don’t think just U-lock: saddle locks, wheel locks might be worth-checking too! One awesome lock is just one at the end of the day, and the more tools the thief needs to carry out, the better.</p>
<h2 id="looking-further">Looking further</h2>
<p>Some articles I’ve read last year and that might be interesting if you own a bike and want to learn more on how to keep it safe.</p>
<ul>
<li><a href="https://thewirecutter.com/reviews/best-bike-lock/">Best Bike Lock</a>: Review of several bike locks and learnings on how to pick a good one.</li>
<li><a href="http://thebestbikelock.com/how-to-lock-your-bike/">How to Lock your Bike</a>: Great tips on where to park your bike and what to lock it to.</li>
</ul>
<p>There are a lot of cool videos out on YouTube too, e.g. <a href="https://www.youtube.com/watch?v=IXNASUSivqg">“How to Lock your Bike” from GCN</a>.</p>
<p>Have a nice ride! 🚲</p>
</content>
</entry>
<entry xml:lang="en">
<title>Working Better with Git for a Clear History</title>
<published>2018-08-04T07:00:00+00:00</published>
<updated>2018-08-04T07:00:00+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="/blog/working-better-with-git-for-a-clear-history/"/>
<id>/blog/working-better-with-git-for-a-clear-history/</id>
<content type="html" xml:base="/blog/working-better-with-git-for-a-clear-history/"><p>Your teammate worked on a few improvements in all forms of the company’s website. At some point you, also a programmer, are asked for a code review.</p>
<p>This is the feature branch’s <strong>commit history</strong> you get in the Pull Request:</p>
<pre data-lang="sh" style="background-color:#282a36;color:#f8f8f2;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#50fa7b;">[290xx26]</span><span> Resolve merge conflicts
</span><span style="color:#50fa7b;">[9efxxf2]</span><span> Refactor event listener for form fields
</span><span style="color:#50fa7b;">[5d9xx5a]</span><span> Update snapshots
</span><span style="color:#50fa7b;">[948xxfa]</span><span> Update dispatch event
</span><span style="color:#50fa7b;">[f5xxea1]</span><span> WIP
</span><span style="color:#50fa7b;">[f8xxaae]</span><span> Revert change
</span><span style="color:#50fa7b;">[49xxf55e]</span><span> Revert changes
</span><span style="color:#50fa7b;">[02xxdf1]</span><span> Update snapshots
</span><span style="color:#50fa7b;">[21xx329]</span><span> Pass down prop
</span><span style="color:#50fa7b;">[28xxa865]</span><span> Fix onChange event and add minimal design in form
</span><span style="color:#50fa7b;">[cfxx37c]</span><span> U[date snapshots
</span><span style="color:#50fa7b;">[cfxx36c]</span><span> Update form to handle onChange event for autofill
</span><span style="color:#50fa7b;">[242xx25]</span><span> Fix another bug with onChange
</span><span style="color:#50fa7b;">[f7xx738]</span><span> Update form component
</span><span style="color:#50fa7b;">[09xx868]</span><span> Update snapshots
</span></code></pre>
<p>It seems like a lot, when actually those improvements are simply 1) fixing a bug with event handling and 2) introducing a minimal style to them. It just that it takes time to visualise that.</p>
<p>Indeed, committing often to a branch is a good practice<sup class="footnote-reference"><a href="#1">1</a></sup> and commits are supposed to be low-level rather than huge. However, a commit is applicable when you have a meaningful, self-contained batch of work to log to the history – and updating Jest snapshots is not it.</p>
<p>How about the following history?</p>
<pre data-lang="sh" style="background-color:#282a36;color:#f8f8f2;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#50fa7b;">[9efxxf2]</span><span> Refactor event listener for form fields
</span><span style="color:#50fa7b;">[cfxx37c]</span><span> Add minimal design in form
</span><span style="color:#50fa7b;">[cfxx36c]</span><span> Update form to handle onChange event for autofill
</span></code></pre>
<p>That history communicates in a clear way <strong>what</strong> in the codebase has been changed in order to get the improvements done. If you want to know <strong>how</strong> it’s changed, it’s just a matter of checking out a particular commit.</p>
<h2 id="why-a-clear-history-matters">Why a clear history matters</h2>
<p>Apart from facilitating code reviews, since reviewers could grasp the context of the changes right at the first glimpse, <strong>a clear Git history is healthy for the project</strong>.</p>
<p>When commits started to reflect one’s workflow rather than the work done itself, the history turns into a mess of both meaningful and meaningless logs, hard to navigate through and undo changes (since commits are “checkpoints” of work). It’s highly likely that, as time goes by, developers will stop caring about the source code history as the powerful resource it is.</p>
<p>*<em>The final Git history should reflect <em>your work</em> not the way you worked.</em></p>
<p>You begin to lose the benefit of source code management with a messy history, which was supposed to reflect how the codebase evolved over time.</p>
<h2 id="a-better-relationship-with-git">A better relationship with Git</h2>
<p>There are very common comprehensible reasons – yet not excuses at all! – for developers to unnecessarily commit. I can think of:</p>
<ol>
<li>“I had to update snapshots/fix unit test/code formatting/a typo in something I introduced.”</li>
<li>“I had to merge master.”</li>
<li>“I wanted to save my work.”</li>
<li>“I don’t necessarily follow a clear flow – I am productive when I work in iterative way and usually do a lot of things at once.”</li>
</ol>
<p>They can all be worked out by developing a better relationship with Git itself. That might take a while at first, but when it’s part of your daily workflow, you barely think about it at all. <em>(I promise!)</em></p>
<h3 id="first-let-s-talk-git-rebasing">First, let’s talk Git rebasing</h3>
<p><a href="https://git-scm.com/docs/git-rebase">Git rebase</a> is a very powerful tool to reorganise your commits. It does a lot, so I won’t get deep into it.</p>
<p>The command <code>git rebase</code> has an important tool you should get comfortable with: <strong>interactive rebase</strong>. Let’s say we want to reorganise the latest 3 commits:</p>
<pre data-lang="bash" style="background-color:#282a36;color:#f8f8f2;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#50fa7b;">git</span><span> rebase</span><span style="font-style:italic;color:#ffb86c;"> --interactive</span><span> HEAD</span><span style="color:#bd93f9;">~</span><span>3
</span></code></pre>
<p class="note"><code>HEAD</code> points to the current branch in your Git repository. You can use @ as an alias as well: <code>@~3</code>, or the commit hash.</p>
<p>Interactive rebase will provide you a text interface with the list of the commits (in this case, within the range <code>HEAD~3..HEAD</code>) that are about to be rebased and actions you can apply to them:</p>
<pre data-lang="bash" style="background-color:#282a36;color:#f8f8f2;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#50fa7b;">pick </span><span style="color:#ff79c6;">[</span><span>242xx25</span><span style="color:#ff79c6;">]</span><span> Fix another bug with onChange
</span><span style="color:#50fa7b;">pick </span><span style="color:#ff79c6;">[</span><span>f7xx738</span><span style="color:#ff79c6;">]</span><span> Update form component
</span><span style="color:#50fa7b;">pick </span><span style="color:#ff79c6;">[</span><span>09xx868</span><span style="color:#ff79c6;">]</span><span> Update snapshots
</span><span>
</span><span style="color:#6272a4;"># Rebase 242xx25..09xx868 onto 242xx25
</span><span style="color:#6272a4;">#
</span><span style="color:#6272a4;"># Commands:
</span><span style="color:#6272a4;"># p, pick = use commit
</span><span style="color:#6272a4;"># r, reword = use commit, but edit the commit message
</span><span style="color:#6272a4;"># e, edit = use commit, but stop for amending
</span><span style="color:#6272a4;"># s, squash = use commit, but meld into previous commit
</span><span style="color:#6272a4;"># f, fixup = like &quot;squash&quot;, but discard this commit&#39;s log message
</span><span style="color:#6272a4;"># x, exec = run command (the rest of the line) using shell
</span><span style="color:#6272a4;">#
</span><span style="color:#6272a4;"># These lines can be re-ordered; they are executed from top to bottom.
</span><span style="color:#6272a4;">#
</span><span style="color:#6272a4;"># If you remove a line here THAT COMMIT WILL BE LOST.
</span><span style="color:#6272a4;">#
</span><span style="color:#6272a4;"># However, if you remove everything, the rebase will be aborted.
</span><span style="color:#6272a4;">#
</span><span style="color:#6272a4;"># Note that empty commits are commented out
</span></code></pre>
<p class="note"><code>pick</code> just means that commit is included. It's the default.</p>
<p>Editing that file (either by applying actions to commits or reordering them) and closing it will reapply those commits to the branch. We’ll explore some scenarios where that is useful.</p>
<h3 id="rebase-instead-of-merge">Rebase instead of merge</h3>
<p>The branch that you branched from has been updated (let’s call it <code>master</code>), so you need to fetch latest changes and merge that into yours with <code>git pull</code>. Instead of merging and introducing an ugly new commit for that, you can rebase and pretend that nothing ever happened in the first place.</p>
<pre data-lang="bash" style="background-color:#282a36;color:#f8f8f2;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#50fa7b;">git</span><span> pull origin master</span><span style="font-style:italic;color:#ffb86c;"> --rebase
</span></code></pre>
<p class="note">"Why isn't that the default then?", you might ask. I'd guess they didn't want to make a feature that rewrites history part of the default behaviour.</p>
<h3 id="squash-commits-when-you-can">Squash commits when you can</h3>
<p>You need to fix a typo, update a test, or include anything else that should have actually been part of a commit previously introduced. You can create a new commit and later squash it to the initial one with rebase.</p>
<pre data-lang="bash" style="background-color:#282a36;color:#f8f8f2;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#50fa7b;">git</span><span> commit</span><span style="font-style:italic;color:#ffb86c;"> -m </span><span style="color:#f1fa8c;">&quot;Update contact form tests&quot;
</span><span style="color:#50fa7b;">git</span><span> rebase</span><span style="font-style:italic;color:#ffb86c;"> -i</span><span> HEAD</span><span style="color:#bd93f9;">~</span><span>2 </span><span style="color:#6272a4;"># act on top of latest 2 commits
</span></code></pre>
<p>Interactive rebase will show up, and you can mark that “Update contact form tests” as the commit to be squashed into a previous one by changing pick to <code>s</code> (squash).</p>
<p>The squashed commit has to come exactly before the commit you want to squash into, so you might have to some reordering.</p>
<h4 id="fix-up-and-save-time">Fix up and save time</h4>
<p>Using the <code>--fixup</code> flag along with the commit hash of the previous commit will <strong>mark a commit as a fix of an existing one</strong>. Then, when you rebase with <code>--autosquash</code>, they will… well, automatically get squashed.</p>
<p>Let’s say we have fixed a typo in the commit <code>i2r923</code>:</p>
<pre data-lang="bash" style="background-color:#282a36;color:#f8f8f2;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#50fa7b;">git</span><span> commit</span><span style="font-style:italic;color:#ffb86c;"> --fixup</span><span> i2r923
</span><span style="color:#50fa7b;">git</span><span> rebase</span><span style="font-style:italic;color:#ffb86c;"> --autosquash</span><span> 9ef00f2 </span><span style="color:#6272a4;"># one commit before above
</span></code></pre>
<p class="note">You can configure Git to use the <code>--autosquash</code> flag by default when rebasing. I do that so you can check <a href="https://github.com/diessica/dotfiles/blob/master/git/config">my dotfiles</a> if you're curious.</p>
<p>Quite often, you’ll know how far you’re traveling from the current commit (HEAD). Instead of specifying hashes, you can just use <code>HEAD</code> as a reference to previous commits:</p>
<pre data-lang="bash" style="background-color:#282a36;color:#f8f8f2;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#50fa7b;">git</span><span> commit</span><span style="font-style:italic;color:#ffb86c;"> --fixup</span><span> HEAD </span><span style="color:#6272a4;"># fix 1 commit before HEAD
</span><span style="color:#50fa7b;">git</span><span> rebase</span><span style="font-style:italic;color:#ffb86c;"> --autosquash -i</span><span> HEAD</span><span style="color:#bd93f9;">~</span><span>1 </span><span style="color:#6272a4;"># squash latest 2 commits
</span></code></pre>
<h3 id="stash-to-save-your-work-in-progress">Stash to save your work in progress</h3>
<p>You want to check or change other branch’s files, but don’t want to commit unfinished work either. You can <strong>stash your work in progress</strong> (“WIP”):</p>
<pre data-lang="bash" style="background-color:#282a36;color:#f8f8f2;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#50fa7b;">git</span><span> stash
</span></code></pre>
<p>That stores everything from your working directory into stash. It’s so useful in my day-to-day work that I honestly often cry using it.</p>
<p>On how to get your work back, name your WIPs, or stash specific files, refer to the <a href="https://git-scm.com/book/en/v1/Git-Tools-Stashing">docs on Git staging</a>. No way I am better at explaining than the documentation itself!</p>
<h3 id="commit-selected-chunks-of-your-work">Commit selected chunks of your work</h3>
<p>Remember the “I work in a very messy way, iterating between features” excuse? This helps. (It helped me yesterday when I refactored and introduced something new to it – should not be done altogether! – at the same time without noticing.)</p>
<p>Besides only adding a specific file to your commit with <code>git add</code>, you may want to add only a <strong>chunk of the file’s code</strong> to a commit. That can be achieved with the <code>--patch</code> flag:</p>
<pre data-lang="bash" style="background-color:#282a36;color:#f8f8f2;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#50fa7b;">git</span><span> add</span><span style="font-style:italic;color:#ffb86c;"> --patch
</span></code></pre>
<p>That’s another interface you’ll have to get comfortable with. You can also try out its <code>--interactive</code> option.</p>
<h4 id="using-vs-code">Using VS Code?</h4>
<p>VS Code has a powerful built-in Git editor that allows you to add chunks of code to a commit. To stage specific lines to commit later, open VS Code’s Git editor, select the lines of code you feel should go into a commit, and “Stage selected changes” by right-clicking on it.</p>
<figure class="text-center"><picture><img src="../../media/2018/vs-code-stage-selected-changes.png" alt="Showing how to use 'Stage Selected Changes' in VS Code"></picture>
<figcaption>Changed the whole thing but want to commit only a chunk of it? VS Code has got you covered.</figcaption></figure>
<p>The <a href="https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette">Command Palette</a> also has a “Git: Stage selected changes” option.</p>
<h3 id="rename-commit-messages-for-meaning">Rename commit messages for meaning</h3>
<p>You had a look at the final history and found out your commit messages need some love. To change your latest commit (HEAD), you can just do <code>git commit --amend</code>; for other commits, you’ll have to rebase.</p>
<p>Let’s say you want to fix the latest 5 commits:</p>
<pre data-lang="bash" style="background-color:#282a36;color:#f8f8f2;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#50fa7b;">git</span><span> rebase</span><span style="font-style:italic;color:#ffb86c;"> -i</span><span> @</span><span style="color:#bd93f9;">~</span><span>5
</span></code></pre>
<p>That will open up the <strong>interactive rebase</strong> you’re already familiar with. Find the commit you want, change pick to <code>e</code> (edit), and save and close the file; after Git rewinds to that commit, edit its message with <code>git commit --amend</code>, and run <code>git rebase --continue</code> when you’re done.</p>
<h2 id="got-a-clear-history-push-it">Got a clear history? Push it!</h2>
<blockquote>
<p>Commit Often, Perfect Later, Publish Once.<sup class="footnote-reference"><a href="#1">1</a></sup></p>
</blockquote>
<p>Make sure that your branch has got a clear, readable and meaningful history…</p>
<pre data-lang="bash" style="background-color:#282a36;color:#f8f8f2;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#50fa7b;">git</span><span> log</span><span style="font-style:italic;color:#ffb86c;"> --oneline
</span></code></pre>
<p>Then push it into the remote repository!</p>
<pre data-lang="bash" style="background-color:#282a36;color:#f8f8f2;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#50fa7b;">git</span><span> push origin head
</span></code></pre>
<p class="note"> If you have already pushed (Y THO???!), you can (carefully) use the force option (<code>-f</code>) to rewrite the remote history.</p>
<h2 id="extra-fixing-the-first-history">Extra: Fixing the first history</h2>
<p>Remember the first history? We can fix it. It’s definitely harder to change it after it’s done, but totally doable with <code>rebase -i</code>. A possible solution would be:</p>
<pre data-lang="sh" style="background-color:#282a36;color:#f8f8f2;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#50fa7b;">squash </span><span style="color:#ff79c6;">[</span><span>290xx26</span><span style="color:#ff79c6;">]</span><span> Resolve merge conflicts
</span><span style="color:#50fa7b;">pick </span><span style="color:#ff79c6;">[</span><span>9efxxf2</span><span style="color:#ff79c6;">]</span><span> Refactor event listener for form fields
</span><span style="color:#50fa7b;">squash </span><span style="color:#ff79c6;">[</span><span>5d9xx5a</span><span style="color:#ff79c6;">]</span><span> Update snapshots
</span><span style="color:#50fa7b;">squash </span><span style="color:#ff79c6;">[</span><span>948xxfa</span><span style="color:#ff79c6;">]</span><span> Update dispatch event
</span><span style="color:#50fa7b;">delete </span><span style="color:#ff79c6;">[</span><span>f5xxea1</span><span style="color:#ff79c6;">]</span><span> WIP
</span><span style="color:#50fa7b;">delete </span><span style="color:#ff79c6;">[</span><span>f8xxaae</span><span style="color:#ff79c6;">]</span><span> Revert change
</span><span style="color:#50fa7b;">delete </span><span style="color:#ff79c6;">[</span><span>49xxf55e</span><span style="color:#ff79c6;">]</span><span> Revert changes
</span><span style="color:#50fa7b;">squash </span><span style="color:#ff79c6;">[</span><span>02xxdf1</span><span style="color:#ff79c6;">]</span><span> Update snapshots
</span><span style="color:#50fa7b;">squash </span><span style="color:#ff79c6;">[</span><span>21xx329</span><span style="color:#ff79c6;">]</span><span> Pass down prop
</span><span style="color:#50fa7b;">pick </span><span style="color:#ff79c6;">[</span><span>28xxa865</span><span style="color:#ff79c6;">]</span><span> Fix onChange event and add minimal design in form
</span><span style="color:#50fa7b;">squash </span><span style="color:#ff79c6;">[</span><span>cfxx37c</span><span style="color:#ff79c6;">]</span><span> U[date snapshots
</span><span style="color:#50fa7b;">pick </span><span style="color:#ff79c6;">[</span><span>cfxx36c</span><span style="color:#ff79c6;">]</span><span> Update form to handle onChange event for autofill
</span><span style="color:#50fa7b;">fixup </span><span style="color:#ff79c6;">[</span><span>242xx25</span><span style="color:#ff79c6;">]</span><span> Fix another bug with onChange
</span><span style="color:#50fa7b;">squash </span><span style="color:#ff79c6;">[</span><span>f7xx738</span><span style="color:#ff79c6;">]</span><span> Update form component
</span><span style="color:#50fa7b;">squash </span><span style="color:#ff79c6;">[</span><span>09xx868</span><span style="color:#ff79c6;">]</span><span> Update snapshots
</span></code></pre>
<p><strong>Be mindful about your decisions and make sure you are not losing work along the way</strong>. I deleted commits unused commits (WIP then reverted), squashed “fix” and “update tests” commits, and then picked only those that are meaningful batches of work.</p>
<p>I could have also split <code>Fix onChange event and add minimal design in form</code> into two separate commits… But that’s for a future post.</p>
<h2 id="final-considerations">Final considerations</h2>
<p>Nowadays, I can say for sure that Git helps me to work better. Those techniques you’ve learned are all part of my daily workflow.</p>
<p>There is always something I don’t know about Git though, so I keep exploring. I recommend you do to do the same, and you can start right from your command line:</p>
<pre data-lang="bash" style="background-color:#282a36;color:#f8f8f2;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#50fa7b;">git</span><span> help</span><span style="font-style:italic;color:#ffb86c;"> -w</span><span> reset
</span></code></pre>
<p>Finally, if somehow you don’t feel comfortable with moving around your work from the command line, I’d recommend Git GUI clients<sup class="footnote-reference"><a href="#2">2</a></sup> – they are powerful and simplify visualising branches and its commits, especially when it gets tough<sup class="footnote-reference"><a href="#3">3</a></sup>.</p>
<p>I hope you have better, more sane, work days after that!</p>
<div class="footnote-definition" id="1"><sup class="footnote-definition-label">1</sup>
<p><a href="http://sethrobertson.github.io/GitBestPractices/">Commit Often, Perfect Later, Publish Once: Git Best Practices</a> by Seth Robertson.</p>
</div>
<div class="footnote-definition" id="2"><sup class="footnote-definition-label">2</sup>
<p>Some clients I can think of: <a href="https://desktop.github.com/">GitHub’s Git client</a> (free), <a href="https://www.gitkraken.com/">Git Kraken</a> (free), <a href="https://www.git-tower.com/">Git Tower</a> (paid).</p>
</div>
<div class="footnote-definition" id="3"><sup class="footnote-definition-label">3</sup>
<p>It will get tough, because source code management is not easy. Anyhow, it’s always tougher when you care about things anyway. Easiest thing is not to care about anything at all.</p>
</div>
</content>
</entry>
<entry xml:lang="en">
<title>Computer and Human Languages</title>
<published>2018-06-20T18:06:00+00:00</published>
<updated>2018-06-20T18:06:00+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="/blog/computer-and-human-languages/"/>
<id>/blog/computer-and-human-languages/</id>
<content type="html" xml:base="/blog/computer-and-human-languages/"><p class="note">Basic knowledge of computer languages (mainly JavaScript) is assumed.</p>
<p>Some time ago, a friend of mine asked how skilled I’d say I was with JavaScript. I told him I was <em>fluent</em>.</p>
<p>– <em>Fluent? What does it mean to be fluent?</em></p>
<p>– <em>Well, think Portuguese.</em> – We both speak Portuguese — <em>I don’t know every word, but I do know the language enough to express anything I need somehow.</em></p>
<p>It turned out that “fluent” was just the perfect word.</p>
<hr />
<p>Fluency is a powerful and straightforward concept to express your ability with a language. When it comes to <strong>human languages</strong>, it’s the ability to fully communicate your intentions to a human; for <strong>computer languages</strong>, the ability to fully communicate your intentions to a computer.</p>
<p>That line of thought is shared in one of the most important and revolutionary introductory books to Computer Science. In <em>Structure and Interpretation of Computer Programs</em>, right before introducing Lisp (the programming language used throughout the book) a similar analogy is made:</p>