summaryrefslogtreecommitdiff
path: root/src/content/blogs
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/blogs')
-rw-r--r--src/content/blogs/_degoogle-your-life.mdx31
-rw-r--r--src/content/blogs/rust-is-great.md101
2 files changed, 132 insertions, 0 deletions
diff --git a/src/content/blogs/_degoogle-your-life.mdx b/src/content/blogs/_degoogle-your-life.mdx
new file mode 100644
index 0000000..d6fa8e1
--- /dev/null
+++ b/src/content/blogs/_degoogle-your-life.mdx
@@ -0,0 +1,31 @@
+---
+title: "How to de-google your life"
+description: How I de-googled my life and why you should do it too
+date: 2222-11-11
+---
+
+## What I already de-googled
+- Proton (mail, drive, calendar maybe?)
+- KeepassXC
+- Gitea
+- Linux
+- Firefox (zen)
+- DuckDuckGo
+- Google photos, Google Drive backup etc
+
+
+## New stuff
+- SMS "Messages" app
+- Kopia (write a password management/backup/other setup blog?)
+- F-droid
+- Use a custom android OS?
+- Control over notifications?
+- Fossify (Contacts/Phone/Messages)
+- CoMaps instead of Google maps
+- Aurora instead of Google play
+- NetGuard
+- Self host notes app? maybe just use git for sync + a markdown editor on mobile?
+- Disable "My files" "Usage access"
+- Disable "Phone Manager"
+- Weather app
+- Nova launcher
diff --git a/src/content/blogs/rust-is-great.md b/src/content/blogs/rust-is-great.md
new file mode 100644
index 0000000..6916867
--- /dev/null
+++ b/src/content/blogs/rust-is-great.md
@@ -0,0 +1,101 @@
+---
+title: "Rust is great... except for the language"
+description: ""
+date: 2026-08-27
+---
+
+For those who know me it might be weird seeing me say "Rust is great", after all, I have been
+openly bashing and criticize the language for quite a while now.
+
+While my opinion on Rust hasn't changed, I came to a realization that made me appreciate Rust
+for what it has taught me -- which I hope to share in this blog.
+
+## What is Rust?
+
+> Rust is a blazingly fast and memory-efficient language: with no runtime or garbage collector,
+> Rust's rich type system and ownership model guarantees memory-safety and thread-safety,
+> enabling you to eliminate many classes of bugs at compile-time.
+
+Well... at least that's how the Rust website describes the language, in reality this is mostly
+propaganda, it's inaccurate and misleading at best.
+
+A more fair definition might look like:
+
+Rust is a language that restricts the way you are allowed to program, enabling it to make certain
+guarantees that allows detecting memory and data corruption at compile time.
+Rust doesn't have a garbage collector, making it usually faster than garbage-collected languages.
+
+So, both of these definitions seem to focus on Rust being able to guarantees that usually only
+garbage collected languages can make, so how does it do that?
+
+Rust accomplishes that via it's most unique feature: the Ownership Model.
+
+## What is Ownership?
+
+There are 3 rules to ownership:
+
+- Each value in Rust has an owner
+- There can only be one owner at a time
+- When the owner goes out of scope, the value will be dropped (freed/deallocated)
+
+Assigning a value to a variable, passing it as an argument to a function[^1] or returning it will
+result in what's called a "move", where the existing variable gives up it's ownership and passes
+it to a new owner.
+
+This mostly applies to types that allocate a resource that needs freeing, which in Rust means any
+type that implements the `Drop` trait.
+Types that don't implement `Drop` such as integers and other primitives are "trivially copyable"
+meaning the value just gets copied instead of "moving" ownership.
+
+Just these rules already make a few nice guarantees:
+
+- Values are only dropped exactly once, preventing double frees
+- Values can't be used after being dropped, preventing use-after-free (UAF)
+- Values will be automatically dropped, preventing SOME memory leaks.
+
+One issue with this, is that if you pass a few values to a function temporarily, you must return
+all of them back, otherwise the caller can no longer use them.
+
+This is fixed by another concept called "borrowing" -- as the the name suggests, instead of giving
+up ownership, it allows to "borrow" a _reference_ to a value temporarily, and later return the
+reference back to owner.
+
+There are 2 types of references, a read-only (immutable) reference, and a read-write (mutable)
+reference. By restricting the programmer to only ever have a single mutable reference OR any
+number of immutable references Rust is able to guarantee a bit more:
+
+- Data races can't happen as a value will never be written to while also being read/written by
+ something else
+- References are always valid (no dangling references)
+
+There is one more concept worth mentioning, but first, I'd like to take this opportunity to shine
+a light on one of my biggest issues with the language -- the restrictiveness of it.
+
+While these rules do give us guarantees, they make our lives incredibly tedious, we constantly
+have to keep track of what's mutable, and what isn't, and what references do we have to what,
+and if we get any of that wrong, we have to stop what we are doing, read a long error message, fix
+the bug, and then go back and try to remember what we actually wanted to do - and then again,
+every few minutes, it destroys productivity.
+
+And it doesn't even need to be a complex example, even this simple code doesn't compile:
+```rust
+let my_list = vec![1, 2, 3, 4];
+let first: &i32 = my_list[0];
+my_list.push(5); // error: can't take mutable reference because immutable reference exists (first)
+let last: &i32 = my_list[my_list.len-1];
+println!("{first} and {second}");
+```
+
+This is a very simple code example that doesn't violate any of the guarantees[^2] Rust makes, yet
+Rust does not compile this code. This is because not every valid program would be verifiable by
+Rust, there will always be correct programs that Rust will deny.
+
+## Lifetimes
+
+
+
+
+
+
+
+