Update cards, documentation, and dependencies

This commit is contained in:
Gabriel Arazas 2021-05-07 12:11:25 +08:00
parent a1a281886d
commit 5355a8c144
8 changed files with 315 additions and 9 deletions

View File

@ -24,6 +24,20 @@ Fortunately for me, most of the private files are connected with each other (a s
== Why set up like this?
We need to focus on why did I need to make the structure like this.
For this question, I answer with the outcomes that I expect from the note-taking system I eventually settled with.
- I want ideas to be searched and woven so easily with the rest.
- I'm not an expert so I still need the "basic" way of taking structured notes, summarizing them until I gain a bigger picture of the things I'm curious about.
- I want to easily integrate spaced repetition and randomness to encourage improvement on my notes.
This project is the result of that with org-roam, Anki, and eventually more (preferably less) tools to stick around and gain ideas from.
== Getting started == Getting started
Interested in copying my setup? Interested in copying my setup?
@ -128,7 +142,7 @@ Here's an example Doom Emacs configuration for that:
(add-hook 'before-save-hook 'time-stamp) (add-hook 'before-save-hook 'time-stamp)
---- ----
+ +
Just see my link:https://github.com/foo-dogsquared/dotfiles/tree/4e8f036b73a71d02f5909f4f28898a79c2311147/emacs[Doom Emacs config] in my dotfiles. Just see my link:https://github.com/foo-dogsquared/dotfiles/tree/75de71b4d0dfe79fe820204e365809cee11d7349/emacs[Doom Emacs config] in my dotfiles.
* The related assets are stored in the link:./assets/[`./assets/`]. * The related assets are stored in the link:./assets/[`./assets/`].
The asset folder names should be the same as the filename of the org-mode document — e.g., `2021-04-06-15-04-11.org` should have an asset folder in `./assets/2021-04-06-15-04-11/`. The asset folder names should be the same as the filename of the org-mode document — e.g., `2021-04-06-15-04-11.org` should have an asset folder in `./assets/2021-04-06-15-04-11/`.

View File

@ -3,7 +3,7 @@
:END: :END:
#+title: Anki: Emacs #+title: Anki: Emacs
#+date: "2021-05-02 19:18:32 +08:00" #+date: "2021-05-02 19:18:32 +08:00"
#+date_modified: "2021-05-04 20:51:29 +08:00" #+date_modified: "2021-05-06 21:57:59 +08:00"
#+language: en #+language: en
#+property: anki_deck Emacs #+property: anki_deck Emacs
@ -74,3 +74,45 @@ if the buffer is modified in one of the window, it will show the changes in all
A marker is another point in the buffer. A marker is another point in the buffer.
It is usually found when interacting with regions when asked for the two points (i.e., the beginning and the ending position). It is usually found when interacting with regions when asked for the two points (i.e., the beginning and the ending position).
Furthermore, a marker can be used to save locations and jump back to that marker when asked. Furthermore, a marker can be used to save locations and jump back to that marker when asked.
* Interacting with buffers in Elisp
:PROPERTIES:
:ANKI_NOTE_TYPE: Styled cards
:ANKI_NOTE_ID: 1620309319576
:END:
** Front
Give a rough example on how to do the following.
- Create a temporary buffer containing the text "Hello world".
- Name the buffer and open it as an Org mode document.
- Get or create the ID for the document.
** Back
#+begin_src elisp :exports code
(with-temp-buffer
(insert "Hello world")
(org-mode))
#+end_src
* String comparison in Emacs Lisp
:PROPERTIES:
:ANKI_NOTE_TYPE: Styled cards
:ANKI_NOTE_ID: 1620309321231
:END:
** Front
How to compare two strings?
** Back
~(string= STR1 STR2)~
#+begin_src elisp
(print (string= "WHOA" "whoa"))
(print (string= "WHOA" (upcase "whoa")))
(print (string= "Hello world" "HeLL0 World"))
#+end_src
#+results:
:
: nil
:
: t
:
: nil

View File

@ -3,7 +3,7 @@
:END: :END:
#+title: Anki: Linux #+title: Anki: Linux
#+date: "2021-05-01 20:20:25 +08:00" #+date: "2021-05-01 20:20:25 +08:00"
#+date_modified: "2021-05-04 20:51:29 +08:00" #+date_modified: "2021-05-06 18:33:03 +08:00"
#+language: en #+language: en
#+property: anki_deck Linux #+property: anki_deck Linux
@ -41,3 +41,65 @@ How to test out systemd timestamps?
~systemd-analyze {calendar,timestamp,timespan}~ ~systemd-analyze {calendar,timestamp,timespan}~
To know how the format (i.e., calendar, timestamp, and timespan) looks like, you can refer to ~man systemd.time.5~. To know how the format (i.e., calendar, timestamp, and timespan) looks like, you can refer to ~man systemd.time.5~.
* Enabling desktop integration
:PROPERTIES:
:ANKI_NOTE_TYPE: Styled cards
:ANKI_NOTE_ID: 1620296263978
:END:
** Front
How to make desktop environments recognize the desktop files?
** Back
Most of the desktop environments and certain applications like Rofi refers to the ~XDG_DATA_DIRS~ environment variable, a list of colon-delimited paths similar to ~PATH~.
This enables desktop integration with certain tools like [[https://nixos.org/][Nix]] and [[https://guix.gnu.org/][Guix]] package manager.
Here's how to integrate installed Nix packages into the desktop.
#+begin_src shell
XDG_DATA_DIRS=$HOME/.nix-profile/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}
#+end_src
* Flatpak permissions
:PROPERTIES:
:ANKI_NOTE_TYPE: Styled cards
:ANKI_NOTE_ID: 1620296265390
:END:
** Front
What permissions does user-installed Flatpak apps have by default?
** Back
By default, they have none.
[[https://docs.flatpak.org/en/latest/sandbox-permissions.html][Among the default limitations]]:
- They can only access their own runtime folder =$HOME/.var/app/${FLATPAK_APP_ID}=.
- They cannot access the network.
Some apps are installed with the request to allow the following permissions enabled (e.g., Zotero).
If left with no permissions, you'll see in certain situations like a file browser dialog that the permissions is in effect.
Below are some of the examples interacting with the permissions of an app.
#+begin_src shell
# Show the permissions of an app.
flatpak permission-show ${FLATPAK_APP_ID}
# Let the user-installed Flatpak app access the home directory.
flatpak override --user --filesystem=home ${FLATPAK_APP_ID}
#+end_src
* The basics of Flatpak apps
:PROPERTIES:
:ANKI_NOTE_TYPE: Styled cards
:ANKI_NOTE_ID: 1620296265848
:END:
** Front
What is a Flatpak package?
Does it have its own form of managing dependencies?
** Back
A Flatpak package can either be a runtime or a standalone app.
Runtimes are the basic dependencies of an application.
Only select packages available as a runtime (e.g., Qt, GTK).
Flatpak has its set of runtimes composed of system libraries to be used with the applications.
Thus, it stays out of its way with the operating system's libraries.
The developer can also bundle its own set of libraries.

128
cards/org-mode.org Normal file
View File

@ -0,0 +1,128 @@
:PROPERTIES:
:ID: b804fe54-d7f4-4809-be9e-50779b4b9314
:ANKI_DECK: Emacs
:END:
#+title: Anki: Org mode
#+date: "2021-05-05 22:49:10 +08:00"
#+date_modified: "2021-05-06 01:42:46 +08:00"
#+language: en
* org-babel
:PROPERTIES:
:ANKI_NOTE_TYPE: Styled cards
:ANKI_NOTE_ID: 1620236488535
:END:
** Front
What makes Org mode popular for reproducible research?
** Back
org-babel, the library that enables superpowers for Org mode source code blocks.
Among the list of features, org-babel makes the following things easier for creating lab notebooks.
- Execute the source code block and print results.
- Create files from source code blocks, making it possible to create an entire computational report with a single Org mode document.
- Metaprogramming with [[https://orgmode.org/manual/Noweb-Reference-Syntax.html][noweb-inspired system]] making dynamic content possible.
- Individual control over source code blocks with sessions, export options, and variables.
- Pass values between different source code blocks even in different programming languages.
* org-babel modes
:PROPERTIES:
:ANKI_NOTE_TYPE: Styled cards
:ANKI_NOTE_ID: 1620236489830
:END:
** 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.
#+begin_src org
,#+name: num
,#+begin_src python :results value
return 53
,#+end_src
#+end_src
The value cannot be passed unless it has a name that others can reference yet so add a name property to the source code block (i.e., ~#+name: ${NAME}~).
Now here's a different source code block written in a different language.
To pass a value, you have to configure with ~:var ${VARNAME}=${NAME}~.
#+begin_src org
,#+begin_src ruby :var num=num :results output
print(num)
,#+end_src
#+end_src
* Creating files with Org mode
:PROPERTIES:
:ANKI_NOTE_TYPE: Styled cards
:ANKI_NOTE_ID: 1620236490049
:END:
** Front
How to create files with Org mode source code blocks?
** Back
The ~:tangle~ option enables extracting code blocks into files.
Accepted values include =yes=, =no=, or a relative path to the Org document where the file will be written.
* Dynamic content with Org mode
:PROPERTIES:
:ANKI_NOTE_TYPE: Styled cards
:ANKI_NOTE_ID: 1620236491388
:END:
** Front
Is creating dynamic content possible?
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}~).
Here's an example of a source code block with a default argument.
#+begin_src org
,#+name: greeting
,#+header: :var name="World"
,#+begin_src sh
echo "Hello ${name}"
,#+end_src
#+end_src
You can then call the function in different ways:
- For calling it inline, ~call_${FUNC_NAME}()~.
- For creating a block, ~#+call: ${FUNC_NAME}()~.
- For invoking inside a code block, ~<<${FUNC_NAME}()>>~, but you have to enable noweb (e.g., ~:noweb yes~).
You can then pass header arguments by appending in square brackets (=[]=) before invoking it — e.g., ~call_greeting[:results replaces]()~, ~#+call: greeting[:results replace]()~, ~<<greeting[:results replace]()>>~.
* Asciidoctor-styled callouts
:PROPERTIES:
:ANKI_NOTE_TYPE: Styled cards
:ANKI_NOTE_ID: 1620236492755
:END:
** Front
Are callouts possible?
If so, how?
** Back
Surprisingly, yes!
It is just hidden on the documentation.
Specifically, on the [[https://orgmode.org/manual/Literal-Examples.html][Literal examples]] section of the Org mode manual.
Here's an example to do it.
#+begin_src org
,#+begin_src python
print("Hello world") # (ref:hello)
print(2 + 5) # (ref:num)
,#+end_src
In [[(hello)][line 1]], we have printed the traditional "Hello world" program.
In [[(num)][the second line]], we've done a simple arithmetic and printed it into the console.
#+end_src
To create Asciidoctor-styled callouts, create a reference inside of the code block and refer to it (i.e., ~(${ref})~).

View File

@ -3,7 +3,7 @@
:END: :END:
#+title: Anki: Vim #+title: Anki: Vim
#+date: "2021-05-01 17:52:58 +08:00" #+date: "2021-05-01 17:52:58 +08:00"
#+date_modified: "2021-05-04 20:51:30 +08:00" #+date_modified: "2021-05-06 21:58:16 +08:00"
#+language: en #+language: en
#+property: anki_deck Vim #+property: anki_deck Vim
@ -38,7 +38,7 @@ How to jump into a keyword?
** Front ** Front
How to go to the file path at point? How to go to the file path at point?
** Back ** Back
=gf= as in *goto file*. =gf= (in normal mode) as in *goto file*.
* Set as a pager * Set as a pager
:PROPERTIES: :PROPERTIES:
@ -80,3 +80,53 @@ A filetype is how Vim knows what plugins to apply to the current buffer.
Vim has a few built-in filetypes such as shell, manual pages, Markdown, Asciidoc, xmodmap, patch files, and JSON among others (that are in =$VIMRUNTIME/filetype.vim=). Vim has a few built-in filetypes such as shell, manual pages, Markdown, Asciidoc, xmodmap, patch files, and JSON among others (that are in =$VIMRUNTIME/filetype.vim=).
For more information, run ~:help filetype~ inside Vim. For more information, run ~:help filetype~ inside Vim.
* Going to keyword definitions
:PROPERTIES:
:ANKI_NOTE_TYPE: Styled cards
:ANKI_NOTE_ID: 1620225232521
:END:
** Front
How to go to the keyword definition?
** Back
=gd= as in *go to definition*.
Though, not all the time it will do what its supposed to do.
For better effect, you can generate a Ctags file which Vim has a built-in integration (see ~:h ctags~).
* Vim modes
:PROPERTIES:
:ANKI_NOTE_TYPE: Styled cards
:ANKI_NOTE_ID: 1620225233076
:END:
** Front
What is a mode (in Vim)?
** Back
A Vim mode is a set of behavior and actions.
In this case, it considers editing and navigation (among other modes) to be separate.
Thus, you need to switch between them to do those things.
Vim has built-in modes which you can see with ~:h vim-modes~.
* Word wrapping
:PROPERTIES:
:ANKI_NOTE_TYPE: Styled cards
:ANKI_NOTE_ID: 1620309338874
:END:
** Front
How to do word wrapping?
** Back
=gw= as in *go format the words*.
By default, it simply line wraps the lines with the 80-character limitation.
* Using the help system
:PROPERTIES:
:ANKI_NOTE_TYPE: Styled cards
:ANKI_NOTE_ID: 1620309339153
:END:
** Front
How to effectively make use of the help system?
** Back
The usual way is to execute ~:h~ or ~:help~.
You can view what does a keybinding do with ~:h ${KEYBINDING}~ — e.g., ~:h gw~ to know what =gw= does, ~:h V~ for viewing visual line mode.
For keybindings in visual and command line mode, prepend them with ~v_~ and ~c_~, respectively.

View File

@ -2,13 +2,9 @@
:ID: e9fa93ca-b4fb-44b8-ad3c-d10107150697 :ID: e9fa93ca-b4fb-44b8-ad3c-d10107150697
:END: :END:
#+TITLE: Index #+TITLE: Index
#+AUTHOR: "Gabriel Arazas"
#+EMAIL: "foo.dogsquared@gmail.com"
#+DATE: "2020-09-07 05:49:06 +08:00" #+DATE: "2020-09-07 05:49:06 +08:00"
#+DATE_MODIFIED: "2020-09-09 05:49:21 +08:00" #+DATE_MODIFIED: "2020-09-09 05:49:21 +08:00"
#+LANGUAGE: en #+LANGUAGE: en
#+OPTIONS: toc:t
#+PROPERTY: header-args :exports both
Hello! Hello!
@ -16,3 +12,6 @@ This is my public knowledge graph publicly available for the public.
It is mostly intended for easy access for my notes in case I'm not in my computer along with sharing my findings with the rest of the world (and hopefully getting feedback on it). It is mostly intended for easy access for my notes in case I'm not in my computer along with sharing my findings with the rest of the world (and hopefully getting feedback on it).
If you want to view my notes in its raw form, you can look at the [[http://github.com/foo-dogsquared/wiki][Git repo]]. If you want to view my notes in its raw form, you can look at the [[http://github.com/foo-dogsquared/wiki][Git repo]].
There's no good index note yet so eeeeeeeeeeeeeehhhhhhhhhhhhhhhhhhhhh...
As of 2021-05-07, my interest is in document [[roam:Personal information management]], [[roam:Illustration]], package management, and programming.

View File

@ -204,6 +204,16 @@
keywords = {data-mining} keywords = {data-mining}
} }
@video{spudlyoConsistentTechnicalDocuments2019,
title = {Consistent {{Technical Documents Using Emacs}} and {{Org Mode}}},
editor = {{spudlyo}},
date = {2019-11-17},
url = {https://www.youtube.com/watch?v=0g9BcZvQbXU&t=851s},
urldate = {2021-05-05},
abstract = {Files used in the demo: https://gitlab.com/spudlyo/orgdemo\mbox{} My dotfiles: https://gitlab.com/spudlyo/dotfiles\mbox{} Read The Org: https://github.com/fniessen/org-html-...\mbox{} Read The Docs: https://sphinx-rtd-theme.readthedocs....\mbox{} Git from the Bits Up: https://www.youtube.com/watch?v=MYP56...\mbox},
editortype = {director}
}
@unpublished{stevenpinkerLinguisticsStyleWriting2015, @unpublished{stevenpinkerLinguisticsStyleWriting2015,
title = {Linguistics, {{Style}} and {{Writing}} in the 21st {{Century}} - with {{Steven Pinker}}}, title = {Linguistics, {{Style}} and {{Writing}} in the 21st {{Century}} - with {{Steven Pinker}}},
author = {{Steven Pinker}}, author = {{Steven Pinker}},

View File

@ -10,5 +10,6 @@ pkgs.mkShell {
python3 python3
racket racket
R R
recoll
]; ];
} }