From d4bd3ad4a869c87fcfa4f83b42555a6c8e1bc746 Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Sat, 17 May 2025 09:03:45 +0200 Subject: vault backup: 2025-05-17 09:03:45 --- .obsidian/graph.json | 2 +- .trash/Baseline.md | 4 ++++ .trash/Custom OVN debian packaging.md | 7 ++++++ Attributes.md | 7 ++++++ Bidirectional Forwarding Detection (BFD).md | 27 ++++++++++++++++++++++ Buffer Protocol.md | 9 ++++++++ Connexion.md | 17 ++++++++++++++ Conway's Law.md | 7 ++++++ Cool Python packages.md | 13 +++++++++++ Custom OVN debian packaging.md | 7 ------ Don't mock what you don't own.md | 15 ++++++++++++ HTML.md | 1 + HTTP Authentication Schemes.md | 12 ++++++++++ Holy Grail Layout.md | 12 ++-------- ...rly do options in a bash script with getopt!.md | 4 +++- Mocks aren't stubs.md | 27 ++++++++++++++++++++++ Online trouwkaarten.md | 2 ++ OpenStack Tempest.md | 3 ++- Python Match statements.md | 21 +++++++++++++++++ Raid Controller (BBU).md | 5 ++++ Semantic HTML.md | 16 ++++++++++--- TDD.md | 5 +++- Test fixture.md | 6 +++++ Trigger a service refresh with Puppet.md | 19 +++++++++++++++ Verified fake.md | 8 +++++++ ...real implementation gives feedback on design.md | 8 +++---- YAGNI.md | 4 +++- daily/07-May-2025.md | 25 ++++++++++++++++++++ daily/09-May-2025.md | 11 +++++++++ daily/12-May-2025.md | 8 +++++++ daily/15-May-2025.md | 0 31 files changed, 283 insertions(+), 29 deletions(-) create mode 100644 .trash/Baseline.md create mode 100644 .trash/Custom OVN debian packaging.md create mode 100644 Attributes.md create mode 100644 Bidirectional Forwarding Detection (BFD).md create mode 100644 Buffer Protocol.md create mode 100644 Connexion.md create mode 100644 Conway's Law.md create mode 100644 Cool Python packages.md delete mode 100644 Custom OVN debian packaging.md create mode 100644 Don't mock what you don't own.md create mode 100644 HTTP Authentication Schemes.md create mode 100644 Mocks aren't stubs.md create mode 100644 Online trouwkaarten.md create mode 100644 Python Match statements.md create mode 100644 Raid Controller (BBU).md create mode 100644 Test fixture.md create mode 100644 Trigger a service refresh with Puppet.md create mode 100644 Verified fake.md create mode 100644 daily/07-May-2025.md create mode 100644 daily/09-May-2025.md create mode 100644 daily/12-May-2025.md create mode 100644 daily/15-May-2025.md diff --git a/.obsidian/graph.json b/.obsidian/graph.json index fb90080..1cdef47 100644 --- a/.obsidian/graph.json +++ b/.obsidian/graph.json @@ -17,6 +17,6 @@ "repelStrength": 10, "linkStrength": 1, "linkDistance": 500, - "scale": 0.13348388671875, + "scale": 0.0889892578125, "close": true } \ No newline at end of file diff --git a/.trash/Baseline.md b/.trash/Baseline.md new file mode 100644 index 0000000..25d0490 --- /dev/null +++ b/.trash/Baseline.md @@ -0,0 +1,4 @@ +--- +tags: + - web +--- diff --git a/.trash/Custom OVN debian packaging.md b/.trash/Custom OVN debian packaging.md new file mode 100644 index 0000000..a895469 --- /dev/null +++ b/.trash/Custom OVN debian packaging.md @@ -0,0 +1,7 @@ +--- +tags: + - groupvps +--- +There was an issue with unit files and the files in /etc/default being prefixed with group.one-ovn. We want to make sure that the contents of our debian package are identical to regular OVN packages. + +Fixed by using overrides in debian/rules to rename those files after they're installed. \ No newline at end of file diff --git a/Attributes.md b/Attributes.md new file mode 100644 index 0000000..00feb2f --- /dev/null +++ b/Attributes.md @@ -0,0 +1,7 @@ +--- +tags: + - html + - web +--- +`key=value` on elements. +Define behaviour, linkage \ No newline at end of file diff --git a/Bidirectional Forwarding Detection (BFD).md b/Bidirectional Forwarding Detection (BFD).md new file mode 100644 index 0000000..de1ffe7 --- /dev/null +++ b/Bidirectional Forwarding Detection (BFD).md @@ -0,0 +1,27 @@ +--- +tags: + - network +rfc: https://datatracker.ietf.org/doc/html/rfc5880 +--- +Used to detect faults in any component that is connecting two endpoint; e.g the forwarding engine, link or port. + +It is low-overhead and fast. + +A session is established between two nodes through a three-way handshake. + +It is transport agnostic, thus it can be used over raw ethernet or tunnels, etc. + +Two modes: asynchronous and on-demand. + +**Async**: each peer periodically sends packet; if x time no packets received link is declared down. +**On-demand**: an out-of-band system is expected to do this detection, but BFD can choose to verify whenever it feels like it and sends some array of packets and expecting some in return. + +It is important to note that in async mode each peer sends packets in one direction and doesn't expect a reply to those. In on-demand mode one peer sends packets and **does** expect packets in return. + +> A function exists called "Echo function" that does make it so packets are looped back to the sender. If any of those don't return the link is declared down. + +- Pure Async without echo: less packets than with echo. +- With echo: possibly faster detection, less jitter, more packets +- On-demand: if there are alot of links, thus alot of BFD sessions and the overhead is too big + +> On-demand cannot work if the round-trip time is larger than the desired detection time \ No newline at end of file diff --git a/Buffer Protocol.md b/Buffer Protocol.md new file mode 100644 index 0000000..4284c12 --- /dev/null +++ b/Buffer Protocol.md @@ -0,0 +1,9 @@ +--- +tags: + - python +--- +The buffer protocol provides access to underlying memory buffer. + +The producer is the type that wraps a buffer and implements the "buffer interface" through which they export data about the underlying buffer. + +The consumer is who gains access to the underlying buffer. \ No newline at end of file diff --git a/Connexion.md b/Connexion.md new file mode 100644 index 0000000..0d186ca --- /dev/null +++ b/Connexion.md @@ -0,0 +1,17 @@ +--- +tags: + - python +--- +# Requests +Parameter name for body data is unsurprisingly: body. Can be overriden in the spec using x-body-name. + +# Response +Endpoints return a tuple: data, status_code, headers. + +Data can be a dict or array if application/json. +Status_code is an int. +Headers is just a dict. +# Security +All standard auth mechanisms are supported. + +Works by registering a validation function (on the spec or via env var) that requests are routed through that does validation on the credentials. \ No newline at end of file diff --git a/Conway's Law.md b/Conway's Law.md new file mode 100644 index 0000000..fda8792 --- /dev/null +++ b/Conway's Law.md @@ -0,0 +1,7 @@ +--- +tags: + - devops +--- +> Organisations that design systems are constrained to produce designs that are copies of the communication structures of these organisations. + +This means that the way a business organises teams is directly related to the design of systems they build. In other words, we should organise teams so that building our systems can be done in parallel. By dividing a larger system into seperate subsystems and making a team responsible for that subsystem for example. \ No newline at end of file diff --git a/Cool Python packages.md b/Cool Python packages.md new file mode 100644 index 0000000..f23a84c --- /dev/null +++ b/Cool Python packages.md @@ -0,0 +1,13 @@ +--- +tags: + - python +--- +This document is intended to keep a list of useful packages for Python. + +- httpx (http) +- requests (http) +- tenacity (retry) +- celery (worker) + +unverified: +- pretend (stubbing) \ No newline at end of file diff --git a/Custom OVN debian packaging.md b/Custom OVN debian packaging.md deleted file mode 100644 index a895469..0000000 --- a/Custom OVN debian packaging.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -tags: - - groupvps ---- -There was an issue with unit files and the files in /etc/default being prefixed with group.one-ovn. We want to make sure that the contents of our debian package are identical to regular OVN packages. - -Fixed by using overrides in debian/rules to rename those files after they're installed. \ No newline at end of file diff --git a/Don't mock what you don't own.md b/Don't mock what you don't own.md new file mode 100644 index 0000000..d1db60f --- /dev/null +++ b/Don't mock what you don't own.md @@ -0,0 +1,15 @@ +--- +tags: + - dev + - testing +--- +[[Mocks aren't stubs]] +[[Verified fake]] + +Oftentimes wrapping a third-party object in a lightweight facade will improve the code but also increases test-ability dramatically. + +If the third-party library already exposes an idiomatic interface, it is probably not worth wrapping it into a similar one just so it belongs to you. (Cough openstacksdk). + + +--- +https://hynek.me/articles/what-to-mock-in-5-mins/ \ No newline at end of file diff --git a/HTML.md b/HTML.md index 85deafd..604dd35 100644 --- a/HTML.md +++ b/HTML.md @@ -18,6 +18,7 @@ Javascript object created for every element and section of text. **HTML DOM API* [[Document structure]] [[Semantic HTML]] +[[Attributes]] --- https://web.dev/learn/html/welcome \ No newline at end of file diff --git a/HTTP Authentication Schemes.md b/HTTP Authentication Schemes.md new file mode 100644 index 0000000..04566ef --- /dev/null +++ b/HTTP Authentication Schemes.md @@ -0,0 +1,12 @@ +--- +tags: + - http + - web +--- +https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml +--- + +Common ones are: +- Basic +- Bearer (JWT token) +- OAuth \ No newline at end of file diff --git a/Holy Grail Layout.md b/Holy Grail Layout.md index 480556a..a059b27 100644 --- a/Holy Grail Layout.md +++ b/Holy Grail Layout.md @@ -9,16 +9,8 @@ tags:
Header
-
-
First post
-
Second post
-
+
-``` - -Main: 1 per page; main contnet -Aside: tangentially related content; complementary -Article: represents a completely standalone piece of content, reusable. -Section: Used if no more specific element exists; should have a heading most of the time. \ No newline at end of file +``` \ No newline at end of file diff --git a/How to properly do options in a bash script with getopt!.md b/How to properly do options in a bash script with getopt!.md index 7d417c5..5efe6d2 100644 --- a/How to properly do options in a bash script with getopt!.md +++ b/How to properly do options in a bash script with getopt!.md @@ -28,4 +28,6 @@ shift $((OPTIND - 1)) echo "Remaining arguments: $@" ``` -man bash // getopt \ No newline at end of file +man bash // getopt + +The **colon** after b in getopts indicates that it has an argument. \ No newline at end of file diff --git a/Mocks aren't stubs.md b/Mocks aren't stubs.md new file mode 100644 index 0000000..73d0a30 --- /dev/null +++ b/Mocks aren't stubs.md @@ -0,0 +1,27 @@ +--- +tags: + - testing + - dev +--- +A "test double" is any kind of object that pretends to be a real object. + +- Dummy: just satisfies the interface without actually doing anything. Just there to wire things up. +- Fake: Implement the interface but in a simple way; e.g in memory db. +- Stubs: similar to a fake but returns answers specifically for the test. +- Spies: a stub that keeps a record of how they were called. +- Mocks: objects pre-programmed with expectations of how they are to be used which is verified at the end of the test. + +A "Mock Object" mimics real objects for testing. They encourage testing based on behavior verification, because we can tell what functions we expect to be called on it and what they will return. +This is what I did a lot in PHP with phpunit & prophecy. + +Mock object verifies behavior, did we make the expected calls etc. While if a much simpler stub is used we only verify its state. + +--- + +Dichotomy between classical and mockist TDD styles. + +- Classical: prefers real object, and grabs double when necessary. +- Mockist: uses mocks always. + +Classical a.k.a detroit style +Mockist a.k.a london style diff --git a/Online trouwkaarten.md b/Online trouwkaarten.md new file mode 100644 index 0000000..99b88eb --- /dev/null +++ b/Online trouwkaarten.md @@ -0,0 +1,2 @@ +basic invitation: with standard rsvp, 5 photo's +premium invitation: advanced rsvp (dietary wishes, specify food being served), 20 photo's \ No newline at end of file diff --git a/OpenStack Tempest.md b/OpenStack Tempest.md index d7d84c4..5ae0308 100644 --- a/OpenStack Tempest.md +++ b/OpenStack Tempest.md @@ -3,5 +3,6 @@ tags: - tempest - openstack --- -Test an OpenStack cloud as if it is an end-user. +Test an OpenStack cloud using only its public APIs. + **Scenario Test** is more complicated than a single APi endpoint, like, booting from an existing volume. \ No newline at end of file diff --git a/Python Match statements.md b/Python Match statements.md new file mode 100644 index 0000000..8a4ead6 --- /dev/null +++ b/Python Match statements.md @@ -0,0 +1,21 @@ +--- +tags: + - python +--- +```python +match var: + case 1: + blaat + case 2: + other + case 3 | 4: + combined + case x: + print(x) # Unpacking + case Number(x): + print(x) + case Number(x) if x == 5: + print(x) # only if x is 5 + case _: + wildcard +``` \ No newline at end of file diff --git a/Raid Controller (BBU).md b/Raid Controller (BBU).md new file mode 100644 index 0000000..34011c5 --- /dev/null +++ b/Raid Controller (BBU).md @@ -0,0 +1,5 @@ +--- +tags: + - server +--- +This is a battery that ensures data in the write-cache persists in case of power loss, so that it may be written to disk as the server is powered back on. \ No newline at end of file diff --git a/Semantic HTML.md b/Semantic HTML.md index cc4a892..04b9059 100644 --- a/Semantic HTML.md +++ b/Semantic HTML.md @@ -9,11 +9,21 @@ The browser builds an **AOM** (Accessibility Object Model); it uses semantic ele ### Roles Defined by [ARIA](https://w3c.github.io/aria/#dfn-role). All elements can have a `role` attribute, sementic elements have it implicitly. -For example used by screenreaders. +Roles give meaning to elements, so it's useful to use directly if we can't find any existing semantic element and just a div instead. -`
` and `