From 04db4c941799bfbfac666160e7b4298716649a7f Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Tue, 15 Jul 2025 20:32:57 +0200 Subject: vault backup: 2025-07-15 20:32:57 --- Protocol Buffers - protobuf.dev.md | 20 ++++++++++++++++ ...ing Language - A Donovan, B Kernighan - 2015.md | 27 ++++++++++++++++++++++ daily/17-May-2025.md | 27 ---------------------- daily/23-Jun-2025.md | 0 4 files changed, 47 insertions(+), 27 deletions(-) create mode 100644 Protocol Buffers - protobuf.dev.md create mode 100644 The Go Programming Language - A Donovan, B Kernighan - 2015.md create mode 100644 daily/23-Jun-2025.md diff --git a/Protocol Buffers - protobuf.dev.md b/Protocol Buffers - protobuf.dev.md new file mode 100644 index 0000000..9bd83c6 --- /dev/null +++ b/Protocol Buffers - protobuf.dev.md @@ -0,0 +1,20 @@ +Protocol buffer messages are often loaded in to memory completely. So large data is not a good fit. Usually not more than a few MBs. + +The same data can have many different forms of binary serialization when it is serialized, therefore serialized data (messages) cannot be compared. + +Messages are not compressed. They can be compresses with zip/gzip but to obtain maximum compression use specialized compression algorithms such as ones used by JPEG/PNG. + +Protocol buffers are not maximally efficient for large multi-dimensional arrays or floating point numbers. + +Not well supported in non-object oriented languages. + +Protocol buffer messages require their schema to be interpreted correctly. + + +--- + +# Workflow +1. Write .proto schema +2. Generate code using `protoc` compiler +3. Compile generated protobuf code together with project +4. Use Protobuff classes to serialize, share and deserialize data \ No newline at end of file diff --git a/The Go Programming Language - A Donovan, B Kernighan - 2015.md b/The Go Programming Language - A Donovan, B Kernighan - 2015.md new file mode 100644 index 0000000..f0c7389 --- /dev/null +++ b/The Go Programming Language - A Donovan, B Kernighan - 2015.md @@ -0,0 +1,27 @@ +Go compiles into native machine code. +Go handles Unicode natively thus any character can be used in a string. +Divided into packages, where a package is sort of a library, except for main which defines an executable. +Import declarations **must** follow the package declaration. +Function declarations: `func () ()`. No semicolons, unless multiple statements on 1 line. +`gofmt` mandatory. `goimports` (`golang.org/x/tools/cmd/goimports`) manages imports. +Slices are dynamically sized arrays that can be accessed `s[i]` or a subset can be taken `s[i:j]`. Indexing: half-open (starts at 0). `s[i:j]` yields i through j-1. Either can be omitted. + +Convention: comment describing package preceding package declaration. + +Variables initialised to "zero value".7689 +String concatenation via `+` char. +Supports assignment operators, e.g `+=`, `*=` etc +Short-hand variable declaration requires no type, it is inferred of the value `:=` **only allowed in a function** + +For-loop structure: +``` +for initialization; condition; post { + // code +} +``` +Either part can be left away with different semantics. +All parts gone: loop forever. +Only condition is like a while x == true; +`range` keyword to loop over a slice or array with `for index, arg := range slice` + +`_` is the blank identifier, thus above if we don' need the index we can put `_`. diff --git a/daily/17-May-2025.md b/daily/17-May-2025.md index 7872d2a..0ff674d 100644 --- a/daily/17-May-2025.md +++ b/daily/17-May-2025.md @@ -1,30 +1,3 @@ # Notes on go -Go compiles into native machine code. -Go handles Unicode natively thus any character can be used in a string. -Divided into packages, where a package is sort of a library, except for main which defines an executable. -Import declarations **must** follow the package declaration. -Function declarations: `func () ()`. No semicolons, unless multiple statements on 1 line. -`gofmt` mandatory. `goimports` (`golang.org/x/tools/cmd/goimports`) manages imports. -Slices are dynamically sized arrays that can be accessed `s[i]` or a subset can be taken `s[i:j]`. Indexing: half-open (starts at 0). `s[i:j]` yields i through j-1. Either can be omitted. - -Convention: comment describing package preceding package declaration. - -Variables initialised to "zero value".7689 -String concatenation via `+` char. -Supports assignment operators, e.g `+=`, `*=` etc -Short-hand variable declaration requires no type, it is inferred of the value `:=` **only allowed in a function** - -For-loop structure: -``` -for initialization; condition; post { - // code -} -``` -Either part can be left away with different semantics. -All parts gone: loop forever. -Only condition is like a while x == true; -`range` keyword to loop over a slice or array with `for index, arg := range slice` - -`_` is the blank identifier, thus above if we don' need the index we can put `_`. **Type assertion** diff --git a/daily/23-Jun-2025.md b/daily/23-Jun-2025.md new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3 From 284562556d470823ce56ee182ed73f1ecd778854 Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Tue, 15 Jul 2025 20:34:35 +0200 Subject: vault backup: 2025-07-15 20:34:35 --- conflict-files-obsidian-git.md | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 conflict-files-obsidian-git.md diff --git a/conflict-files-obsidian-git.md b/conflict-files-obsidian-git.md deleted file mode 100644 index e8b46b1..0000000 --- a/conflict-files-obsidian-git.md +++ /dev/null @@ -1,18 +0,0 @@ -# Conflicts -Please resolve them and commit them using the commands `Git: Commit all changes` followed by `Git: Push` -(This file will automatically be deleted before commit) -[[#Additional Instructions]] available below file list - -- Not a file: .trash/daily/23-Jun-2025.md -- [[17-May-2025]] - -# Additional Instructions -I strongly recommend to use "Source mode" for viewing the conflicted files. For simple conflicts, in each file listed above replace every occurrence of the following text blocks with the desired text. - -```diff -<<<<<<< HEAD - File changes in local repository -======= - File changes in remote repository ->>>>>>> origin/main -``` \ No newline at end of file -- cgit v1.2.3 From a3bfa174cdf22bf9366bb511ffb7d461d49b3cf7 Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Thu, 17 Jul 2025 20:28:21 +0200 Subject: quickshell --- Quickshell.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Quickshell.md diff --git a/Quickshell.md b/Quickshell.md new file mode 100644 index 0000000..a0401f4 --- /dev/null +++ b/Quickshell.md @@ -0,0 +1,49 @@ +https://quickshell.org + +XDG standard config paths. Looks for `shell.qml` in all sub-directories unless root dir has one. Target specific config using `quickshell -c configname`. + +# Windows +Requires `import Quickshell`. +Types: +- PanelWindow: for bars, widgets and overlays +- FloatingWindow: standard desktop windows + +[Type reference](https://quickshell.org/docs/types/Quickshell/PanelWindow) + +# Text +[Text](https://doc.qt.io/qt-6/qml-qtquick-text.html) requires `import QtQuick. +Set `id: somename` to reference by `somename`, ie `somename.text = "blaat"` + +Strings can be concat using `+` +# Processes +Requires `import Quickshell.Io` (NOTE the capital I in Io) + +[Process](https://quickshell.org/docs/types/quickshell.io/process) object runs commands. +[StdioCollector](https://quickshell.org/docs/types/Quickshell.Io/StdioCollector) reads process' output. + +Use a [Timer](https://doc.qt.io/qt-6/qml-qtqml-timer.html) to run Process on an interval. + +# Component +A reusable tree of objects. +[Variants](https://quickshell.org/docs/types/Quickshell/Variants) creates instances of a component based on user supplied data. For example this used to create instances of a window based on the monitor list. + +To prevent many of the same processes when we reuse a component many times use `Scope` to move them outside of the reused component. +We can use a [Property Definition](https://quickshell.org/docs/configuration/qml-overview/#property-definitions) on the parent scope to communicate between components in different scopes but in the same parent scope. Properties are reactive. + +# Multiple files +shell.qml is the root. If a filename starts with a capital letter it can be referenced. E.g Bar.qml +``` +Scope { + Bar {} +} +``` + +Other folders can be imported using `import` statements. + +# Singleton +Has only one instance that is accessible from every scope. For example the date process in the bar. + +Set `pragma Singleton` at the top of the file ( before imports ). and Use `Singleton` type. + + +[Clock formatting](https://doc.qt.io/qt-6/qml-qtqml-qt.html#formatDateTime-method) \ No newline at end of file -- cgit v1.2.3 From 1dbacfecb241f5eb6b512f78b0b243615b971c1a Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Thu, 17 Jul 2025 21:35:57 +0200 Subject: read more about QML language --- Quickshell.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/Quickshell.md b/Quickshell.md index a0401f4..607441f 100644 --- a/Quickshell.md +++ b/Quickshell.md @@ -30,6 +30,29 @@ A reusable tree of objects. To prevent many of the same processes when we reuse a component many times use `Scope` to move them outside of the reused component. We can use a [Property Definition](https://quickshell.org/docs/configuration/qml-overview/#property-definitions) on the parent scope to communicate between components in different scopes but in the same parent scope. Properties are reactive. +# Objects +Properties + +`[required] [readonly] [default] property [: binding]` + +`id` is a special property that can be used to reference an object throughout +the entire current file. Has to be lowercase. + + +Functions + +``` +function ([: ][, ...])[: returntype] { + // multiline expression (note that `return` is required) +} +``` + +Can be invoked in expressions, reactivity is carried through -- so +if the argument value changes all expressions are re-evaluated. + +Lambas `() => ...` + + # Multiple files shell.qml is the root. If a filename starts with a capital letter it can be referenced. E.g Bar.qml ``` @@ -46,4 +69,28 @@ Has only one instance that is accessible from every scope. For example the date Set `pragma Singleton` at the top of the file ( before imports ). and Use `Singleton` type. -[Clock formatting](https://doc.qt.io/qt-6/qml-qtqml-qt.html#formatDateTime-method) \ No newline at end of file +[Clock formatting](https://doc.qt.io/qt-6/qml-qtqml-qt.html#formatDateTime-method) + + +# Signals +Event emitter. +Same rules as properties and function. + +`signal (: [, ...])` + +Objects have implict `on` (note capital S) for each signal defined. + +Connections object can be used to access difficult to reach signal handlers, +such as those from Singletons. + +`Connections { target: id; function onClicked() # example target: button }` +Does that somehow override the onClicked function of the target?? + + +All properties have `propertynameChanged` handler, powering the reactivity. + + +# Attached objects +Every object has `Component` attached, used to run stuff when an Object finishes +initializes using `Component.onCompleted`. + -- cgit v1.2.3 From 8bde51ba29aa23d1b6e01826b6af720b4256bd78 Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Thu, 24 Jul 2025 21:24:53 +0200 Subject: quickshell --- Item Size Position.md | 40 ++++++++++++++++++++++++++++++++++++++++ Quickshell.md | 31 ++++++++++++++++++------------- 2 files changed, 58 insertions(+), 13 deletions(-) create mode 100644 Item Size Position.md diff --git a/Item Size Position.md b/Item Size Position.md new file mode 100644 index 0000000..2479688 --- /dev/null +++ b/Item Size Position.md @@ -0,0 +1,40 @@ +[[Quickshell]] + +--- + +# Item Size Position + +`Item` type is the base type for "visual items". It has two properties: +- actual size ( width, height ) +- implicit/desired size ( implicitWidth, implicitHeight ) + +Implicit size is used by containers to determine their own. + +## Container items + +Container (ie. `Item`): +```qml +implicitWidth: child.implicitWidth + margin * 2 +implicitHeight: child.implicitHeight + margin * 2 +``` + +^ `WrapperItem` does this margin for us. + +Child (ie. `Rectangle`): +```qml +x: parent.margin +y: parent.margin +width: parent.width - parent.margin * 2 +height: parent.height - parent.margin * 2 +implicitWidth: 50 +implicitHeight: 50 +``` +[Binding](https://doc.qt.io/qt-6/qml-qtqml-binding.html) can be used to map any property +[Anchors](https://doc.qt.io/qt-6/qtquick-positioning-anchors.html) are a shorthand way to achieve many common position and size bindings. + +Using a containers' Item.childrenRect to determine size of children is a mistake. +Item.childrenRect represents the actual geometry of all child items, not the mplicit one. + +Use [MarginWrapperManager](https://quickshell.org/docs/types/Quickshell.Widgets/MarginWrapperManager) to handle size and position of container and a single child item. + +## Layouts diff --git a/Quickshell.md b/Quickshell.md index 607441f..c801fee 100644 --- a/Quickshell.md +++ b/Quickshell.md @@ -1,8 +1,14 @@ +[[Item Size Position]] + +--- + +# Quickshell + https://quickshell.org XDG standard config paths. Looks for `shell.qml` in all sub-directories unless root dir has one. Target specific config using `quickshell -c configname`. -# Windows +## Windows Requires `import Quickshell`. Types: - PanelWindow: for bars, widgets and overlays @@ -10,12 +16,12 @@ Types: [Type reference](https://quickshell.org/docs/types/Quickshell/PanelWindow) -# Text +## Text [Text](https://doc.qt.io/qt-6/qml-qtquick-text.html) requires `import QtQuick. Set `id: somename` to reference by `somename`, ie `somename.text = "blaat"` Strings can be concat using `+` -# Processes +## Processes Requires `import Quickshell.Io` (NOTE the capital I in Io) [Process](https://quickshell.org/docs/types/quickshell.io/process) object runs commands. @@ -23,25 +29,24 @@ Requires `import Quickshell.Io` (NOTE the capital I in Io) Use a [Timer](https://doc.qt.io/qt-6/qml-qtqml-timer.html) to run Process on an interval. -# Component +## Component A reusable tree of objects. [Variants](https://quickshell.org/docs/types/Quickshell/Variants) creates instances of a component based on user supplied data. For example this used to create instances of a window based on the monitor list. To prevent many of the same processes when we reuse a component many times use `Scope` to move them outside of the reused component. We can use a [Property Definition](https://quickshell.org/docs/configuration/qml-overview/#property-definitions) on the parent scope to communicate between components in different scopes but in the same parent scope. Properties are reactive. -# Objects +## Objects Properties `[required] [readonly] [default] property [: binding]` -`id` is a special property that can be used to reference an object throughout -the entire current file. Has to be lowercase. +`id` is a special property that can be used to reference an object throughout the entire current file. Has to be lowercase. Functions -``` +```qml function ([: ][, ...])[: returntype] { // multiline expression (note that `return` is required) } @@ -53,9 +58,9 @@ if the argument value changes all expressions are re-evaluated. Lambas `() => ...` -# Multiple files +## Multiple files shell.qml is the root. If a filename starts with a capital letter it can be referenced. E.g Bar.qml -``` +```qml Scope { Bar {} } @@ -63,7 +68,7 @@ Scope { Other folders can be imported using `import` statements. -# Singleton +## Singleton Has only one instance that is accessible from every scope. For example the date process in the bar. Set `pragma Singleton` at the top of the file ( before imports ). and Use `Singleton` type. @@ -72,7 +77,7 @@ Set `pragma Singleton` at the top of the file ( before imports ). and Use `Singl [Clock formatting](https://doc.qt.io/qt-6/qml-qtqml-qt.html#formatDateTime-method) -# Signals +## Signals Event emitter. Same rules as properties and function. @@ -90,7 +95,7 @@ Does that somehow override the onClicked function of the target?? All properties have `propertynameChanged` handler, powering the reactivity. -# Attached objects +## Attached objects Every object has `Component` attached, used to run stuff when an Object finishes initializes using `Component.onCompleted`. -- cgit v1.2.3