From 59c2bb4cb1c146514073c6273ba48a0ca7e18a2c Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Fri, 21 May 2021 12:09:51 +0800 Subject: [PATCH] Update my cards and my notebook Some additional notes on some tools I seem to use more frequently. Nothing unusual here. --- cards/2021.org | 105 ++++++++++++++++-- .../2021/basic-notation-reading-1-1.eps | Bin 75245 -> 75316 bytes .../assets/2021/basic-notation-reading-1.png | Bin 4196 -> 4695 bytes .../2021/basic-notation-reading-3-1.eps | Bin 146425 -> 146425 bytes structured/cli.journalctl.org | 54 +++++++++ structured/data.wikidata.org | 13 +++ structured/sysadmin.systemd.org | 60 ++++++++++ .../{lang.lilypond.org => text.lilypond.org} | 0 8 files changed, 221 insertions(+), 11 deletions(-) create mode 100644 structured/cli.journalctl.org create mode 100644 structured/data.wikidata.org create mode 100644 structured/sysadmin.systemd.org rename structured/{lang.lilypond.org => text.lilypond.org} (100%) diff --git a/cards/2021.org b/cards/2021.org index 266e10c..cff9a92 100644 --- a/cards/2021.org +++ b/cards/2021.org @@ -3,12 +3,13 @@ :END: #+title: Anki: 2021 #+date: "2021-05-01 20:20:25 +08:00" -#+date_modified: "2021-05-16 13:58:36 +08:00" +#+date_modified: "2021-05-21 12:09:04 +08:00" #+language: en #+property: anki_deck 2021 +#+property: header_args :exports both #+name: lilypond-paper-config -#+begin_src lilypond :exports none +#+begin_src lilypond :exports none :results none \paper { indent=10\mm oddFooterMarkup=##f @@ -484,6 +485,8 @@ Give various pitfalls and illusions of competence to look out when learning. - *The presence of the material itself* can cause students to foolishly think they already know about the subject. - Similarly, *studying with solutions can be a trap if you focus on the what and how rather than the why*. - Various common practices such as highlighting, rereading, and mind mapping are not as effective and only applicable in specific situations. +- The einstellung mindset, *being invested in an idea that you can't see other solutions*. +- Similarly, *overlearning can occur if you're aiming for complete mastery when you should move on after understanding the concept*. * org-babel :PROPERTIES: @@ -511,9 +514,6 @@ Among the list of features, org-babel makes the following things easier for crea ** Front How to make org-babel pass values between different source code blocks? ** Back -:PROPERTIES: -:ID: 5c959c6a-04fb-4154-becc-86eeb15b20ad -:END: First, configure org-babel to work in functional mode (i.e., ~:results value~) in a source code block. With functional mode, it will return values which will be handled by org-babel. @@ -557,8 +557,7 @@ If so, how? ** Back Yes! -With source code blocks and the [[https://orgmode.org/manual/Noweb-Reference-Syntax.html][noweb]] option enabled, you can make meta-programming in Org. -You can declare a function by assigning a name on the code block (i.e., ~#+name: ${FUNC_NAME}~). +By attaching a name to a code block and [[https://orgmode.org/manual/Evaluating-Code-Blocks.html#Evaluating-Code-Blocks][evaluating]] them, it is possible. Here's an example of a source code block with a default argument. @@ -578,6 +577,7 @@ You can then call the function in different ways: You can then pass header arguments by appending in square brackets (=[]=) before invoking it — e.g., ~call_greeting[:results replaces]()~, ~#+call: greeting[:results replace]()~, ~<>~. + * Org mode: Asciidoctor-styled callouts :PROPERTIES: :ANKI_NOTE_TYPE: Styled cards @@ -671,8 +671,6 @@ Give some ways how to navigate Org mode documents quickly. What function creates a buffer for certain elements in org-mode but it is especially useful for editing source code blocks where it will open with the correct major mode? ** Back ~org-edit-special~ -- The einstellung mindset, *being invested in an idea that you can't see other solutions*. -- Similarly, *overlearning can occur if you're aiming for complete mastery when you should move on after understanding the concept*. * Practices for studying :PROPERTIES: @@ -804,8 +802,8 @@ What notes are displayed (in order)? #+results: [[file:assets/2021/basic-notation-reading-2.png]] -** Back -A C major triad (i.e., C E G). +** Back A +C major triad (i.e., C E G). Then the notes E, F, and A. * Basic music notation reading 3 @@ -828,3 +826,88 @@ What notes are displayed (in order)? ** Back C, D, C-A (a major sixth), E-B (a minor fifth), and G-F (a seventh). + +* Watch the logs of a systemd unit +:PROPERTIES: +:ANKI_NOTE_TYPE: Styled cards +:ANKI_NOTE_ID: 1621570139174 +:END: +** Front +What is happening with the following command? + +#+begin_src shell :results none +journalctl -u backup -fb +#+end_src + +** Back +Watch the logs from the systemd unit ~backup.service~ starting from boot time. + +The command could also be written in the same way. + +#+begin_src shell :results none +journalctl --unit backup --follow --boot +#+end_src + +* Restoring a file in Git +:PROPERTIES: +:ANKI_NOTE_TYPE: Styled cards +:ANKI_NOTE_ID: 1621570139642 +:END: +** Front +How to restore a file in Git? +** Back +#+begin_src shell :results none +git restore $FILE_PATH +#+end_src + +Despite the name, it will also delete the file if it's detected as untracked file in the Git worktree. + +* Setting environment variables with systemd environment directive +:PROPERTIES: +:ANKI_NOTE_TYPE: Styled cards +:ANKI_NOTE_ID: 1621570140918 +:END: +** Front +How to set environment variables with systemd? +** Back +Create an environment directive file in the specified directory. +You can find the search paths and the syntax from =environment.d.5= manual page. + +Basically, it is a shell-like config for setting environment variables. +The following shows that. + +#+begin_src shell :results none +TERM=alacritty +EDITOR=nvim +BROWSER=brave +MANPAGER="nvim +Man!" + +PATH=${PATH:+$PATH:}${GUIX_PROFILE:-$HOME/.guix-profile}/bin +XDG_DATA_DIRS=${GUIX_PROFILE:-$HOME/.guix-profile}/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share} +#+end_src + +Compared to exporting values with the user shell (e.g., =.bashrc=, =.zshrc=) where they are only applied when the shell is called, environment variables generated from the directive can be recognized from applications that called non-interactively (e.g., GNOME desktop search, Rofi). + +You can also view the resulting environment with ~systemctl show-environment~. + +* Emacs Lisp conditionals +:PROPERTIES: +:ANKI_NOTE_TYPE: Styled cards +:ANKI_NOTE_ID: 1621570142444 +:END: +** Front +Give some functions for creating a conditional in Emacs Lisp. +** Back +Below are the common way to control the flow with Elisp. + +#+begin_src elisp :results none +(if (and nil nil) + (message "Hello there!") + (message "Not hello there, sith lord!")) + +(unless t + (message "Not hello there, sith lord!")) + +(when t + (message "Hello there!")) +#+end_src diff --git a/cards/assets/2021/basic-notation-reading-1-1.eps b/cards/assets/2021/basic-notation-reading-1-1.eps index 0fbfcdb7bbaf1e3e6a488412f2d1ac230954b8ed..5e115531dc2fca5c8dc0c6c2b5a55f667604fd6f 100644 GIT binary patch delta 583 zcmZ{gyG{Z@6ozxc27`^75Gl9~ESHEd&dk}Fg>6jKASPO9LSbTJOl(v@V_`H_R<<;H z-oaXH?bTY4B$AX%p_!5y>U>GJurGz|5%H z8>?1E?a#4xh4NV_MUi_-BE2wJb(FBQk1SN^ISZ*_*&Mzqv}gwu$wBd+K`dNLlaqsj ztxA87m`(E%uGv8`qPR!Z9IVF;7j1eA>sUBvUzC58ywMZSb^jw6rkXSuJcf+ z{wrt%Qj8lcf?h2PG{s%mj(Y==k{s(Af3j=p=O8&h8A%T=BqN@^;%otmVZi4(!xf^9 zCAd&pu$rM|7t%?zY0+b~`me&O(6{ID`M`ja4fZNtpvNqptT(%NdwYi{Dnyi^C}<^0ARxh*h=s&bENyIL zUcm>@TCKJ53GD2A2lrIWS%~HQJM;bj{Uo0bOhTTGs&auFtyf(HU6JusN0nIeo^7#QSh5vJ)rKGtIo(OwD_4^a7Em(l8P zCEB4LgQ_Kw2XtD3m5j$d?I~76$qeZmYHt?DX3@ zRG}a0DR$I6Io#jgS{)LGK&%X=1+ImwscA!&F3P}jnrrC?hK*cBZ0T@x1scJjM;r3; zPm3T#C+;yIQMv;2mLWN`XTxR&zhfhp+LIC5yew29=l%&7p^UT5fyU2JrsRSRbF^N8 z8|vGTP6+PPr46~fFkg|b!HaJ{m!tHf-tb>PFH~{AACzh3(=R1l?)XAQ&5e%uQku$4 QDB(G*CcgrVQDy?z2lGvtxBvhE diff --git a/cards/assets/2021/basic-notation-reading-1.png b/cards/assets/2021/basic-notation-reading-1.png index 1087c9f44f8017b2068c171e4a17252c9d30e18d..978ffc38b671eda0e474f95f0b37bcfc98c65da1 100644 GIT binary patch delta 2292 zcmVu}|B~8^@pg1X7U-vQr6FWhgOauCOz|9UR(!AV8;XHbZxtp?^TaQr4J% z01;ML2t$WT6|%$7N*%xn9a5l!ohGWNL{Z-1`MoDA1n2BHv7P!eAop_do%8tap6@+( z*Hov|frL2oKd)b?)oQkF52Gpx{(tahLc=fwL0DN?8B%Q$eBi-^hGFD#xn{F@babR? z+VJX>;E5FdSSScWwOYmNOeRy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I)1-OVShi&As0 z1*i)4$%(Qo@9*z9Rl(8dd8Aw;$5jQ#;ud|&7N9CPC?|v}xKNHRC%SNps-QI&B`1W3 f(tz%A;)whM{+wc)r@gzr00000NkvXXu0mjf(%o!9 diff --git a/cards/assets/2021/basic-notation-reading-3-1.eps b/cards/assets/2021/basic-notation-reading-3-1.eps index c59004be93f85fb3abf4244811afa9173481d632..56ff2bde63b4598129d08d793e3e944cb58c27ae 100644 GIT binary patch delta 238 zcmezQo#W?sj)oS-Ele(EVqpP(iAiqyIhi??1^Ia?x<#%TNfqJKqs*8l;gVxAXPS&l nZnZgXeZdwu^=