diff options
author | Jasper Ras <jras@hostnet.nl> | 2025-01-19 21:14:51 +0100 |
---|---|---|
committer | Jasper Ras <jras@hostnet.nl> | 2025-01-19 21:14:51 +0100 |
commit | 9642cd7ae24f0ba79ce5647c709b35ae8f06a285 (patch) | |
tree | ae25c3b0db7ae4c23186b294c6d000073f085c2d /3 resources | |
parent | 969b96c2531fb986f6c7f21fd544391b439defd7 (diff) |
vault backup: 2025-01-19 21:14:51
Diffstat (limited to '3 resources')
67 files changed, 0 insertions, 812 deletions
diff --git a/3 resources/.gitkeep b/3 resources/.gitkeep deleted file mode 100644 index e69de29..0000000 --- a/3 resources/.gitkeep +++ /dev/null diff --git a/3 resources/Bash.md b/3 resources/Bash.md deleted file mode 100644 index 841443f..0000000 --- a/3 resources/Bash.md +++ /dev/null @@ -1 +0,0 @@ -How to [[Reference arguments]].
\ No newline at end of file diff --git a/3 resources/Bash/Reference arguments.md b/3 resources/Bash/Reference arguments.md deleted file mode 100644 index f39eeb1..0000000 --- a/3 resources/Bash/Reference arguments.md +++ /dev/null @@ -1,6 +0,0 @@ -Reference as array: `$@`. -Reference as string: `$*`. - -Let's say we want to open a file in our favorite editor through a script, prefixing the filename with something such as a date. -If we were to use `hx "$(date) $@"`, where we reference the arguments as an array, it'd open more than one file - one for the date and one for each argument. -We must use `$*` so that our invocation becomes `hx "$(date) $*"`. This would open a single file with the name being the combination of our arguments prefixed by date.
\ No newline at end of file diff --git a/3 resources/CSS.md b/3 resources/CSS.md deleted file mode 100644 index 32a3113..0000000 --- a/3 resources/CSS.md +++ /dev/null @@ -1,28 +0,0 @@ -**Display** -display none vs visibility hidden: display: none is really like the element does not exist. Visibility hidden just hides it but it still takes space. - -A display: none element can still have size and be coloured with a background image. It still doesn't take space. This can be used for a timeline bar for example! - -**Flexbox** -Flexbox deals with layout always in only one dimension; it's possible to specify which dimension: either vertical or horizontal. - -Two axes: main and cross - -Control main axis: `flex-direction: row|row-reverse|column|column-reverse`. The first two make it a horizontal layout and the latter make it a vertical layout. - -Cross axis is always the opposite of `flex-direction`, so if `flex-direction: row-reverse` the cross axis is `column-reverse`. - -The writing mode determines where the start and end are, based on for example languages. Japanese is written from right-to-left rather than western left-to-right. -So while in Europe the start of a flexbox is at the left and the end at the right in Japan this would be reversed. - -**Relationships** -An important aspect of creating layouts with CSS is the relationships of elements with each other. For example parent/child relationships. - -If we change the width of a parent element; the height of all children increase. This happens because the total area of the parent remains the same. - -When the edge of a child aligns with its parent and we add a margin to the child; it pushes to the parent as well. This phenomenon is called ==collapsing margins==. It can be prevented by unaligning the edge(s) for example by adding padding or setting `display: flow-root;`. - -In `flexbox` siblings push against each other; if we add padding to one, it pushes against the other making it smaller. This does not happen in grid, where each cell gets a fixed size and the padding pushes against its own side. - -**Centering stuff** -Use `margin-inline: auto;` -> this adds margins on both sides of the element. This can be used to center stuff on the page for example.
\ No newline at end of file diff --git a/3 resources/HTML/Inline VS Block elements.md b/3 resources/HTML/Inline VS Block elements.md deleted file mode 100644 index bd72478..0000000 --- a/3 resources/HTML/Inline VS Block elements.md +++ /dev/null @@ -1,69 +0,0 @@ -A block element always starts on a new line and automatically have their margin set to a non-zero value. -An inline element, as the name suggests, does not start on a new line and has no automatic margins. It -takes only the space that is required for the content it contains. - -Block elements: -- <address> -- <article> -- <aside> -- <blockquote> -- <canvas> -- <dd> -- <div> -- <dl> -- <dt> -- <fieldset> -- <figcaption> -- <figure> -- <footer> -- <form> -- <h1>-<h6> -- <header> -- <hr> -- <li> -- <main> -- <nav> -- <noscript> -- <ol> -- <p> -- <pre> -- <section> -- <table> -- <tfoot> -- <ul> -- <video> - -Inline elements: -- <a> -- <abbr> -- <acronym> -- <b> -- <bdo> -- <big> -- <br> -- <button> -- <cite> -- <code> -- <dfn> -- <em> -- <i> -- <img> -- <input> -- <kbd> -- <label> -- <map> -- <object> -- <output> -- <q> -- <samp> -- <script> -- <select> -- <small> -- <span> -- <strong> -- <sub> -- <sup> -- <textarea> -- <time> -- <tt> -- <var> diff --git a/3 resources/Helix/Inline diagnostics.md b/3 resources/Helix/Inline diagnostics.md deleted file mode 100644 index 2a84825..0000000 --- a/3 resources/Helix/Inline diagnostics.md +++ /dev/null @@ -1,13 +0,0 @@ -#helix #editor - - -completion supports paths (filepaths etc). -snippet completion from LSP supported -inline diagnostics can be enabled with: -``` -[editor] -end-of-line-diagnostics = "hint"; - -[editor.inline-diagnostics] -cursor-line = "error"; -```
\ No newline at end of file diff --git a/3 resources/Images/IMG_3980.jpg b/3 resources/Images/IMG_3980.jpg Binary files differdeleted file mode 100644 index 93dac36..0000000 --- a/3 resources/Images/IMG_3980.jpg +++ /dev/null diff --git a/3 resources/Images/IMG_3981.jpg b/3 resources/Images/IMG_3981.jpg Binary files differdeleted file mode 100644 index bea7875..0000000 --- a/3 resources/Images/IMG_3981.jpg +++ /dev/null diff --git a/3 resources/Images/IMG_3982.jpg b/3 resources/Images/IMG_3982.jpg Binary files differdeleted file mode 100644 index 8697dc4..0000000 --- a/3 resources/Images/IMG_3982.jpg +++ /dev/null diff --git a/3 resources/Images/IMG_3985.jpg b/3 resources/Images/IMG_3985.jpg Binary files differdeleted file mode 100644 index e78dec5..0000000 --- a/3 resources/Images/IMG_3985.jpg +++ /dev/null diff --git a/3 resources/Images/IMG_3987.jpg b/3 resources/Images/IMG_3987.jpg Binary files differdeleted file mode 100644 index da257d5..0000000 --- a/3 resources/Images/IMG_3987.jpg +++ /dev/null diff --git a/3 resources/Images/Pasted image 20250107205518.jpg b/3 resources/Images/Pasted image 20250107205518.jpg Binary files differdeleted file mode 100644 index bea7875..0000000 --- a/3 resources/Images/Pasted image 20250107205518.jpg +++ /dev/null diff --git a/3 resources/MermaidJS.md b/3 resources/MermaidJS.md deleted file mode 100644 index 2e4b71e..0000000 --- a/3 resources/MermaidJS.md +++ /dev/null @@ -1,24 +0,0 @@ -#resource - ---- -**ZenUML** -Optional **Title** -**Participants** can be declared when used or at the start. -**Annotators** give **participants** a special icon, defined at the doc site. -**Aliases** give a short **participant** name a more descriptive name when rendered, e.g: A as Alice <- Alice will be rendered, but the code can use A. -**Messages** between **participants** can be **sync, async, creation or reply**. -**Sync** use A.\<MessageName\> have a block {} for nested messages -**Async** use an arrow A->B: How are you? -**Creation** new keyword new A(optional params) -**Reply** three ways to define: -* Assign var from **Sync** message, e.g: OptionalType a = A.SyncMessage() -* Return A.SyncMessage { return blaat } -* @return or @reply on an **async** message -**Nesting** can be done on both creation and sync messages using blocks {}. -**Comments** can be added using `// comment` and support markdown. -**Loops** can be defined using keywords: **while, for, foreach and loop**. -**Alternative** paths can be sequenced using **if, else** statements. if(blaat) { A.syncMessage(B) } -**Opt** fragments rendered via `opt { ... }`. This can be useful for optional responses or paths. -**Parallel** paths can be defined using `par { ... }`. -**Try/catch/finally** statements are supported as well. -**@Starter(participant)** to make the line start from a **participant**
\ No newline at end of file diff --git a/3 resources/MySQL.md b/3 resources/MySQL.md deleted file mode 100644 index dc44345..0000000 --- a/3 resources/MySQL.md +++ /dev/null @@ -1 +0,0 @@ -Foreign keys live in `information_schema.referential_constraints`.
\ No newline at end of file diff --git a/3 resources/Obsidian.md b/3 resources/Obsidian.md deleted file mode 100644 index 2c256d2..0000000 --- a/3 resources/Obsidian.md +++ /dev/null @@ -1,6 +0,0 @@ -#resource #obsidian - -Command-palette: CTRL+P -# Templates -Templates can be configured in Settings > Core Plugins > Templates. It requires to have a directory dedicated to templates. We can then insert templates into notes using the command: Insert highlight. -We can also configure a templare for our daily notes, via Settings > Core Plugins > Daily note.
\ No newline at end of file diff --git a/3 resources/Puppet/Documentation.md b/3 resources/Puppet/Documentation.md deleted file mode 100644 index 7afdf72..0000000 --- a/3 resources/Puppet/Documentation.md +++ /dev/null @@ -1 +0,0 @@ -The documentation for the Puppet that we use is found at https://www.puppet.com/docs/puppet/8/puppet_index.html.
\ No newline at end of file diff --git a/3 resources/Puppet/Replace a line in a file.md b/3 resources/Puppet/Replace a line in a file.md deleted file mode 100644 index 2369e84..0000000 --- a/3 resources/Puppet/Replace a line in a file.md +++ /dev/null @@ -1,31 +0,0 @@ -#puppet - - -``` - file_line { - '/etc/sysconfig/libvirt-guests onboot': - path => '/etc/default/libvirt-guests', - line => 'ON_BOOT=ignore', - match => 'ON_BOOT='; - '/etc/libvirt/qemu.conf vnctls': - path => '/etc/libvirt/qemu.conf', - line => 'vnc_tls = 0', - match => '^#?vnc_tls = ', - notify => Service['libvirt']; - '/etc/libvirt/qemu.conf vnctls_verify': - path => '/etc/libvirt/qemu.conf', - line => 'vnc_tls_x509_verify = 0', - match => 'vnc_tls_x509_verify =', - notify => Service['libvirt']; - '/etc/libvirt/qemu.conf tls': - path => '/etc/libvirt/qemu.conf', - match => '^default_tls_x509_cert_dir = "/etc/pki/qemu"$', - line => '#default_tls_x509_cert_dir = "/etc/pki/qemu"', - notify => Service['libvirt']; - '/etc/libvirt/qemu.conf tls_verify': - path => '/etc/libvirt/qemu.conf', - match => '^default_tls_x509_verify = 1$', - line => '#default_tls_x509_verify = 1', - notify => Service['libvirt']; - } -``` diff --git a/3 resources/Puppet/User management.md b/3 resources/Puppet/User management.md deleted file mode 100644 index a452089..0000000 --- a/3 resources/Puppet/User management.md +++ /dev/null @@ -1,10 +0,0 @@ -#puppet - -Users can be managed with the [user resource](https://www.puppet.com/docs/puppet/7/types/user.html) - -[System users](https://www.puppet.com/docs/puppet/7/types/user.html#user-attribute-system) can be defined as follows; -``` -user { - system => true|false -} -``` diff --git a/3 resources/RabbitMQ.md b/3 resources/RabbitMQ.md deleted file mode 100644 index 312bec2..0000000 --- a/3 resources/RabbitMQ.md +++ /dev/null @@ -1 +0,0 @@ -With `rabbitmqctl list_queues` we can add columns to show. So instead of the default layout which shows messages in the Q after the name and is horrible we can specify stuff like: `rabbitmqctl list_queues messages consumers name`. There are more options to be found in `man rabbitmqctl`. diff --git a/3 resources/Ripgrep.md b/3 resources/Ripgrep.md deleted file mode 100644 index b8ce387..0000000 --- a/3 resources/Ripgrep.md +++ /dev/null @@ -1 +0,0 @@ -Pass `-L` to `rg` to make it follow symlinks: this is handy for example when searching hieradata, because node definitions can be symlinked.
\ No newline at end of file diff --git a/3 resources/Statistics/Moving average.md b/3 resources/Statistics/Moving average.md deleted file mode 100644 index c87f0e4..0000000 --- a/3 resources/Statistics/Moving average.md +++ /dev/null @@ -1,20 +0,0 @@ -#statistics - ---- -Also known as; rolling-average, running-average, moving-mean, running-mean, rolling-mean. - -Has three variations: simple, weighted, cumulative. - -A type of [[convolution]]. - -Reduces noisiness in a time-series graph which makes long-term trends or cycles more easily visible. - -Keeps averaging a subset of given set and move the subset one space to the right. -Example with sample-size of 3: -``` -set: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -i=1: avg([0, 1, 2]) = 1 -i=2: avg([1, 2, 3]) = 2 -i=3: avg([2, 3, 4]) = 3 -... -``` diff --git a/3 resources/TailwindCSS/Container.md b/3 resources/TailwindCSS/Container.md deleted file mode 100644 index 4b3e6ca..0000000 --- a/3 resources/TailwindCSS/Container.md +++ /dev/null @@ -1,2 +0,0 @@ -The container class basically adds a margin to the left and right sides. If added mx-auto; it divides the margin equally over both sides. -The margin depends on the current breakpoint. The container max-width is the breakpoints' min-width. diff --git a/3 resources/TailwindCSS/Prevent overflow.md b/3 resources/TailwindCSS/Prevent overflow.md deleted file mode 100644 index 8a4abed..0000000 --- a/3 resources/TailwindCSS/Prevent overflow.md +++ /dev/null @@ -1,3 +0,0 @@ -When creating the wedding invitation I had an issue where the page would allow -scroll horizontally because the flower on the top-right was too big. -Adding the tailwindcss class `overflow-hidden` basically hides all parts that overflow from the container. diff --git a/3 resources/Taskwarrior.md b/3 resources/Taskwarrior.md deleted file mode 100644 index 34fe640..0000000 --- a/3 resources/Taskwarrior.md +++ /dev/null @@ -1,4 +0,0 @@ -`task add something +label` -`task context none` -`task add highprio thing +label priority:H` -`task context define mycontext +label project:blaat` diff --git a/3 resources/Technical definitions.md b/3 resources/Technical definitions.md deleted file mode 100644 index 3801a9c..0000000 --- a/3 resources/Technical definitions.md +++ /dev/null @@ -1,6 +0,0 @@ -#definitions - -**Slug** -A user-friendly representation of the name of a page used in the path of an URL. -For example a page titled: My Friends And I, would be referenced via its slug: my-friends-and-i or my-friends-i. -It can be optimized for brevity so its easier to type and remember. diff --git a/3 resources/ansible/ad-hoc-commands.md b/3 resources/ansible/ad-hoc-commands.md deleted file mode 100644 index eda1265..0000000 --- a/3 resources/ansible/ad-hoc-commands.md +++ /dev/null @@ -1,25 +0,0 @@ -Using ansible we can perform ad-hoc commands, useful for a one-off thing that won't require writing a full playbook. - -Some examples include: -update apt cache: -``` -ansible <pattern> -m ansible.builtin.apt -a "update_cache=true cache_valid_time=3600" -``` - -update packages: -``` -ansible <pattern> -m ansible.builtin.apt -a "name=* state=latest" -``` - -run puppet: -``` -ansible <pattern> -a "/opt/puppetlabs/bin/puppet agent --test" -``` - -reboot: -``` -ansible <pattern> -m ansible.builtin.reboot -f 1 -``` - -[[ansible]] -#ansible
\ No newline at end of file diff --git a/3 resources/ansible/ansible.md b/3 resources/ansible/ansible.md deleted file mode 100644 index 5886288..0000000 --- a/3 resources/ansible/ansible.md +++ /dev/null @@ -1 +0,0 @@ -At its heart it's just an abstraction over running commands remotely over SSH. It enables some powerful automation like setting up a server following a predetermined script.
\ No newline at end of file diff --git a/3 resources/ansible/build-array-loop.md b/3 resources/ansible/build-array-loop.md deleted file mode 100644 index 15f441f..0000000 --- a/3 resources/ansible/build-array-loop.md +++ /dev/null @@ -1,6 +0,0 @@ -How to construct an array variable containing results of an iterative ansible task? -Use register. The referenced variable will contain a property results which is a list containing the combined outputs of the loop. - -https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html#registering-variables-with-a-loop - -[[ansible]]
\ No newline at end of file diff --git a/3 resources/ansible/build-list-silences.md b/3 resources/ansible/build-list-silences.md deleted file mode 100644 index dc8ef61..0000000 --- a/3 resources/ansible/build-list-silences.md +++ /dev/null @@ -1 +0,0 @@ -Explain what I did today at work to build a list of silences and then have one task to unsilence all of them.
\ No newline at end of file diff --git a/3 resources/ansible/debug.md b/3 resources/ansible/debug.md deleted file mode 100644 index 552af1f..0000000 --- a/3 resources/ansible/debug.md +++ /dev/null @@ -1,29 +0,0 @@ -``` -- name: Print the gateway for each host when defined - ansible.builtin.debug: - msg: System {{ inventory_hostname }} has gateway {{ ansible_default_ipv4.gateway }} - when: ansible_default_ipv4.gateway is defined - -- name: Get uptime information - ansible.builtin.shell: /usr/bin/uptime - register: result - -- name: Print return information from the previous task - ansible.builtin.debug: - var: result - verbosity: 2 - -- name: Display all variables/facts known for a host - ansible.builtin.debug: - var: hostvars[inventory_hostname] - verbosity: 4 - -- name: Prints two lines of messages, but only if there is an environment value set - ansible.builtin.debug: - msg: - - "Provisioning based on YOUR_KEY which is: {{ lookup('ansible.builtin.env', 'YOUR_KEY') }}" - - "These servers were built using the password of '{{ password_used }}'. Please retain this for later use." -``` - ---- -https://docs.ansible.com/ansible/latest/collections/ansible/builtin/debug_module.html
\ No newline at end of file diff --git a/3 resources/ansible/default-filter.md b/3 resources/ansible/default-filter.md deleted file mode 100644 index 2255e71..0000000 --- a/3 resources/ansible/default-filter.md +++ /dev/null @@ -1,7 +0,0 @@ -Using the default filter, if we reference an undefined variable we can set a default: `{{ var | default([]) }}`. - -defaults: -- int -- str -- list ([]) -- dict ({})
\ No newline at end of file diff --git a/3 resources/ansible/delegate-to.md b/3 resources/ansible/delegate-to.md deleted file mode 100644 index 270ccb1..0000000 --- a/3 resources/ansible/delegate-to.md +++ /dev/null @@ -1,3 +0,0 @@ -Through the use of delegate to, we can run a task for certain nodes and delegate work on behalf of those nodes to other hosts. - -A great example of usage is this: diff --git a/3 resources/ansible/dicts.md b/3 resources/ansible/dicts.md deleted file mode 100644 index eac3d1b..0000000 --- a/3 resources/ansible/dicts.md +++ /dev/null @@ -1 +0,0 @@ -Merged using combine: `{{ dict1 | ansible.builtin.combine(dict2) }}`
\ No newline at end of file diff --git a/3 resources/ansible/extra-vars.md b/3 resources/ansible/extra-vars.md deleted file mode 100644 index 07b0764..0000000 --- a/3 resources/ansible/extra-vars.md +++ /dev/null @@ -1,8 +0,0 @@ -We can pass variables to the ansible upon invoking it using `--extra-vars` or `-e`. - -``` ---extra-vars "blaat=piet henk=joop" ---extra-vars '{"blaat":"piet","henk":"joop"}' ---extra-vars "@file.json" ---extra-vars "@file.yml" -``` diff --git a/3 resources/ansible/find.md b/3 resources/ansible/find.md deleted file mode 100644 index 1f4de51..0000000 --- a/3 resources/ansible/find.md +++ /dev/null @@ -1,9 +0,0 @@ -``` -- name: Find file with size >= 50G - ansible.builtin.find: - paths: - - /var/lib/nova/instances/_base - size: 50g -``` ---- -https://docs.ansible.com/ansible/latest/collections/ansible/builtin/find_module.html
\ No newline at end of file diff --git a/3 resources/ansible/loop-output.md b/3 resources/ansible/loop-output.md deleted file mode 100644 index 30a0848..0000000 --- a/3 resources/ansible/loop-output.md +++ /dev/null @@ -1 +0,0 @@ -Using the label field we can select what to print, instead of the whole item.
\ No newline at end of file diff --git a/3 resources/ansible/loop-register.md b/3 resources/ansible/loop-register.md deleted file mode 100644 index bab52a5..0000000 --- a/3 resources/ansible/loop-register.md +++ /dev/null @@ -1,41 +0,0 @@ -When using a loop the registered variable will contain the results of all the responses: -```JSON -{ - "changed": true, - "msg": "All items completed", - "results": [ - { - "changed": true, - "cmd": "echo \"one\" ", - "delta": "0:00:00.003110", - "end": "2013-12-19 12:00:05.187153", - "invocation": { - "module_args": "echo \"one\"", - "module_name": "shell" - }, - "item": "one", - "rc": 0, - "start": "2013-12-19 12:00:05.184043", - "stderr": "", - "stdout": "one" - }, - { - "changed": true, - "cmd": "echo \"two\" ", - "delta": "0:00:00.002920", - "end": "2013-12-19 12:00:05.245502", - "invocation": { - "module_args": "echo \"two\"", - "module_name": "shell" - }, - "item": "two", - "rc": 0, - "start": "2013-12-19 12:00:05.242582", - "stderr": "", - "stdout": "two" - } - ] -} -``` - -Thus we can loop over each results `{{ registered_var.results }}`.
\ No newline at end of file diff --git a/3 resources/ansible/loop-results-prior-loop.md b/3 resources/ansible/loop-results-prior-loop.md deleted file mode 100644 index cbd50a2..0000000 --- a/3 resources/ansible/loop-results-prior-loop.md +++ /dev/null @@ -1,30 +0,0 @@ -```YAML -- name: First loop - loop: {{ blaat }} - register: loooped - ... - -- name: Second loop - loop: {{ loooped.results }} - when: item.skipped is not defined -``` - -this loops over results of prior loop only but does not process any skipped results. - -In case the results array contains another array that we want to loop over, for example when we did a shell command in a loop we can use extract: -``` -- name: Print magic - ansible.builtin.debug: - msg: "{{ ['stdout_lines'] | map('extract', item) }}" - loop: "{{ magic.results }}" -``` - -A cool example of this in practice: -``` -- name: Print blockpull command - ansible.builtin.debug: - msg: "virsh blockpull {{ ['stdout_lines'] | map('extract', item) | list | flatten | join(' ') }}" - loop: "{{ domain_and_disk_paths.results }}" - loop_control: - label: "{{ inventory_hostname }}" -```
\ No newline at end of file diff --git a/3 resources/ansible/nested-loops.md b/3 resources/ansible/nested-loops.md deleted file mode 100644 index fded56a..0000000 --- a/3 resources/ansible/nested-loops.md +++ /dev/null @@ -1,3 +0,0 @@ -Nested loops can be done not by nesting loops over two separate lists, but by looping over the [[Cartesian product]] of the two using the `product` filter. - -`{{ list1 | product(list) | list }}`
\ No newline at end of file diff --git a/3 resources/ansible/set-facts.md b/3 resources/ansible/set-facts.md deleted file mode 100644 index e94eeb6..0000000 --- a/3 resources/ansible/set-facts.md +++ /dev/null @@ -1 +0,0 @@ -These can be used to set and update variables specific to nodes, at runtime.
\ No newline at end of file diff --git a/3 resources/libvirt/Mediated devices.md b/3 resources/libvirt/Mediated devices.md deleted file mode 100644 index fe9e551..0000000 --- a/3 resources/libvirt/Mediated devices.md +++ /dev/null @@ -1,11 +0,0 @@ -#libvirt #linux #virtualisation - ---- -https://libvirt.org/drvnodedev.html#mediated-devices-mdevs - -They are virtual devices that share a single physical device. - -Similar to [[SR-IOV]] but sr-iov required registering and unregistering devices with the host PCIe bus via a host driver. -Mediated devices don't have to do this. - -So why would we still choose sriov?
\ No newline at end of file diff --git a/3 resources/libvirt/SR-IOV.md b/3 resources/libvirt/SR-IOV.md deleted file mode 100644 index 0881ec0..0000000 --- a/3 resources/libvirt/SR-IOV.md +++ /dev/null @@ -1,9 +0,0 @@ -#linux #libvirt #virtualisation - ---- -Single root input/output virtualization: enables sharing of single PCI-e devices with multiple guests. - -Physical device = PF (Physical Function) -Virtual device = VF (Virtual Function) - -A PF is divided (by manufacturer) into *n* VFs. Thus a PF can be shared at most with *n* guests.
\ No newline at end of file diff --git a/3 resources/linux/APT.md b/3 resources/linux/APT.md deleted file mode 100644 index 9231d40..0000000 --- a/3 resources/linux/APT.md +++ /dev/null @@ -1,5 +0,0 @@ -#linux #packages #how-to - ---- -reinstall packages: -`apt reinstall <pkg>`
\ No newline at end of file diff --git a/3 resources/linux/Definitions.md b/3 resources/linux/Definitions.md deleted file mode 100644 index c0ca4dd..0000000 --- a/3 resources/linux/Definitions.md +++ /dev/null @@ -1,6 +0,0 @@ -#linux #definitions - ---- -NBP = Network Bootstrap Program -PXE = Preboot Execution Environment -NIC = Network Interface Card
\ No newline at end of file diff --git a/3 resources/linux/Device drivers.md b/3 resources/linux/Device drivers.md deleted file mode 100644 index 95f1a75..0000000 --- a/3 resources/linux/Device drivers.md +++ /dev/null @@ -1,22 +0,0 @@ -#linux #devices - ---- -major, minor numbers -major = driver (used by kernel when opening device to dispatch to correct driver) -minor = used by driver to differentiate device(s) - -after disk the major, minor numbers are shown: -``` -[jasras@n04.compute.vps2-lej1 ~]$ ls -l /dev/dm-* -brw-rw---- 1 root disk 253, 0 Oct 25 10:10 /dev/dm-0 -brw-rw---- 1 root disk 253, 1 Oct 25 10:11 /dev/dm-1 -brw-rw---- 1 root root 253, 11 Oct 28 19:58 /dev/dm-11 -brw-rw---- 1 root root 253, 12 Oct 28 19:58 /dev/dm-12 -``` - -available devices: `cat /proc/devices` - -character devices vs block devices; what is the difference? - ---- -[oreilly-device-drivers](https://www.oreilly.com/library/view/linux-device-drivers/0596000081/ch03s02.html)
\ No newline at end of file diff --git a/3 resources/linux/Device mapper.md b/3 resources/linux/Device mapper.md deleted file mode 100644 index 059a0d1..0000000 --- a/3 resources/linux/Device mapper.md +++ /dev/null @@ -1,28 +0,0 @@ -#linux #device-mapper - ---- -Device mapper is a kernel driver to map physical block devices to virtual ones; this means that for example we can have many physical devices be represented by a single virtual one (linear mapping). - -How does it work? -[[1 projects/Inwerken Mohammed/TODO]] -What is its function in relation to multipath? - -Logical devices using device-mapper can be managed using `man 8 dmsetup` -``` -[jasras@n04.compute.vps2-lej1 ~]$ sudo dmsetup info 3600a098038314d736724566a67346538 -Name: 3600a098038314d736724566a67346538 -State: ACTIVE -Read Ahead: 256 -Tables present: LIVE -Open count: 1 -Event number: 3 -Major, minor: 253, 12 -Number of targets: 1 -UUID: mpath-3600a098038314d736724566a67346538 -``` - -If dmsetup cannot remove a device because a process still has it open, but lsof does not show any processes that open it, use `-f` which replaces the device with a fake that rejects all I/O. - ---- -[device-mapper](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/device_mapper#device_mapper) -[dmsetup](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/dmsetup#dmsetup)
\ No newline at end of file diff --git a/3 resources/linux/LSOF.md b/3 resources/linux/LSOF.md deleted file mode 100644 index 5a3aa95..0000000 --- a/3 resources/linux/LSOF.md +++ /dev/null @@ -1,69 +0,0 @@ -#linux #how-to - ---- - -``` -lsof -p 1111 # show open files for this PID -lsof /path/to/file # show which process has this open -``` - -A usage in the wild; using lsof to find the qemu process for a specific base image and using that to get instance name and disk path: -``` -lsof -F p {{ item['path'] }} | cut -b 2- | head -1 | xargs ps | grep -oP '(instance\\-[a-z0-9]+)|(\\/var\\/lib\\/nova\\/instances\\/[a-z0-9\\-]+\\/disk)' | uniq -``` - -(man lsof: search "OUTPUT FOR OTHER PROGRAMS") -output for other programs -``` -specify -F -These are the fields that lsof will produce. The single character listed first is the field identifier. - a file access mode - c process command name (all characters from proc or - user structure) - C file structure share count - d file's device character code - D file's major/minor device number (0x<hexadecimal>) - f file descriptor (always selected) - F file structure address (0x<hexadecimal>) - G file flaGs (0x<hexadecimal>; names if +fg follows) - g process group ID - i file's inode number - K tasK ID - k link count - l file's lock status - L process login name - m marker between repeated output - M the task comMand name - n file name, comment, Internet address - N node identifier (ox<hexadecimal> - o file's offset (decimal) - p process ID (always selected) - P protocol name - r raw device number (0x<hexadecimal>) - R parent process ID - s file's size (decimal) - S file's stream identification - t file's type - T TCP/TPI information, identified by prefixes (the - `=' is part of the prefix): - QR=<read queue size> - QS=<send queue size> - SO=<socket options and values> (not all dialects) - SS=<socket states> (not all dialects) - ST=<connection state> - TF=<TCP flags and values> (not all dialects) - WR=<window read size> (not all dialects) - WW=<window write size> (not all dialects) - (TCP/TPI information isn't reported for all supported - UNIX dialects. The -h or -? help output for the - -T option will show what TCP/TPI reporting can be - requested.) - u process user ID - z Solaris 10 and higher zone name - Z SELinux security context (inhibited when SELinux is disabled) - 0 use NUL field terminator character in place of NL - 1-9 dialect-specific field identifiers (The output - of -F? identifies the information to be found - in dialect-specific fields.) - -```
\ No newline at end of file diff --git a/3 resources/linux/Users.md b/3 resources/linux/Users.md deleted file mode 100644 index 885a7cc..0000000 --- a/3 resources/linux/Users.md +++ /dev/null @@ -1,22 +0,0 @@ -#linux #user-management - -Change uid/gid of user -`usermod -u newnumber user` -`groupmod -g newnumber user` - -File permissions in homedir will be automatically updated; file perms outside home dir will not be automatically updated. - -Finding files of a specific user, and printing their uid/gid; -`sudo find / -user 4109 -printf '%p %u(%U) %g(%G)\n'` - -To change only the group: `chgrp`. - -Or using find to chmod/chgrp: -`sudo find / -user 4109 -group 4109 -exec chmod 998:998 {} \;` -`sudo find / -group 4109 -exec chgrp 998 {} \;` - -Dirty way to find "system users" (uid < 999) - note that this is not fool-proof, it also lists groups -`getent passwd | grep -oP '\b[0-9]{3}\b' | uniq | sort` - ---- -https://www.cyberciti.biz/faq/linux-change-user-group-uid-gid-for-all-owned-files/ diff --git a/3 resources/linux/Watch.md b/3 resources/linux/Watch.md deleted file mode 100644 index 0c167b7..0000000 --- a/3 resources/linux/Watch.md +++ /dev/null @@ -1,4 +0,0 @@ -#linux #how-to - ---- -`watch (1)` periodically executes the executable on argv. It can be used to reload the output of a command, like `sudo watch ovs-dpctl dump-flows` . diff --git a/3 resources/linux/filesystems/Tmpfs.md b/3 resources/linux/filesystems/Tmpfs.md deleted file mode 100644 index b8fe839..0000000 --- a/3 resources/linux/filesystems/Tmpfs.md +++ /dev/null @@ -1,16 +0,0 @@ -#linux #filesystem - ---- -Is a [[virtual filesystem]] that is stored in memory; it uses both RAM and swap space. -> Kernel option: CONFIG_TMPFS - -`mount -t tmpfs source target` - -A tmpfs can only grow to 50% of RAM avail. unless overridden with size=nbytes mount option. -Only consumes RAM for actual usage. -Data is ephemeral/volatile. - -Mount stacking: mount over existing /tmp, to improve speed of apps using alot of tmp files, then unmount to delete data. - -Kernel uses tmpfs for [[system v shared memory]] and [[shared anonymous memory mappings]]. -`/dev/shm` or `/run/shm`: [[glibc]] of [[POSIX]] shared memory and [[POSIX]] semaphores.
\ No newline at end of file diff --git a/3 resources/linux/networking/DHCP.md b/3 resources/linux/networking/DHCP.md deleted file mode 100644 index e7e8e38..0000000 --- a/3 resources/linux/networking/DHCP.md +++ /dev/null @@ -1,5 +0,0 @@ -#networking #linux - ---- -Dynamic Host Configuration Protocol -Allows hosts dynamically receive an IP address.
\ No newline at end of file diff --git a/3 resources/linux/networking/IP masquerade.md b/3 resources/linux/networking/IP masquerade.md deleted file mode 100644 index 2ccc8e6..0000000 --- a/3 resources/linux/networking/IP masquerade.md +++ /dev/null @@ -1,17 +0,0 @@ -#linux #networking - ---- -A function in the kernel that allows guests with internal/private IPs to access the internet by using the hosts' public IP similar to 1 to many NAT. - -Differences with Proxy, IP Masq, NAT: - -**Proxy** -Requires special configuration on internal client side. Can be used for caching. - -**IP Masq** -A form of NAT used primarily in Linux devices. Translates IP address and uses the connection tracking table and ports to map responses back to the internal connection. - -**NAT** -Has different types with different use-cases. -Static NAT: 1-1 mapping of pub/private IP. Dynamic NAT: pool of pub ips to dynamically map private IPs to based on availability. -PAT (Port): similar to IP Masq; 1-many using ports.
\ No newline at end of file diff --git a/3 resources/linux/networking/PXE.md b/3 resources/linux/networking/PXE.md deleted file mode 100644 index d5fe4d1..0000000 --- a/3 resources/linux/networking/PXE.md +++ /dev/null @@ -1,18 +0,0 @@ -#linux #pxe - ---- -The NBP is a bootloader that is obtained via the network typically via [[TFTP]]. It handles setting up an environment in which an OS can run or install. For example, it displays a boot menu and downloads the kernel images. It sets up hardware, for example the [[NIC]]s. - -PXE boot process: -1. Modified [[DHCP]] request: request to include boot information (PXE boot request). -2. Process DHCP response which includes an IP address of [[TFTP]] server and filename of [[NBP]]. -3. Download NBP over TFTP. -4. NBP executes - 1. Loads additional stuff over network, like kernel images. - 2. Handles the boot menu -5. Kernel takes over boot process and potentially downloads additional files required to complete booting. - -Popular NBP's: -- PXELINUX -- iPXE -- GRUB2 diff --git a/3 resources/math/Cartesian product.md b/3 resources/math/Cartesian product.md deleted file mode 100644 index 161b405..0000000 --- a/3 resources/math/Cartesian product.md +++ /dev/null @@ -1,4 +0,0 @@ -#math #definitions - ---- -The Cartesian product in [[set theory]] denoted as A x B where A and B are both sets and it would result in pairs of (a, b) for each a and b in A and B respectively.
\ No newline at end of file diff --git a/3 resources/nix/Flake.md b/3 resources/nix/Flake.md deleted file mode 100644 index 754556f..0000000 --- a/3 resources/nix/Flake.md +++ /dev/null @@ -1,22 +0,0 @@ -#nix #flake - ---- -Nix flakes are source trees containing a file `flake.nix` at their root. The file `flake.nix` provides a standardized way to provide [[Zettelkast/Index/Nix]] artifacts. It's like a package manager for [[Zettelkast/Index/Nix]]. A flake can be dependent on other Flakes and it's possible to pin dependencies to exact revisions by using a `flake.lock` file. - -Nix flake evaluation is hermetic, meaning that it produces the same result wherever it's built.k - -The feature can be enabled in `~/.config/nix/nix.conf`: - -``` -experimental-features = nix-command flakes -``` - -To initialize in a repo: `nix flake init`. - -In flakes dependencies have to be specified explicitly and MUST be locked to specific versions therefore it's no longer allowed to use the nixpkgs found in `NIX_PATH` by referencing it like `<nixpkgs>`. - -Output of a Flake is an arbitrary [[Zettelkast/Index/Nix]] value such as a package, [[NixOS]] module or library function. -Commands `nix build` and `nix shell` will build the output `packages.<system>.default` unless we specify another output, for example: `nix shell .#checks.aarch64-linux.build`. - ---- -[Flakes Wiki](https://nixos.wiki/wiki/Flakes)
\ No newline at end of file diff --git a/3 resources/nix/Overlays.md b/3 resources/nix/Overlays.md deleted file mode 100644 index 8ee33f3..0000000 --- a/3 resources/nix/Overlays.md +++ /dev/null @@ -1,11 +0,0 @@ -#nix #overlay - ---- -Functions that accept two args (conventionally: final, prev) and return a set of [[Package]]s. - -The `prev` arguments holds the set of packages of the "parent" overlay while the `final` argument holds the end result of **all** overlays applied. This means that overlays depend on each other. It is unclear how we can tell on which overlay an overlay depends. - -We can use it to override existing packages or add new packages. - ---- -https://nixos.wiki/wiki/Overlays diff --git a/3 resources/nix/Package.md b/3 resources/nix/Package.md deleted file mode 100644 index 32c6bd4..0000000 --- a/3 resources/nix/Package.md +++ /dev/null @@ -1,6 +0,0 @@ -#nix #packages - ---- -Packages != NixOS Modules - -Packages come from Nixpkgs.
\ No newline at end of file diff --git a/3 resources/nix/REPL.md b/3 resources/nix/REPL.md deleted file mode 100644 index 210b980..0000000 --- a/3 resources/nix/REPL.md +++ /dev/null @@ -1,5 +0,0 @@ -#nix #repl - ---- -`nix repl` to interactively evaluate Nix expressions. `:p` if output is not full. - `nix-instantiate --eval <file>.nix` to evaluate a Nix expression from a file. `--strict`.
\ No newline at end of file diff --git a/3 resources/nix/Shell.nix.md b/3 resources/nix/Shell.nix.md deleted file mode 100644 index 13715c2..0000000 --- a/3 resources/nix/Shell.nix.md +++ /dev/null @@ -1,42 +0,0 @@ -#nix #shell - ---- -Can be used to set up per dir environments, e.g using direnv to automatically activate them. -## Python -https://nixos.org/manual/nixpkgs/stable/#python - -```nix -{ pkgs ? import <nixpkgs> {}}: - -pkgs.mkShell { - packages = [ pkgs.virtualenv ]; -} -``` - -```nix -with import <nixpkgs> {}; -let - my_toolz = python311.pkgs.buildPythonPackage rec { - pname = "toolz"; - version = "0.10.0"; - pyproject = true; - src = fetchPypi { - inherit pname version; - hash = "sha256-CP3V73yWSArRHBLUct4hrNMjWZlvaaUlkpm1QP66RWA="; - }; - nativeBuildInputs = [ - python311.pkgs.setuptools - python311.pkgs.wheel - ]; # has no tests - doCheck = false; - meta = { - homepage = "https://github.com/pytoolz/toolz/"; - description = "List processing tools and functional utilities"; - # [...] - }; - }; -in python311.withPackages (ps: with ps; [ numpy my_toolz ]) ).env -``` - -The [[Import]] is required here because imports a nix expression from another source, in this case nixpkgs. -It is not required at line two, because python310Packages itself is already in the local scope.
\ No newline at end of file diff --git a/3 resources/nix/language/Import.md b/3 resources/nix/language/Import.md deleted file mode 100644 index d201c74..0000000 --- a/3 resources/nix/language/Import.md +++ /dev/null @@ -1,5 +0,0 @@ -#nix #keyword - ---- -The import keyword brings a Nix expression from another source into scope such that we can reference it. For example, we can `import <nixpkgs>` and it would bring the entire attribute set that is Nixpkgs into scope and allows us to reference any of its attributes. - diff --git a/3 resources/nix/language/Let.md b/3 resources/nix/language/Let.md deleted file mode 100644 index bfb4b31..0000000 --- a/3 resources/nix/language/Let.md +++ /dev/null @@ -1,12 +0,0 @@ -#nix #keyword - ---- -Keyword: `let` -Used to assign variables that can be used in an expression immediately following the let-binding. -```nix -let - one = 1; -in { - two = one + 1; -} -``` diff --git a/3 resources/nix/language/Rec.md b/3 resources/nix/language/Rec.md deleted file mode 100644 index b7050d3..0000000 --- a/3 resources/nix/language/Rec.md +++ /dev/null @@ -1,20 +0,0 @@ -#nix #keyword - ---- -Recursive attribute sets can reference values declared earlier in the same set. -keyword: `rec` -```nix -rec { - one = 1; - two = one + 1; -} -``` - -Ordering does not matter: -```nix -nix-repl> rec { two = one + 1; one = 1; } -{ - one = 1; - two = 2; -} -``` diff --git a/3 resources/nix/language/With.md b/3 resources/nix/language/With.md deleted file mode 100644 index b291907..0000000 --- a/3 resources/nix/language/With.md +++ /dev/null @@ -1,15 +0,0 @@ -#nix #keyword - ---- -The `with` keyword brings all attributes from a given set, e.g nixpkgs, into the local scope. Making them accessible as if they were declared in the same file. - -An example, bringing everything from nixpkgs into scope: -``` -with import <nixpkgs>; -with python310Packages; <-- declared in nixpkgs - -buildPythonPackage <-- declared in python310Packages -``` - -The import statement is required here because imports a nix expression from another source, in this case nixpkgs. -It is not required at line two, because python310Packages itself is already in the local scope.
\ No newline at end of file diff --git a/3 resources/nix/packages/Apply custom patches.md b/3 resources/nix/packages/Apply custom patches.md deleted file mode 100644 index 370c53a..0000000 --- a/3 resources/nix/packages/Apply custom patches.md +++ /dev/null @@ -1,17 +0,0 @@ -#nix #packages #overlay - ---- -We can apply patches to existing packages using [[Overlays]]: -```nix -final: prev { - nova = prev.nova.overrideAttrs (old: { - patches = (old.patches or []) ++ [ - prev.fetchpatch { - url = "https://github.com/owner/repo/commit/hash.patch"; - hash = "somehash"; - }) - ./relative.patch - ] - }) -} -``` diff --git a/3 resources/openstack/Creating ports.md b/3 resources/openstack/Creating ports.md deleted file mode 100644 index 90223bf..0000000 --- a/3 resources/openstack/Creating ports.md +++ /dev/null @@ -1,4 +0,0 @@ -#openstack #port - ---- -Creating a port with a fixed IP requires admin privileges. It is not sufficient to have an RBAC policy that shares the network with a tenant.
\ No newline at end of file diff --git a/3 resources/openstack/Libvirt pmsuspended.md b/3 resources/openstack/Libvirt pmsuspended.md deleted file mode 100644 index 4749c76..0000000 --- a/3 resources/openstack/Libvirt pmsuspended.md +++ /dev/null @@ -1,6 +0,0 @@ -#openstack #libvirt - ---- -Encountered a guest running some desktop image that sleeps and puts libvirt domain in state pmsuspend. - -Openstack does not sync power states in this case so the nova instance is still ACTIVE.
\ No newline at end of file diff --git a/3 resources/openstack/Nova live migration volume.md b/3 resources/openstack/Nova live migration volume.md deleted file mode 100644 index 8b37f67..0000000 --- a/3 resources/openstack/Nova live migration volume.md +++ /dev/null @@ -1,18 +0,0 @@ -#openstack #nova #live-migration #volume - - ---- -Table cinder.volume_attachment, contains which volume_driver. target_lun `(<n>)` here maps to `dm-<n>`. -Luns are not unique across pod, each node has a target_lun 2 and thus dm-2 connected. - -os-brick is responsible for connecting volumes; -if connection_info it receives contains target_iqns, target_luns etc it will not do a scan and just returns those. -`@see os_brick/initiator/connectors/iscsi.py` - -`nova/virt/libvirt/driver.py -> def _connect_volume` does attaching of volumes using os-brick. Driver exposes some methods that do this and are called elsewhere: `swap_volume`, `attach_volume`, `pre_live_migration`. - -`pre_live_migration` is called by `nova/compute/manager.py` - -So in `nova/compute/manager.py` there is a function that does the rollback, and it rollbacks bdm's and deletes volume attachments before it calls `rollback_live_migration_at_destination` which in turn makes an attempt at deleting the actual volume attachment to the node. But at that point all objects have been rollbacked already so it has invalid information. - -If the code in new versions of openstack isn't any different i'll just make a bug report and see what they come up with. |