summaryrefslogtreecommitdiff
path: root/3 resources
diff options
context:
space:
mode:
Diffstat (limited to '3 resources')
-rw-r--r--3 resources/Group.ONE Infrastructure.md1
-rw-r--r--3 resources/Man pages.md3
-rw-r--r--3 resources/Note taking.md7
-rw-r--r--3 resources/RabbitMQ.md2
-rw-r--r--3 resources/TaskWarrior (ToDo).md3
-rw-r--r--3 resources/programming/Elixir - modules.md0
-rw-r--r--3 resources/programming/Elixir.md228
-rw-r--r--3 resources/programming/Nix.md16
-rw-r--r--3 resources/sollicitatie-vragenlijst.md7
9 files changed, 267 insertions, 0 deletions
diff --git a/3 resources/Group.ONE Infrastructure.md b/3 resources/Group.ONE Infrastructure.md
new file mode 100644
index 0000000..1d9ba33
--- /dev/null
+++ b/3 resources/Group.ONE Infrastructure.md
@@ -0,0 +1 @@
+I want to have an overview of systems and what they are responsible for. Example, what is OneHOP or OneHome and what do they do. I plan to write that down in this document. \ No newline at end of file
diff --git a/3 resources/Man pages.md b/3 resources/Man pages.md
new file mode 100644
index 0000000..901be15
--- /dev/null
+++ b/3 resources/Man pages.md
@@ -0,0 +1,3 @@
+**2024-08-21 18:07:20**
+I need to more consistently read man pages. Example is `man task` to see how taskwarrior works, after reading it today I found that it is actually quite easy.
+They often contain good information on how to use a certain tool. \ No newline at end of file
diff --git a/3 resources/Note taking.md b/3 resources/Note taking.md
new file mode 100644
index 0000000..2a47666
--- /dev/null
+++ b/3 resources/Note taking.md
@@ -0,0 +1,7 @@
+**2024-08-21 17:59:00**
+I want to become better at taking notes consistently in the hope that I forget less important things and become better overall at managing knowledge.
+To try and create the habit I will open a new daily note in Obsidian at the start of the day and sit down at the end of the day to refine anything written down into a more permanent form like this one. I'm hoping that by doing this consistently I will more often write down ideas, information, etc. during the day, rather than forget about it.
+
+After refining the daily notes, I should commit and push changes to a remote git repo that is also regularly backed up so I keep all this knowledge safe.
+
+I'm not yet sure if and how I incorporate this into a "zettelkast", something I did start before but never really stuck. I will need to do more research into this, and note taking overall. \ No newline at end of file
diff --git a/3 resources/RabbitMQ.md b/3 resources/RabbitMQ.md
new file mode 100644
index 0000000..e9c94c5
--- /dev/null
+++ b/3 resources/RabbitMQ.md
@@ -0,0 +1,2 @@
+**2024-08-21 18:09**
+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/TaskWarrior (ToDo).md b/3 resources/TaskWarrior (ToDo).md
new file mode 100644
index 0000000..6002fde
--- /dev/null
+++ b/3 resources/TaskWarrior (ToDo).md
@@ -0,0 +1,3 @@
+**2024-08-21 18:03:00**
+I want to better keep track of what i'm doing, for that purpose I will use taskwarrior. For usage see `man task`.
+Adding a task is done by `task add`, to modify it `task <ID> modify` . I use priorities, they can be set on a new or existing task with `priority:H/M/L`.
diff --git a/3 resources/programming/Elixir - modules.md b/3 resources/programming/Elixir - modules.md
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/3 resources/programming/Elixir - modules.md
diff --git a/3 resources/programming/Elixir.md b/3 resources/programming/Elixir.md
new file mode 100644
index 0000000..b106ae4
--- /dev/null
+++ b/3 resources/programming/Elixir.md
@@ -0,0 +1,228 @@
+Elixir supports "macro's", which is Elixir code that runs at compile time. They receive the AST of the source code as input and can apply transformations to it. This is how Elixir is written itself, using Elixir macro's.
+
+Elixir functions can be organized into [[Elixir - modules]].
+```
+defmodule MyModule do
+ # Comment
+ @moduledoc "Documentation for the module"
+ import IO
+ alias IO, as MyIO # Alias import
+
+ @pi 3.14 # Module attribute
+
+ @doc "Describe what the function does"
+ def hello do
+ MyIO.puts("blaat")
+ 3*@pi # Module attribute reference
+ done
+
+ @spec hello_private(string) # typespec, can be used by dialyzer, very useful
+ defp hello_private(hello) do
+ puts(hello)
+ done
+done
+```
+
+The [[Elixir - Kernel]] module is always imported, so functions we use without prefix come from Kernel.
+
+Elixir introduces a concept called [[Elixir - Atoms]]. They are named constants, like enumerations in C.
+```
+:blaat
+:"Bla at"
+Blaat == :"Elixir.Blaat" # Alias
+
+var = :blaat # var contains only a reference to the atom, thus is small and fast.
+```
+
+[[Elixir - Aliases]] are internally represented as "Elixir.RealThing", in the case of the module alias above `MyIO == Elixir.IO`.
+
+[[Elixir - Tuples]] group a, usually small, fixed number of elements together. Kernel.elem/2 for access, Kernel.put_elem/3 for updating.
+
+[[Elixir - Lists]] are a recursive structure with a head of any type and a tail which is another list. They are notated as regular arrays in other languages, but can be written as `[head | tail]`. Therefore it's easy and efficient to push a new item to the top, we can use the head | tail notation ->
+https://hexdocs.pm/elixir/List.html
+https://hexdocs.pm/elixir/Enum.html
+```
+list = [1, 2, 3]
+list = [4 | list]
+list
+[4, 1, 2, 3]
+```
+
+[[Elixir - Immutable functions]] give a form of atomicity, because operations (other functions) they call do not mutate data if anything fails we can just return the original data without having changed anything.
+
+[[Elixir - Maps]] %{}, can also be created with Map.new([{1, 2}, {3, 4}]) (2-tuples).
+https://hexdocs.pm/elixir/Map.html
+```
+a = %{1 => 1}
+a[1]
+1
+```
+Maps can also be used to define structures,
+```
+person = %{name: "Jasper"}
+```
+
+[[Elixir - Binaries]] are consecutive sequences of bytes.
+```
+<<1, 1>> is a two-byte binary where each byte has value of, thus
+0000 0001 0000 0001
+<<1>> <> <<2>> concatenate two binaries
+0000 0001 0000 0010
+```
+
+[[Elixir - Strings]]
+```
+"This is a stringt"
+"
+Multiline
+string
+"
+a = 1337
+"Print number #{a}" # #{} allows evaluation of values strings
+
+~s(This is a sigil which is also a string)
+~s(Is useful to "use" quotes)
+str = "INTERPOLATION!"
+~S(Capital-S sigil allows prevention of string #{str} and \nescaping)
+"Capital-S sigil allows prevention of string \#{str} and \\nescaping"
+
+"Blaat" <> " henk" # Concatenation works like binaries, because strings are binaries
+```
+
+[[Elixir - Lambda]]
+```
+square = fn x -> # lambda's use fn
+ x*x
+end
+
+square.(5) # lambda is called with name period arguments enclosed by parens. The dot is to make it known that we are calling a lambda and not a regular function.
+```
+
+For cases where the lambda just forwards its arguments to another function there is a special syntax, example:
+[[Elixir - capture operator]]
+```
+Enum.each([1, 2, 3], fn x -> IO.puts(x) end)
+Enum.each([1, 2, 3], &IO.puts/1) # The & is called the "capture operator" and can also be used to shorten a lambda definition:
+lambda = fn x, y, z -> x * y + z end
+lambda = &(&1 * &2 + &3) # Like bash arguments ${1} ${2} etc
+```
+
+[[Elixir - Closure]]
+A lambda can reference variables from the outside scope. If we rebind the variable in the parent scope, the lambda will still reference the old one.
+```
+outside = "Abc"
+lambda = &IO.puts/1
+outside = "cdef"
+lambda.()
+"Abc"
+```
+
+Range
+0..1, internally represented as a map with bounds set, therefore small no matter how "big" the range. Is also an enumeration so can use the Enum module.
+
+Keyword list
+List of 2-tuple where the 1st element is an atom. E.g. `[{:monday, 1}, {:tuesday, 2}]` can be written more elegant as `[monday: 1, tuesday: 2]`
+https://hexdocs.pm/elixir/Keyword.html
+Can be used as kwargs like in python.
+
+MapSet
+https://hexdocs.pm/elixir/MapSet.html
+Also an enumeration.
+Initialize with MapSet.new
+
+Times and Dates
+Have modules: Date, Time, DateTime, NaiveDateTime
+Created with sigil ~D for dates, and ~T for time
+```
+dt = ~D[2023-01-01]
+dt.year
+2023
+
+tm = ~T[19:03:32]
+tm.second
+32
+```
+
+IO lists
+Are lists that can consist of one of three types:
+- Int in range 0..255
+- Binaries
+- Another IO list
+It is thus a tree. Input operations are O(1)
+
+
+Pattern matching
+The '=' operator is not an assignment operator, but a match operator.
+pattern = expression
+Pattern can be list, map, tuple, variable, binaries, binary strings
+constants, atom can be matched to discriminate results of expressions.
+{:ok, result} = expr, fails is expr returns for example {:error, result}
+Patterns can be nested: `{_, {hour, _, }, _} = :calendar.local_time()`
+
+Maps can partial match, to extract a property from a complex map.
+Lists can abuse their recursive naturs: `[head | tail] = [1, 2, 3] head = 1, tail = [2,3]`
+Pin-operator `^` is used to match against the value of a variable:
+```
+a = "Bob"
+{^a, _} = {"Bob", 25} <- Matches because the value of a is "Bob"
+{^a, _} = {"Alice", 25} <- Doesn't match
+```
+
+Pattern matching using strings it's possible to match the beginning of a string and assign the rest to a var:
+```
+command = "ping www.hostnet.nl"
+"ping " <> url = command
+url = "www.hostnet.nl"
+```
+
+Pattern matching can be done in function arguments and enabled "multiclause functions", which is a sort of function overloading. It's multiple definitions of the same function, with the same arity, but with different argument patterns. They are treated as a single function, so with the capture operator you can use all "variants".
+```
+defmodule Geo do
+ def area({:square, a, b}), do a * b end
+ def area({:circle, r}), do r * r * pi end
+ def area(unknown), do {:error, {:unknown_shape, unknown}} end
+ # ^ do mind that the arity has to match for this catch-all error, also
+ # ordering is important. The runtime matches from top to bottom.
+end
+
+fn = &Geo.area/1
+
+fn.({:square, 1, 2})
+2
+fn.({:circle, 23})
+whatever this is
+```
+
+Conditionals can be implemented using multiclause functions, but also with the regular if..else statements, cond do .. end and case expression do ... end.
+
+A with-clause can be used to match multiple patterns in order and halt if a pattern doesn't match.
+```
+defp extract_login(%{"login" => login}%) do, %{:ok, login} end
+defp extract_login(_) do, {:error, "login missing"} end
+
+defp extract_email(%{"email" => email}) do, %{:ok, email} end
+defp extract_email(_) do, %{:error, "email missing"} end
+
+def extract_user(user) do
+ case extract_login(user) do
+ {:error, reason} -> {:error, reason}
+ {:ok, login} ->
+ case extract_email(user) do
+ {:error, reason} -> {:error, reason}
+ {ok, email} -> %{login: login, email: email}
+ end
+ end
+end
+
+# can be written as
+
+def extract_user(user) do
+ with {:ok, login} <- extract_login(user),
+ {:ok, email} <- extract_email(user) do
+ {:ok, %{login: login, email: email}}
+ end
+end
+```
+
+Looping is mainly implemented via recursion. The break condition is implemented via a multiclause function matching the condition that you want to break at.
+Recursion can be expensive, unless the recursive call is at the end of a function, which is called a tail-call. Tail-calls are optimized to not require any additional memory, because their result is also the result of the caller, so we don't need to come back to the caller. \ No newline at end of file
diff --git a/3 resources/programming/Nix.md b/3 resources/programming/Nix.md
new file mode 100644
index 0000000..fca31a8
--- /dev/null
+++ b/3 resources/programming/Nix.md
@@ -0,0 +1,16 @@
+ `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`.
+
+Nix is like JSON, but with functions.
+Recursive attribute sets can reference values declared earlier in the same set.
+```nix
+rec {
+ one = 1;
+ two = one + 1;
+}
+```
+
+A `let` binding is used to assign names to values just as attribute sets, they can then be used in expressions. Let bindings have a local scope.
+
+A `with` allows referencing attributes of attribute sets without referencing the set.
+
diff --git a/3 resources/sollicitatie-vragenlijst.md b/3 resources/sollicitatie-vragenlijst.md
new file mode 100644
index 0000000..08e2f89
--- /dev/null
+++ b/3 resources/sollicitatie-vragenlijst.md
@@ -0,0 +1,7 @@
+- Ben je bekend met scrum, agile, kanban, jira etc?
+
+
+Technische vragen:
+threading, race conditions, deadlocks
+message queue
+- Kun je uitleggen hoe een binary search werkt \ No newline at end of file