From 3d3feea3aa5a7c48a0577af40806c3bb03b818fb Mon Sep 17 00:00:00 2001 From: Lorenzo Torres Date: Sun, 31 Aug 2025 17:41:18 +0200 Subject: Implemented the website --- content/_index.html | 19 +++++++++++++++++++ content/blog/why_c.md | 19 +++++++++++++++++++ content/faq.md | 1 - content/projects.md | 13 +++++++++++++ content/projects/cc.md | 21 +++++++++++++++++++++ content/projects/sideros.md | 16 ++++++++++++++++ content/projects/sis.md | 17 +++++++++++++++++ layout/item.html | 10 ++-------- layout/page.html | 1 - layout/post.html | 4 ++-- makesite.py | 4 +++- static/css/style.css | 41 ++++++++++++++++++++++++++++++----------- static/email.png | Bin 0 -> 583 bytes 13 files changed, 142 insertions(+), 24 deletions(-) create mode 100644 content/blog/why_c.md delete mode 100644 content/faq.md create mode 100644 content/projects/cc.md create mode 100644 content/projects/sideros.md create mode 100644 content/projects/sis.md create mode 100644 static/email.png diff --git a/content/_index.html b/content/_index.html index ec6d28f..1fc9c60 100644 --- a/content/_index.html +++ b/content/_index.html @@ -1 +1,20 @@ + +

Welcome!

+Hi, I’m Lorenzo. I’m an italian student based in Genoa. On this site I write about whatever catches +
my mind, most likely on computers, linguistics, books, and random personal thoughts. +

Pinned posts

+ + + +

Contacts

+If you want to discuss about something, I'm happy to receive emails at diff --git a/content/blog/why_c.md b/content/blog/why_c.md new file mode 100644 index 0000000..ec001c1 --- /dev/null +++ b/content/blog/why_c.md @@ -0,0 +1,19 @@ + + + +In recent years, the Rust programming language has taken over the programming community with its appealing features, most notably **memory safety**. For this reason, there is a huge movement of people rewriting everything in Rust including tools like GNU's coreutils, grep and even some drivers in the Linux kernel. If we take a look at some of these new rewrites, most of them are actually more performant than their older C alternatives. So is C useless? In my opinion, no. + +#### Why Rust rewrites are faster +Let's take a look at [ripgrep](https://github.com/BurntSushi/ripgrep): their benchmarks show how in some cases GNU grep is 10 times slower. But how is it possible? Well, simply put, Rust makes it way easier to create "concurrent" software thanks to libraries such as [crossbeam](https://github.com/crossbeam-rs/crossbeam) and ripgrep makes extensive use of this while grep is single threaded. Not only that, GNU grep was designed in the late 90s when available hardware was very different from today's computers and thus it was designed with that hardware in mind. On the other hand ripgrep uses SIMD and other x86 extensions to accelerate the searching algorithms.\ +All of this can be done also in C, it's just more complicated since there is no such thing as crossbeam nor all the abstractions Rust provides. + +#### Why should you use C +With that being said, one could ask "why should I bother with C" and that's a valid question. In my opinion, C has some advantages that other languages just can't reach by design, for example: +- C is simple. Take a look at C++, its standard library is one of the most complex and the language itself has a lot of concepts to take into account while writing code. Same goes for other complex languages such as Java, C# and Rust. +- C gives you control. I like to be able to control every aspect of my code, even if some people could claim that's *unsafe*. Compilers like the Rust one are smart and can catch many different issues for sure, but I think that any experienced programmer often knows better and might want to do some tricks that improve the performance of the program without being contrained with complex abstractions such as borrowing. +- C is **safe**. Memory safety is not exclusive to Rust. Applying good practices isn't difficult since the basic rules are just free whatever you allocate and handle cases where the program could exit without freeing, using `goto` in the same way some languages like Zig and Go use `defer`. +- C is stable. The first version of the C programming language came in the 70s as a companion for the UNIX operating system and it's widely adopted even today since most low level work (but not only that) still relies on it (graphics APIs, kernels, firmwares...) and with over 50 years of history its ecosystem is very mature and modern compilers can produce very good quality machine code for many architectures. +- C is here to stay. Being so simple, implementing a C compiler is a task anyone could do at any point so we can be sure that software written in C (standard C, not using all the GNU bullshit extensions) can probably run in 10 years or more from now without many changes. + +#### So are other languages useless? +No, other languages are not useless as most languages (no, not you JavaScript) can be used to achieve similar results and everyone has their preference on the matter. I wrote this post in defence of C since nowadays I keep hearing that we should all stop using it [[1]](https://www.tomshardware.com/software/security-software/white-house-urges-developers-to-avoid-c-and-c-use-memory-safe-programming-languages) [[2]](https://www.zdnet.com/article/programming-languages-its-time-to-stop-using-c-and-c-for-new-projects-says-microsoft-azure-cto/). diff --git a/content/faq.md b/content/faq.md deleted file mode 100644 index 075e196..0000000 --- a/content/faq.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/content/projects.md b/content/projects.md index 5a9c5cb..b071eab 100644 --- a/content/projects.md +++ b/content/projects.md @@ -1 +1,14 @@ + +# My projects +This is a list of the projects I'm currently working on.\ +Note that some of these could be temprarily unmaintained\ +and currently none is actually usable since I can't manage\ +to finish anything I start (so far). + +### Work in progress +- [sideros](sideros/): Real time strategy game set in ancient history +- [sis](sis/): Simple IMAP server +- [cc](cc/): Very basic C99 compiler + +### Actually working diff --git a/content/projects/cc.md b/content/projects/cc.md new file mode 100644 index 0000000..7ff8178 --- /dev/null +++ b/content/projects/cc.md @@ -0,0 +1,21 @@ + + +## cc +**cc** is a very basic, very work in progress C99 compiler. + +#### Description +After realizing how "success" my first YouTube video had made, I decided to make\ +a second one. This time I wanted to make a C compiler from scratch since I thought\ +that it wouldn't be too hard. The video also got a lot of views (at least considering\ +how small my channel is) and now I would like to continue working on it, maybe using\ +something like [qbe](https://c9x.me/compile/). + +#### Related videos +- [I made a C compiler in C](https://www.youtube.com/watch?v=UW8LgC-S_co) +- [Writing a C compiler from scratch | Part 1](https://www.youtube.com/watch?v=qjqsInGjyTk) +- [Writing a C compiler from scratch | Part 2](https://www.youtube.com/watch?v=J-_yoKCxhYk) + +#### Sources +cc is currently hosted on Sourcehut at [https://git.sr.ht/~lolzdev/sis](https://git.sr.ht/~lolzdev/cc) + +#### Related posts diff --git a/content/projects/sideros.md b/content/projects/sideros.md new file mode 100644 index 0000000..d6e8330 --- /dev/null +++ b/content/projects/sideros.md @@ -0,0 +1,16 @@ + + +## Sideros +Sideros is a real time strategy game set in ancient history. + +#### Description +The game is being made using the Zig programming language and Vulkan,\ +with the aim of creating something as more historically accurate as\ +possible while still allowing for modders to modify the game as they wish\ +thanks to our WebAssembly virtual machine and our modding API. I'm not making\ +this alone so consider cheking out the git repository for credits. + +#### Sources +Sideros is currently hosted on Sourcehut at [https://git.sr.ht/~lolzdev/sideros](https://git.sr.ht/~lolzdev/sideros) + +#### Related posts diff --git a/content/projects/sis.md b/content/projects/sis.md new file mode 100644 index 0000000..bda8f4b --- /dev/null +++ b/content/projects/sis.md @@ -0,0 +1,17 @@ + + +## sis +**sis** is a simple IMAP server. + +#### Description +While setting up Dovecot for my personal mail server I realized how (in my opinion)\ +overcomplicated it is. So I decided to make an IMAP server following the [suckless philosophy](https://suckless.org/philosophy/).\ +The source code must be kept simple and configuration can be done by simply modifying\ +the generated `config.h` file before compiling. This is probably not feasible for a large\ +scale mailing service but it's more than enough for all the people who just want an email\ +server for themselves. + +#### Sources +sis is currently hosted on Sourcehut at [https://git.sr.ht/~lolzdev/sis](https://git.sr.ht/~lolzdev/sis) + +#### Related posts diff --git a/layout/item.html b/layout/item.html index 4fb8500..2395306 100644 --- a/layout/item.html +++ b/layout/item.html @@ -1,10 +1,4 @@ -
-

