diff options
author | mms <michal@sapka.me> | 2024-04-10 22:08:41 +0200 |
---|---|---|
committer | mms <michal@sapka.me> | 2024-04-10 22:08:41 +0200 |
commit | 3f7488846906dce323f89bb44703cd4a2c7565cc (patch) | |
tree | ac7f5bdd1884f384934b56bebebb65eb57c4e9ae /content/blog/2023 | |
parent | 678093d4e186bd839a9c1d802ea88233bd192aeb (diff) |
feat: nameplate and more composition
Diffstat (limited to 'content/blog/2023')
-rw-r--r-- | content/blog/2023/108.md | 10 | ||||
-rw-r--r-- | content/blog/2023/a-meme-site.md | 13 | ||||
-rw-r--r-- | content/blog/2023/a-new-layout.md | 16 | ||||
-rw-r--r-- | content/blog/2023/a-site-about-nothing.md | 12 | ||||
-rw-r--r-- | content/blog/2023/an-entire-month-of-posts.md | 12 | ||||
-rw-r--r-- | content/blog/2023/blog.md | 19 | ||||
-rw-r--r-- | content/blog/2023/bsd-section.md | 16 | ||||
-rw-r--r-- | content/blog/2023/ch-ch-changes.md | 34 | ||||
-rw-r--r-- | content/blog/2023/fixing-ipv6-and-securing-the-domain.md | 19 | ||||
-rw-r--r-- | content/blog/2023/follow-this-blog-on-twitter.md | 11 | ||||
-rw-r--r-- | content/blog/2023/i-now-host-my-own-code.md | 34 | ||||
-rw-r--r-- | content/blog/2023/new-domain-bsd-and-sayonara-memes.md | 30 | ||||
-rw-r--r-- | content/blog/2023/now-served-from-ipv6.md | 10 | ||||
-rw-r--r-- | content/blog/2023/openbsd-74.md | 17 | ||||
-rw-r--r-- | content/blog/2023/removed-plausible.md | 24 | ||||
-rw-r--r-- | content/blog/2023/statistics-are-now-public.md | 11 | ||||
-rw-r--r-- | content/blog/2023/this-blog-is-ai-free.md | 23 | ||||
-rw-r--r-- | content/blog/2023/this-site-no-longer-spies-for-youtube.md | 70 |
18 files changed, 381 insertions, 0 deletions
diff --git a/content/blog/2023/108.md b/content/blog/2023/108.md new file mode 100644 index 0000000..97be0c3 --- /dev/null +++ b/content/blog/2023/108.md @@ -0,0 +1,10 @@ +--- +title: "#108" +categories: +- blog +abstract: a pointless number +date: 2023-04-06T22:07:14+02:00 +draft: false +--- +I missed my 100th post on this blog, so here's the 108! Woohooo! + diff --git a/content/blog/2023/a-meme-site.md b/content/blog/2023/a-meme-site.md new file mode 100644 index 0000000..01d0319 --- /dev/null +++ b/content/blog/2023/a-meme-site.md @@ -0,0 +1,13 @@ +--- +title: "A Meme Site" +categories: +- blog +absract: I created a meme site. +date: 2023-01-10T17:32:12+01:00 +draft: false +--- +After years of fighting, I have succumbed to the Meme Game. I even have a dedicated site now. + +You can see it under [REDACTED] + +update: the site is no more diff --git a/content/blog/2023/a-new-layout.md b/content/blog/2023/a-new-layout.md new file mode 100644 index 0000000..d672a03 --- /dev/null +++ b/content/blog/2023/a-new-layout.md @@ -0,0 +1,16 @@ +--- +title: "A New Layout" +categories: +- blog +abstract: The fourth look and feel for the site +date: 2023-03-09T09:05:38+01:00 +draft: false +--- +{{<img-pull-right "version-4.png" "For future generations">}} +Iteratively, I've changed how the site looks over the last few weeks. I wanted it to remind me of sites I've grown with, so: no modal windows, no huge fonts, and no mobile-first approach. I am quite satisfied with what I have here now. It's modern and supports dark mode ([sorry for flash banging!](https://github.com/npmaile/blog/blob/main/posts/flashbang.md)), yet no JS is required. No React in site :-). And no hamburger, which is always a nice thing not to have. What it does have are actual columns on wider displays. + +The code also seems to be a [valid HTML](https://validator.w3.org/nu/?doc=https%3A%2F%2Fd-s.sh%2F), which is nice. + +I hope it doesn't look **too** much like [Ruben's blog](https://rubenerd.com/), but it was a huge inspiration. Not only for the look but also for what I post it. + +This is the fourth layout this site use. Luckily, there are now more posts than layouts. diff --git a/content/blog/2023/a-site-about-nothing.md b/content/blog/2023/a-site-about-nothing.md new file mode 100644 index 0000000..d7fe4d0 --- /dev/null +++ b/content/blog/2023/a-site-about-nothing.md @@ -0,0 +1,12 @@ +--- +title: "A Site About Nothing" +categories: +- blog +abstract: It's an E/N now +date: 2023-03-26T08:20:12+01:00 +year: 2023 +draft: false +--- +The primary goal behind this incarnation of my website is to make it a personal place for the public. This site is not about engineering, food, anime, or Star Trek. Instead, I write about anything interesting to me at a given moment. Will this alienate readers? Maybe, but I don't want to treat blogging as personal-brand marketing or some other dirty word. I blog for the sake of blogging. + +Today I learned that there is a term for that: [E/N](http://sawv.org/en.html), which I've found on [Roy Tang's website](https://roytang.net/). diff --git a/content/blog/2023/an-entire-month-of-posts.md b/content/blog/2023/an-entire-month-of-posts.md new file mode 100644 index 0000000..7e7373c --- /dev/null +++ b/content/blog/2023/an-entire-month-of-posts.md @@ -0,0 +1,12 @@ +--- +title: "An Entire Month of Posts" +categories: +- blog +abstract: I've posted everyday for the last month! +date: 2023-02-17T13:05:32+01:00 +year: 2023 +draft: false +--- +One of my resolutions for 2023 was to [post here more](https://d-s.sh/2023/resolutions-for-2023/#increase-my-internet-presence). And here I am, mafter the first entire month of daily posts. I haven't missed a single day since the 16h of January. What I found to be the best mind tool is to ignore the broader picture. I don't think about who the blog is for, and I have no persona for the kind of person who would come here and read all my writings. I simply write about what interests me at the moment—the anti-content marketing way. Maybe I will find some returning visitors, or perhaps someone will e-mail me with some comments. But for now, just writing, just uploading every day, is cool enough. + +And as a bonus, the current emoji count is **0**. A number we all can strive for. diff --git a/content/blog/2023/blog.md b/content/blog/2023/blog.md new file mode 100644 index 0000000..606f033 --- /dev/null +++ b/content/blog/2023/blog.md @@ -0,0 +1,19 @@ +--- +title: "My Blog now has a Blog" +categories: + - blog +abstract: Blogs moved under Blog +date: 2023-12-05T22:17:05+01:00 +draft: false +--- +Another step in restructuring done: Bloggy posts are now under "blog" section. +I find it funny that the site now starts to resemble its first iteration, from way before I started thinking of it as a Blog. +All section share a layout, but a random internet adventurer interested in one particular subject can focus on this subject. +No need to dig through hundreds of posts. + +You can open The Blog under [/blog/](/blog). + +For my beloved RSS users: sorry for moving so many items earlier today. +I'm mostly done with the remodeling. +Just few more weeks. + diff --git a/content/blog/2023/bsd-section.md b/content/blog/2023/bsd-section.md new file mode 100644 index 0000000..0cff928 --- /dev/null +++ b/content/blog/2023/bsd-section.md @@ -0,0 +1,16 @@ +--- +title: "BSD Is Now a Section" +categories: + - blog +abstract: +date: 2023-11-28T22:17:05+01:00 +draft: false +--- +Following [StarTrek](/star-trek/updates/star-trek-is-now-a-subpage/), BSD now has its own section. +You can see it [here](/bsd/home/). + +I've rehashed old content, but this will expand soon - especially around using FreeBSD on my laptop. +The section won't be better than what [Vermaden](https://vermaden.wordpress.com/) does, but it will a cool little site. + +I have also changed top of the site :) + diff --git a/content/blog/2023/ch-ch-changes.md b/content/blog/2023/ch-ch-changes.md new file mode 100644 index 0000000..09d3ef5 --- /dev/null +++ b/content/blog/2023/ch-ch-changes.md @@ -0,0 +1,34 @@ +--- +title: "Ch-Ch-Changes" +categories: +- blog +abstract: Version 4.1? +date: 2023-05-10T11:05:20+02:00 +draft: false +--- +Hello, and welcome to yet another version of this site. Like any tech blogger, I spend almost as much time writing as I do tinkering with the site. + +The most significant difference in this incarnation of the blog is moving back to my old domain. The nickname was cool[^old-domain], but I am not controversial enough to hide my real name. All I write about here are computers, dead musicians, old TV shows, and anime. Therefore: hello, my name is Michał. [d-s.sh](d-s.sh) is now returning 301 redirects to [michal.sapka.me](michal.sapka.me). Come to think of it, this change is possible only because I own both domains and rent the server. I would be at someone else's mercy if I were using an external provider or social media site. +[^old-domain]: It had a nice [three months long run](/2023/new-domain-bsd-and-sayonara-memes/#new-domain). + +I have also changed how the site looks. It's only the first of many iterations that will be visible here soon, but the site already looks different. Nicer? I have no idea. I like it more now. This change was brought to you by adding footnotes[^footnotes] +[^footnotes]: There's a [clash of IDs if there is more than one post on a single page](/2023/footnotes-in-hugo-and-goldmark/#footnotes-in-hugo). + +It's simpler now and nicer to read while not being too brutalistic[^brutalist]. +[^brutalist]: As a Pole I love [brutalist architecture](https://en.wikipedia.org/wiki/Brutalist_architecture), but it can be too much. + +The next one is the least impacting now, but it will change the site for the better. Until now, I have been trying to keep an almost daily schedule. It was a nice run, and it allowed me to create content that makes this blog worthy of visiting. But it also hindered the quality. Some people can keep such a schedule while providing insightful posts very often[^ruben], but I am not one of them. The worst offender here is the urge to split a good post into multiple worse ones[^bsd-post]. But more often, the follow-up never materialized. Therefore, I will still post random small posts here, but I will make the bigger ones more compelling. +[^ruben]: [Ruben](https://rubenerd.com/) being a prime example. +[^bsd-post]: Like [this one](https://michal.sapka.me/2023/desktop-freebsd-wont-improve-unless-people-are-using-it/) and [this one](https://michal.sapka.me/2023/comments-on-desktop-freebsd-wont-improve-unless-people-are-using-it/). + +The last change, for now, is the emergence of categories. I looked at what I wrote and categorized it all. I consider a category the primary subject of an article, while tags are weaker links between different articles. What emerged from that are the primary subjects here: +- Emacs, as I am diving deeper and deeper here +- BSD, or rather my fight to use FreeBSD daily +- Engineering, with all other articles for computer programmers +- Star Trek, as I still have months and months of watching +- Computer History, as this something I am deeply interested in[^comp-hist] +[^comp-hist]: You can read [a dedicated article](https://michal.sapka.me/2023/computer-folks-ignore-history/) but know that there are dozens of us. Dozens! + +There are more categories, and I will update about page in the coming days. + +See you soon! diff --git a/content/blog/2023/fixing-ipv6-and-securing-the-domain.md b/content/blog/2023/fixing-ipv6-and-securing-the-domain.md new file mode 100644 index 0000000..ef00369 --- /dev/null +++ b/content/blog/2023/fixing-ipv6-and-securing-the-domain.md @@ -0,0 +1,19 @@ +--- +title: Fixing IPv6 and securing the domain +categories: +- blog +abstract: Mistakes were made +date: 2023-05-05T13:55:14+02:00 +year: 2023 +draft: false +--- +Ok, so [recent IPv6 enablement](/2023/now-served-from-ipv6/) didn't went smooth. Even though I've added the AAAA record and I was able to `ping6(8)` from my FreeBSD machine, I forgot about configuring the firewall. Sadly, I know very little about `pf.conf(5)`, so I used a [ready config](https://forums.FreeBSD.org/threads/ipv6-not-working-with-pf.66772/post-395165), changed the network interface, and added ssh. Voila, IPv6 works! Thanks for letting me know about this bug on my side, [Marco](https://twitter.com/marcodavids/status/1653862517309882369). + +Then I added [Domain Name System Security Extensions](https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions). It's a security mechanism that cryptographically secures against man-in-the-middle attacks on the DNS level. I've enabled it in Vultr and copy-pasted a few records to Namecheap. Voila, it works! + +The last thing I've added was proposed by [chr bre](https://twitter.com/chrbre/status/1654194363247804416) - [HTTP Strict Transport Security](https://pl.wikipedia.org/wiki/HTTP_Strict_Transport_Security). This tells the browser always to use HTTPS, effectively blocking usage of non-encrypted HTTP. All I was needed to do was to add a [header to NGINX config](https://www.nginx.com/blog/http-strict-transport-security-hsts-and-nginx/) for server listening on port 443. + +After some testing, I've added [preload](https://hstspreload.org/) to the header and submitted it to Google. This submission will add this site to a list preloaded in Chrome, and other browsers, removing the first non-encrypted fetch of data. Of course, if I break HTTPS here, the site will stop working but what the hell. + +I now have a 100% rating on [internet.nl](https://internet.nl/site/d-s.sh/2074274/), which is cool. + diff --git a/content/blog/2023/follow-this-blog-on-twitter.md b/content/blog/2023/follow-this-blog-on-twitter.md new file mode 100644 index 0000000..25e47bd --- /dev/null +++ b/content/blog/2023/follow-this-blog-on-twitter.md @@ -0,0 +1,11 @@ +--- +title: "Follow This Blog on Twitter" +categories: +- blog +abstract: You can now follow this blog on twtr! +date: 2023-03-15T19:24:02+01:00 +draft: false +--- +Twitter may be dying, but I've connected IFTT with this site and created a dedicated profile just for this blog. Let's see if it will be of any value to someone. + +[https://twitter.com/d_s_blog](https://twitter.com/d_s_blog) diff --git a/content/blog/2023/i-now-host-my-own-code.md b/content/blog/2023/i-now-host-my-own-code.md new file mode 100644 index 0000000..ef3e1ea --- /dev/null +++ b/content/blog/2023/i-now-host-my-own-code.md @@ -0,0 +1,34 @@ +--- +title: "I Now Host My Own Code" +categories: +- blog +abstract: Why I left Github. +year: 2023 +date: 2023-01-08T16:08:51+01:00 +draft: false +--- +tldr: you can go to [git.sapka.me](https://git.sapka.me). + +For years the first step towards every project was to create a GitHub repository. Rightfully so, as Github was the place for open source. They were years ahead of their competition when they launched. Heck, back then, git wasn't even the standard it is now. Time has changed. Microsoft bought them as another coy that would put them back in the minds of developers. + +Nowadays, Github is just another social network. Pull requests, issues, and all that following shenanigans puts you further from the code by showing all that social coys in your face. Some even consider (and I am guilty too) of thinking about GitHub as the de-facto resume. We have put ourselves at the recruiter's mercy. + +But the most significant cost of their hegemony is the transfer of code ownership. You may think that we still own everything you commit there. There are licenses! GPL! Well, ChatGPT may have clouded our memory, but just a few months ago, everything changed when Microsoft used this trust as a tool when they scanned the codebases to train their AI. Do we have any means to block them from doing it? Some even say that Microsoft ignored licenses and closed-source codebases were used. They have entirely breached trust. GitHub, a closed-source software owned by one of the biggest companies on Earth, used the good-heartedness of people worldwide for their own gain. No surprise that their AI will not be free - be it in a monetary or philosophical sense. + +There is GitLab. GitLab is cool, is open source, and is based in Ukraine. They offer superior products while being a much nicer company. The entire FOSS community should move there. At least as long as GitLab stays open-source. We must be vigilant of any company, as they tend to become maleficent. Google was one of the good guys just a few years ago! + +But I don't need all those shiny things that the big guys provide. Instead, I want to share my code. Everything else is extra and can easily be achieved on a small scale. Want a pull request? Just email me a diff. Issue? Hey, here's my email. Some pipeline? Since I own the server (aka "I have root access"), there is no problem with adding some hook with bash commands. + +Having your own Git server is extremely easy. One thing to keep in mind: GitHub has though us to think of Git as a centric system. We think of GitHub as a server and our machines as clients. But this is contrary to how Git works. There is no magical, turbo-important copy of the codebase. Every copy is as important as the other. We've given GitHub (and other providers) the master (main, or whatever we call it now) position. + +This view has lots of practical pluses. If we want to cooperate, we need to decide who has the source of the truth. But it also made it more difficult to challenge the status quo of GitHub. Why bother when everything is already there? + +But enough rambling. Setting it all up takes about 10 minutes. Just follow the [official guide](https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server). If you want to have a permissions layer, you can use [Gitosis](https://github.com/tv42/gitosis) or [Gitolite](https://github.com/sitaramc/gitolite). I don't. + +You may also want to have a web interface. Three solutions are very often recommended: +[Gitea](https://gitea.io/en-us/), which is a self-hosted GitHub +[CGit](https://git.zx2c4.com/cgit/), which I now use but am very Stagit-curious. +[Stagit](https://codemadness.org/stagit.html), for all the ultra-neckbeards out there. It's used by [Suckless software](https://git.suckless.org/). +CGit installation is also quite simple. Just follow the [guide](https://wiki.archlinux.org/title/cgit) on Arch Wiki. + +I will migrate all my repositories to [git.sapka.me](https://git.sapka.me) and treat GitHub as another company-mandated account. diff --git a/content/blog/2023/new-domain-bsd-and-sayonara-memes.md b/content/blog/2023/new-domain-bsd-and-sayonara-memes.md new file mode 100644 index 0000000..d1c0f3d --- /dev/null +++ b/content/blog/2023/new-domain-bsd-and-sayonara-memes.md @@ -0,0 +1,30 @@ +--- +title: "New Domain, BSD and Sayonara Memes!" +categories: +- blog +abstract: this site is now running on FreeBSD! +date: 2023-02-05T21:53:03+01:00 +draft: false +--- +It's technical Sunday. I have three updates for you. + +### New domain + +Having a name/surname domain was getting on my nerves. Now it's based on my IRC nick (d-s). I really like the TLD ".sh," so that's a bonus. + +### BSD-powered + +Since I am already changing domains, why not go all out? I have been curious about BSD for some time. [A coworker](https://se30.xyz/), +{{<img-pull-right "freebsd-beastie.png" "FreeBSD Bestie">}} +[a blogger](https://rubenerd.com), and [another blogger](https://vermaden.wordpress.com/2020/09/07/quare-freebsd/) has sold me BSD. So why not run on a server? So starting today, this site is powered by [FreeBSD](https://www.freebsd.org/) running on [Vultr](https://www.vultr.com/?ref=9354158-8H). Spinning the service took 5 minutes, and having the site running on it another 30. I am sure there will be downtimes soon, as I have never used BSD before sans MacOS. But the first impressions are great! Everything is logical, and the documentation is as good as everyone said. + +And FreeBSD has the cutest mascot ever! + +If my current impressions don't change, I'll likely move from GNU/Linux. + +Now, the migration is still ongoing. There's still the git server and SEO to manage. But the first step is entirely done. + +### Sayonara Memes + +This was a failed experiment. I like words, and I feel no joy from updating the site. For now, it's removed from the top menu, but I'll phase it out entirely soon. I am the type of person who sends emails in plain text and disables graphics from Slack. + diff --git a/content/blog/2023/now-served-from-ipv6.md b/content/blog/2023/now-served-from-ipv6.md new file mode 100644 index 0000000..7a8bb72 --- /dev/null +++ b/content/blog/2023/now-served-from-ipv6.md @@ -0,0 +1,10 @@ +--- +title: "Now Served From IPv6" +categories: +- blog +abstract: Added the missing AAAA record +date: 2023-05-03T19:47:30+02:00 +year: 2023 +draft: false +--- +A reader pointed out that this site wasn't using IPv6. So, with little fanfare, I've added the missing AAAA record. Hello from the future! diff --git a/content/blog/2023/openbsd-74.md b/content/blog/2023/openbsd-74.md new file mode 100644 index 0000000..1c9fc86 --- /dev/null +++ b/content/blog/2023/openbsd-74.md @@ -0,0 +1,17 @@ +--- +title: "Now on OpenBSD 7.4" +categories: +- blog +abstract: OS updated! +date: 2023-11-07T16:18:07+01:00 +draft: false +--- +Virtual server hosting this site is now running OpenBSD 7.4. + +``` +risa$ uname -a +OpenBSD risa.openbsd.amsterdam 7.4 GENERIC#1336 amd64 +``` + +Update went without any problems, just with a few minute long downtime. + diff --git a/content/blog/2023/removed-plausible.md b/content/blog/2023/removed-plausible.md new file mode 100644 index 0000000..e5c8c4b --- /dev/null +++ b/content/blog/2023/removed-plausible.md @@ -0,0 +1,24 @@ +--- +title: "Removed Plausible analytics" +categories: +- blog +abstract: I will know even less about you +date: 2023-11-10T22:18:07+01:00 +draft: false +--- +I have removed Plausible from this site. +I need even more tracking that it provides and not having to pay is always a plus. + +As a replacement I am moving to ploting statics from logs using rrdtool(1). +You can see the live version under [site info](/site/info). +It was fun mini-project, so there will be a guide posted soon and most likely more graphs. +Tinkering with site is its own reward! + +I am also remodeling the site via moving the webpages around. +This is preparation for future structure of this site. +The unfortunate side effect is a mess in RSS feeds, as Hugo assumes webpage URL as the identifier. +When I move a webpage, a new ID is used and the old post may be shown as new. +Sorry! + +I am moving pages category by category, so there won't be many changes in a day, but the entire change will take a few days. + diff --git a/content/blog/2023/statistics-are-now-public.md b/content/blog/2023/statistics-are-now-public.md new file mode 100644 index 0000000..d72b5ae --- /dev/null +++ b/content/blog/2023/statistics-are-now-public.md @@ -0,0 +1,11 @@ +--- +title: "Statistics Are Now Public" +categories: +- blog +abstract: this blog has open statistics for eveyone to marvel at +date: 2023-02-04T17:18:14+01:00 +draft: false +--- +I use Plausible here, a privacy-oriented alternative to Google Analytics. I want to know what you read and where you came from (even if the latter works poorly). I don't want to know who you are. + +One cool feature: I can make the statistics public. You can now go to [https://plausible.io/d-s.sh](https://plausible.io/d-s.sh) and see them if you are interested in how few people reach here :) diff --git a/content/blog/2023/this-blog-is-ai-free.md b/content/blog/2023/this-blog-is-ai-free.md new file mode 100644 index 0000000..a4cb6aa --- /dev/null +++ b/content/blog/2023/this-blog-is-ai-free.md @@ -0,0 +1,23 @@ +--- +title: "This Blog Is AI Free" +categories: +- blog +year: 2023 +abstract: No AI for me +date: 2023-01-30T13:12:28+01:00 +draft: false +--- +As Ars Technica's reader Unremarkable [comments](https://arstechnica.com/information-technology/2023/01/pivot-to-chatgpt-buzzfeed-preps-for-ai-written-content-while-cnet-fumbles/?comments=1&comments-page=1): + +> When we were promised an AI-riddled cyberpunk dystopia, it was at least supposed to include cyborg arms with machine gun mounts. What a ripoff. + +For the last few months, AI-generated content has been all the buzz. Images? AI. Code? Ai. Chats? Ai. And now articles. Buzzfeed, CNET, and others have already started or are about to begin publishing AI-generated content. We already see a lot of this. The top positions on all search engines are auto-generated nonsenses created in the depths of a server farm. And one thing that is the common denominator amongst all those texts? They are terrible, formulaic, and utterly not engaging. + +And why is that? They lack the human touch. Those are not written for humans but for algorithms. Our journalism was defeated by the expectation of free content (you won't guess what happened here!). One won't pay for actual journalism if a google ad pays for it. And what will happen if a 30usd/month subscription can write thousands of articles per day? + +**So this is my claim: this blog is written by a human. It's corrected by an ML model (Grammarly, I hate how much I love you), but all the content is written - not generated.** + +Now, who will create a search engine that is completely AI free? We are going the opposite way, and Bing, Google, and Baidu as sprinting who will be the first to serve people using a robot completely. This is the single most significant threat to the internet I have witnessed. Facebook tried, but this? This can actually murder the web. + + +For now, AI is still a parlor trick, but looking at how fast it is now growing, it will make a few people extremely rich and the rest of us miserable. Blogosphere to the rescue! diff --git a/content/blog/2023/this-site-no-longer-spies-for-youtube.md b/content/blog/2023/this-site-no-longer-spies-for-youtube.md new file mode 100644 index 0000000..9c0248f --- /dev/null +++ b/content/blog/2023/this-site-no-longer-spies-for-youtube.md @@ -0,0 +1,70 @@ +--- +title: "This Site No Longer Spies for Youtube" +categories: +- blog +abstract: Linking to YT in place of embeding is better for page load sped +date: 2023-02-02T14:58:42+01:00 +year: 2023 +draft: false +--- +This site no longer spies for google + +Say what you will about Youtube; it is the de facto webpage for video content. Unfortunately, there is much to say, primarily negative, but more on this later. Today I want to make this blog a bit better. + +Let's use [Google](https://pagespeed.web.dev/report?url=https%3A%2F%2Fmichal.sapka.me%2F2023%2Fcradle-of-filth-her-ghost-in-the-fog%2F) to analyze the performance of [one of my recent posts](/2023/cradle-of-filth-her-ghost-in-the-fog/). It's terrible. Not as awful as it would have been if I used a lot of JS, but it is terrible, nevertheless. + +Here are the findings. Notice a pattern? + +{{< img-center "23-gsa-opportunities.png" "Opportunities">}} + +{{< img-center "23-gsa-diagnostics.png" "Diagnostics">}} + +Yeah. I embed YouTube videos, and even Google says it's a bad idea. What adds insult to injury is [Privacy Badger](https://privacybadger.org) screaming at me on my own page. So yup, I have joined the botnet and spied for Google. + +There are two solutions: pretend that YouTube doesn't exist or fix it. Let's fix it. The idea: use hyperlinks with self-hosted thumbnails. Sounds simple. And it is simple. + +Step 1 - get all Youtube embeds. This site is powered by [Hugo](https://gohugo.io/), and all three embeds are done via a `youtube` shortcode. So, on posts, I add a + +``` +<youtube "video_id" > +``` + +Let's use GNU to get all video ids! + +``` +grep -r "<youtube" content/. | grep -o "\".*\"" | tr -d '"' | cut -d " " -f1 +``` + +Easy. Just a few steps: + +1. Find all files with youtube shortcodes in the content directory +2. Extract all ids by getting the first quoted text +3. grep for all quotations +4. remove quotes +5. get first words + +Now, how do we get the thumbnail? Stack Overflow to [the rescue](https://stackoverflow.com/a/2068371). We can fetch different sizes of thumbs directly from youtube. Let's use wget + +``` +wget --output-document "assets/ytcovers/$id.jpg" "https://img.youtube.com/vi/$id/hqdefault.jpg" +``` + +And voila, we can use thumbs to create proper links. One thing that needs to be added is a play button. Internet and [ImageMagick](https://imagemagick.org) to the rescue! I found some random PNG overlay with a play button on the web, but I can't find the URL. It was free for personal use, so yeah. W can easily compose the button over the thumb: + +``` + magick convert "assets/ytcovers/$id.jpg" "assets/partials/play-button.png" -gravity center -geometry 150x150+5+5 -composite "assets/ytcovers/$id.jpg" +``` + +So, we: + +1. convert the previously fetched cover, +2. by adding a play button, +3. the button is placed in the center of the cover, +4. the button is to be resized to 150x150 and moved by 5px to the right and bottom. +5. Lastly, we tell ImageMagick to compose those two and overwrite the cover + +And with this simple trick, this site is no longer a part of the botnet, and as an added bonus, it is faster. + +An example from [TJ Ferreira](https://www.youtube.com/@MacSociety): + +{{<youtube "7G00r5dZIJY" "I Changed My Mind About Amiga - Amiga OS - Amiga One X5000 - the whole platform">}} |