Hello and welcome to my little nock of the internet. Here I have my blog which mainly contain posts about tech, the outdoors, cooking, and some times mead brewing.
A bit of background information before you step into my world of crazy. I am Lars, a.k.a. looopTools, a Software Engineer living in East Jutland, Denmark. I have 10+ years of experience from industry mainly through student positions, but also as self-employed consultant, or full-time employee. I mainly work in low-level user space, high-level kernel space, and storage systems in general. Besides research and software development, I also love the outdoors and try to go out as often as possible (not enough at the moment) and I am an aspiring author currently working on a few different novels. I also dabble in being a more advance home cook and baker, which you may see some posts about. Finally I like the ancient art of brewing mead, a.k.a. honey wine, and experiment with different flavour combinations and ageing times.
[Book Review] I never thought about it that way
Less than a week ago I was looking for books on etiquette because, frankly, that is not my forte. During this quests for book I feel over the book “I never thought about it that way” by Monica Guzman. It had good reviews and I needed a new audio book for commute to work so I got it from one of my Audiobook dealers (in this case Audible) and started Listening. And boy I was blown away.
Whilst the book is more on etiquette in conversations and arguments, it holds a treasure troth of lessons which you can utilise to become better at understanding other people from very different backgrounds. The focus in the book is mainly on political differences but it is clear that the lessons learned can be applied in other conversations as well.
Guzman was born in Mexico from which her parents immigrated to the USA. What might be curious to many about this is that Guzman is Liberal but her parents are Conservatives whom voted for Trump. She starts the book by outlining how some from her social sphere in her lovely liberal Seattle cannot fathom why she is still in contact with her parents.
She continues by outlining different scenarios for who to handle difference of opinion and how to address it. It in particular focus on how to evaluated what others say and try to understand their perspective, how to be a good questioners, and, in my opinion, how deescalated others and your own aggression in conversation.
In particular the concept of sorting, othering, and siloing gets a lot of attention in the book. Where sorting is who we associated with and whom we do not. Followed by othering where we differentiated between us and them. Although these two cause division enough the final of the three siloing is much worse. This is the concept of creating echo chambers where we only expose ourselves to people with similar opinions as ourselves. Although she do not state this out right in the book I feel like she is hinting that this causes greater divides in our society and in the end extremism across all topics, polotics and, opinions. Of the things you can learn in this book I feel the understanding of these three concepts and how damning they can be are the most important.
The rest of the book dives into concepts and examples that underlines the issues SOS as she call sorting, othering, and siloing and how to best meet these issues, how to be aware of them, and how to alleviate them and not just meet them.
All in all I believe this book should be mandatory reading for any whom want to participate in any form of debate or argument about any topic.
However, the books have a two short comings in my opinion. Firstly, it very focused on the united states of america. Which is fair as the is the home of the author. Yet, at times it feels like the author focuses so much on the states that it seems like this is the only place these issues exists. Whilst, I believe this is not the authors intend, I would liked to have seen a reach for a broader worldly audience. Maybe the author can do so in a more expand version of the book. Secondly, and what nearly stopped me for finishing listing. The author have a lot of focus on her own achievements, basically a lot of “I did this”, “I arrange that”, “I helped start X”, and so on. At times the book felt more like the author was promoting herself rather than focus on the topic of the book. I personally think that a reedited version of the book could cut down on this content rather significantly.
./Lars
[Book review] Cult of the Dead Cow
From the first time I head about Cult of the Dead Cow (cDc), I was fascinated beyond my wildest dreams. Not only where they hackers, but they had ethics, a moral compass, and an overall coolness about them. However, I did not know where they came from, how the group worked not exactly what the purpose of their, at times, chaotic .txt files was. But even from the young age of 10 when I read their first .txt file I was hooked and I always wanted to learn more about this Hacktivist group.
A couple of years ago (late 2019) I stumbled upon the book Cult of the Dead Cow by Joseph Menn (fair warning Amazon Link /not affiliated/), in a brick and mortar book store in Aalborg, Denmark of all places and I got very sparkly eyes! I had wanted this book since I heard about the first time right after it was published back in June 2019. I could not believe I had it my hands! I bought it immediately as it was the only copy in the book store.
Here five years later almost I finally had the time and mental capacity to read it, and boy I was not disappointed.
The book is an honest treasure trow of information about the formation of the cDC from a humble Bulletin board in Texas, its turn to one of the most respected hacker groups in the world, and onwards to its legacy. Including the reasons for creating tools such as Back Orifice. Created with the intention of forcing big corporations to take security serious.
But Mr. Menn does not just focus on the positive it also includes the dark stuff like why Jake Laird excluded from the cult, and the impact of WikiLeaks and how the cDC saw WikiLeaks. LulzSec is also discussed and how elements inspired by the cDc may have gone their own ways away from values of the cDc.
The last member of the cDc covered in the book is Psychedelic Warlord a.k.a Beto O’Rourke. It describes how he used the style of thinking he learned from the early counter culture and cDc to campaign.
But even with all that the most important lessons from the book. Is the following
- With a few dedicated people you can do a lot
- Have principals and morals and stick to them
The Cult of the Dead Cow may have faded into a more obscure place but it and its members have left a lasting legacy on the world. Inspired many and let some of us towards better ideals. I am very thankful that I got to read this book.
Honestly my only regret about the book is that I did not buy it in hard cover!!!
./looopTools
[C/C++] Do you need a file system to write to a disk?
Before I did my PhD my interaction with data storage on disk had mainly been in the classic way. With the classic way I mean having a storage medium (SSD, HDD, USB, etc.) formatted and with a file system (HFS, EXT4, APFS, NTFS, XFS, etc.). During my PhD I started to ask the question: Do I actually need the file system?
The reason for this question was that I on Ubuntu was running in to a strange limitation. I was literally hitting an upper bound for how many files there could be in a single directory. I hit this by exceeding the number of open file descriptors allowed by Ubuntu, which was lower at the time than for instance Fedoras limit. Note, it is really confusing when code works on one Linux distribution and not the other and the error you get is related to the limits imposed for file descriptors. ANYWAYS! I had to solve this and the first solution (and worst) I came up was simply to implement a folder structure which essentially mapped a Try tree to disk. Not my smartest idea, but hey we got a FUSE based file system to work. However, after a while I started to consider if could avoid my problems by avoiding the file system all together.
The answer to this is yes, yes you can and it is surprisingly easy.
All you need is!
Is a raw block device.
What is this then?
Basically a raw block device is any device that does not have a file system to manage the data on it.
To keep it simple it is disk partitions that has not been formatted with a file system, an entire disk or in the *NIX Virtual device such as /dev/null
.
You will need knowledge of pwrite
and pread
(or read
/write
or fread
/fwrite
), I will get into why I prefer the p
versions later.
These two functions can be untilised by including the unistd.h
header.
Oh and you need a file descriptor to the device.
Let us start by looking at pread
and pwrite
(see code below).
Both take the same parameters as an input, a file descriptor fd
, a data buffer buf
which in the case of pwrite
is const to indicate it is not changed, a byte counter count
indicating how many bytes should be read/written, and an offset from/to where data should be read/written.
A note, the file descriptor must be capable of seeking.
The return value is the number of bytes read/written can be compared to count
For pwrite
0 indicates nothing was written or end of file (EOF) in the case of pread
.
If -1 is returned and error has occurred and we can use errno
to check what error it is.
ssize_t pread(int fd, void *buf, size_t count, off_t offset);
ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
From this we can create a fairly simple example. /WARNING/: DO NOT RUN THIS EXAMPLE UNLESS YOU ADAPT IT TO A DEVICE WHERE YOU DO NOT MIND LOSING THE DATA!
#include <fcntl.h> // Opening files and related flags
#include <unistd.h> // pread and pwrite
#include <string.h> // strcmp
#include <stdio.h> // prints
int main(void)
{
const char *device = "/dev/sda";
const char *data = "Hello world!";
const size_t data_length = 12;
const off_t offset = 0;
int fd = open(device, O_RDWR); // Opens file descriptor in READ/WRITE mode
if (fd == -1) {
perror("Error opening Device");
return 1;
}
ssize_t bytes_written = pwrite(fd, data, data_length, offset);
if (bytes_written == -1) {
perror("Error writing data");
}
else {
char data_out[data_length];
bytes_written = pread(fd, data_out, data_length, offset);
if (bytes_written == -1) {
perror("Error Reading Data");
} else {
const int result_of_compare = strcmp(data, data_out);
printf("It is the same data: %s", result_of_compare == 0 ? "True" : "False");
}
}
close(fd);
return 0;
}
Based on this example you should be able to see a few issues when reading and writing without a file system.
First, where is the data or where should I put it?
Let us say I run this code again, but with the data
being I love hamburgers
and data_length
being 17
.
Then we will write over the Hello World
on disk.
But how do we know it is there?
Well, we do not and we never will, unless we keep a record of it.
Secondly, how do we know how much data to read?
Let us say that the our write and read happens at two different points in time, how do we know how much data to read?
Well, we do not and we never will, unless we keep a record of it.
So we need to keep a record of both, which essentially is the beginning of a file system…
But still we can read and write without a file system.
Now why do I prefer pread
and pwrite
over read/write
and fread/fwrite
.
Well frankly, I just prefer the way I can provide an offset and then “magic” happens behind the seen doing the seek
operations for me.
But I know purist who prefer read
and write
for the opposite reason and that is fair enough.
Anyways now you can write to disk like a pro.
For the love of all gods and demons be careful.
./Lars
Apps for macOS I cannot live without?
A while back I made these two blog posts “Why I prefer physcial notebooks over software-based” and “Writing my notes by hand”. This resulted in me getting a few emails about note Apps I should try for both mac and Linux which totally would get me to drop the physical notebook. Well it has not, I tried Notion for Notes & Docs but it simply is not me. Honestly, I still prefer Emacs with org-mode if I have to take notes on a computer. Now, I actually also got some questions about what applications do I use and mainly I was asked for macOS. So I this bog post I will cover which Apps I cannot live without on macOS and later I will make a similar post for Linux. So let us get started!
Emacs
Emacs is my drug of choice and by the application I use the most. Not just on macOS but also on Linux. Although it is an old text editor, it can be modernised quite a lot through modifications and plugins. I use it for writing blog post for this blog, writing my books, coding, note taking using org-mode and more. It is my multi-tool and I love it.
I will ammend here that the learning curve is quite steep and I might not recommend vanilla Emacs to most people. There are alternatives such as doomeacs which suites modern people a lot more. Although I have not made that leap yet myself… I have actually considered setting up a virtual machine and testing how much I like it.
Apple Pages
For the rare occasion where I need something written which I need in .docx format I do not use Microsoft Word, I use Apple Pages. But why do I use Pages over let us say OpenOffice, LibreOffice, or ONLYOFFICE. Well first of all! I honestly dislike Microsoft Words user interface. I find it very confusing and very unintuitive, which from the get go removes ONLYOFFICE. Then there is {Open,Libre}Office and while LibreOffice is my go to on Linux, I find it really unstable on macOS doing some very weird things from time to time. But, that is not the only reasons I use Pages. I also use Pages because:
- The UI is simply
- It does what I need
- It is stable
- I have iCloud sync between my personal devices (even my Linux machine(s))
- The online editor when I need it is reasonably good, and miles a head of Google Docs and Office 365.
It is a solid what you see is what you get editor and it never surprises me which I really, really like. Here I particular scowl at Microsoft Word and OpenOffice.
Apple Music
I do not understand the hatred people have towards this application. Did I prefer it when it was called iTunes and the layout was less website like… YES! But do I hate it? No! Apple Music lets me listen to my music and that is really all I want from it. I only really use the Apple curated play lists I do not use custom play lists so much… Yet.
Additionally, I love the automatic synchronisation between my phone, tablet, and computers. Side note here! For the blog post on Linux applications I will talk about Cider which I use to listen to Apple Music on Linux.
Things
I am a todo alcoholic and I have been a heavy user of Apple Reminders and I love it. However, I need a more sophisticated app with some feature in terms of note taking for a todo in the todo app. Enter Things. I had been eyeing this app for quite a while and people promised it would beat Apple Reminders by miles and quite honestly it does. The organisation of projects and areas are unparalleled compared to any app I have tried both on Linux and Mac. I was lucky to get it for iPad, macOS, and iPhone last year at black Friday and I have not regretted buying the App.
So that is the apps I cannot live with out.
./Lars
Difference of opinion is okay!
I have thought long about whether or not I should publish this particular piece of writing. Mainly because I cannot foresee the consequence. Which ironically is one of the reasons I wanted to write it in the first place. So let us see what happens.
Also this is a work in progress I will probably reiterate this post many, many times as I give it more thought.
I was born in 1989 which means I got to grow up in the nineties and beginning of the new millennium. It means that by the time I turned twenty, I had experienced the mobile phone and internet become mainstream. I watch opinion providers going from being experts on TV, on the radio, or in papers, to be whomever wanted to shouter their opinion out on the internet. I saw this rice of the comment section on news articles, the hatred it sparked, the rudeness, the unkindness, in particular to people of a different opinion. I witnessed the rise of the opinion influence, with this I mean those influence whom provide opinion on any topic be it political or not. And honestly it frightens me what I have witnessed and what it has become. It frightens me because the nuance of debate has been lost. I has become us versus them and they need to disappear
Enter almost any subreddit (for the uninitialised subforum) on Reddit and you will at minimum see one active “debate”. Where people are throwing slurs at one another because mentality “your dumb arse is wrong and I am write” is strong. Go to Facebook and read the comment track for a news article and see the anger and hate, even if people did not read the article. It is insane. But what is even worse, no one really debate. People stand first on their own opinion with no desire to even try and understand the other side. From arguing about if pineapple on Pizza is sacrilegious, to which band it better, to which political direction is better. No one wants to give up on their opinion and their, in lack of better words, right to be right.
We have become unable to see the side of an opponent. To see that their may be some truth in what the opponent say. It is a lost skill. I have heard and read in many places that this in part can be blamed on information warfare from Russia, China, and other adversaries of the west. But can it really? I have not actually seen a fully convincing argument for it being the sole reason. Others argue that it is the media, their click bait, the dividing stories. But is it? I would argue, no. The reason is that whilst the news do bring these stories that polarise, they do so because it is the once we read and interact with. With todays need for likes, clicks, and interactions, who can blame them? Would you pay for a media that do not do this? I know I want to but right now I do not. For instance I know Zetland exists, an amazing danish news outlet. But do I subscribe… No. Instead I subscribe to a none local news outlet, the New York Times and mainly due to their book and tech sections, not the news. But I should reconsider.
Therefore we should relearn that difference of opinion is okay. We should relearn to accept the opinions of others. We should relearn to evaluate our own opinions. It is a must.
./Lars