{{ title }}

+ diff --git a/layout/page.html b/layout/page.html index f300dbe..e2d342e 100644 --- a/layout/page.html +++ b/layout/page.html @@ -15,7 +15,6 @@ home blog projects - faq diff --git a/layout/post.html b/layout/post.html index bd5beb3..71d40d5 100644 --- a/layout/post.html +++ b/layout/post.html @@ -1,5 +1,5 @@ -
-

{{ title }}

+
+

{{ title }}

published on {{ date }}

{{ content }}
diff --git a/makesite.py b/makesite.py index a42a437..bde78a8 100755 --- a/makesite.py +++ b/makesite.py @@ -175,7 +175,7 @@ def main(): # Default parameters. params = { 'base_path': '', - 'site_url': 'http://localhost:8000', + 'site_url': 'https://sagittarius-a.org', 'current_year': datetime.datetime.now().year } @@ -202,6 +202,8 @@ def main(): page_layout, **params) make_pages('content/[!_]*.md', '_site/{{ slug }}/index.html', page_layout, **params) + make_pages('content/projects/[!_]*.md', '_site/projects/{{ slug }}/index.html', + page_layout, **params) # Create blogs. blog_posts = make_pages('content/blog/*.md', diff --git a/static/css/style.css b/static/css/style.css index e900c8c..f4c32fa 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -1,13 +1,3 @@ -@media (prefers-color-scheme: dark){ - body { - background:#000; - color: white; - } - - .content a { - color: black; - } -} body{ margin: 0; font:1.2em/1.62 sans-serif @@ -46,9 +36,38 @@ h1,h2,h3 { } .content a { - color: white; + color: black; } .content a:hover { color: #069; } + +@media (prefers-color-scheme: dark){ + body { + background:#000; + color: white; + } + + .content a { + color: white; + } +} + +article h1 { + margin-bottom: 0.1em; +} + +article p { + margin-top: 0; +} + +article h4 { + margin-bottom: 0.1em; +} + +.post { + max-width: 700px; + margin: 2rem auto; + padding: 1.5rem; +} diff --git a/static/email.png b/static/email.png new file mode 100644 index 0000000..ebc2a1d Binary files /dev/null and b/static/email.png differ -- cgit v1.2.3