RSSAmplifier

Blog

Tomas Vik

Recent content on Tomas Vik

blog.viktomas.comRSS feed ↗166 posts

Latest posts

Neovim native, built-in, LSP autocomplete

You don’t need nvim-cmp , coq_nvim , blink.cmp , or any of the other autocomplete plugins. Neovim supports LSP autocompletion without extra plugins, and this short post will show you how. If you are only looking for the standard autocompletion offered by your Language Server, you can leverage the built-in lsp-completion . Three easy steps Step 1: set completeopt Set the complete option to…

The books I did not finish in 2024

I like to finish books that I start, but it’s not always possible. In this post, I share a few books I started reading but didn’t finish last year. Some of them just weren’t good, others did not match my expectations. A good tell that the book is not good for me is that I stop reading in the evenings and instead do something else like watch TV or play games. When that goes on for…

Ray Dalio - Principles: Life and Work

Goodreads My rating: ★★★★☆ (85%) Ray Dalio is a successful investor who wrote a book about how should you live your life. I’ve only read the personal life section of the book which amounts to roughly a third. I skipped Dalio’s autobiography and principles for work since those seemed geared more toward founders/owners of a business. These are four ideas that seemed the most interesting…

Frederick Douglass - Narrative of the Life of Frederick Douglass

Goodreads Download (It’s in the public domain) My rating: ★★★★☆ (80%) Frederick Douglass shares his life story. He was born as a slave and managed to escape slavery. This is a short book but very touching. Douglass experienced unimaginable hardships but wrote about them with calmness and eloquence. He escaped at age twenty and was twenty-seven when he published the narrative. This is the…

William B. Irvine - A Guide to the Good Life

Goodreads My rating: ★★★☆☆ (60%) Irvine takes the Stoic teachings and transforms them into an accessible self-help book. The book’s greatest strength is how it distils the teachings into several practical exercises. Here are three key exercises that, when practised daily, can make you more joyful: Exercise 1: Negative Visualization It’s human nature to always want more. We rarely stay…

Rob Fitzpatrick - The Mom Test

Goodreads My rating: ★★★★★ (95%) TL;DR: Read “The Mom Test” if you’re creating a product and need to talk to customers or if you want to get better at getting unbiased facts from people. “The Mom Test” is a concise guide on how to talk to potential customers and discover if your product solves their needs. Key idea: Don’t discuss your idea. Talk about their…

Atul Gawande - The Checklist Manifesto

Goodreads My rating: ★★★★☆ (75%) This book answers the age-old question: Can you write a whole book about something as trivial as checklists? As it turns out, you can, and to my surprise, it was a fun read. I got this book recommendation from a YouTube video Find Business Ideas Customers ACTUALLY Want 💡 Josh Kaufman . I use checklists extensively and I’ve read about them in Charles T.…

Circular Dependencies in JavaScript Explained

Wide-eyed, I stared at undefined . It shouldn’t have been there. It was meant to be a string, defined as export const val = 'abc' and imported as import {val} from './my-module' . Yet, it was undefined . No amount of deleting node_modules , restarting my computer, or logging could fix it. val remained stubbornly undefined . But why? Sometimes you enjoy the flexibility of…

Jornad Mechner - The Making of Prince of Persia

Goodreads My rating: ★★★☆☆ (60%) Jordan deserves kudos for publishing an unfiltered journal from his early twenties without censoring it. It’s a brave move. The engaging nature of Jordan’s writing style Jordan’s writing impressed me and I’ll adjust my journaling style after reading this book. That’s the main reason you should read the book: To see how engaging a…

James Gleick - Isaac Newton

Goodreads My rating: ★★☆☆☆ (40%) I wanted to read Newton’s biography because I’ve listened to a lecture about him and realized I know little about how Newton made his scientific discoveries. It’s a hard read This book helped me, but it was disappointing how hard it was to read it. It tried to be poetic with a heavy citation of resources from Newton’s age. This gave the book…

TypeScript Dependency Injection using ES Decorators

This post shows how to create a dependency injection (DI) mini-framework using the new ES decorators . Most TypeScript DI frameworks use the legacy TypeScript experimental decorators. This feature likely won’t leave the experimental stage. TypeScript now uses the ES decorator standard by default. Now is the time to use the new standard. esbuild recently added decorator support, so if your…

Example of whitespace-sensitive TreeSitter grammar

In this short post, I’ll explain how to parse nested single-line markdown blocks into an AST using TreeSitter. The whole grammar is 18 lines of JavaScript and 127 lines of C. The final grammar will be able to parse this text: - one - two - three - four - five into this AST: (document ( block (block_start) (block_content) ( block (block_start) (block_content) ( block (block_start)…

Tiago Forte - Building a Second Brain

Goodreads My rating: ★★★★☆ (90%) This book changed the way I think about note-taking. I can’t recommend it enough. In this review, I’ll explain the book’s main two ideas. TL;DR Zettlekasten makes you spend too much energy upfront when consuming content. The second brain method lets you spend that energy later and only if needed. Putting verbatim highlights in your notes is fine.…

How will you sell the thing you just bought: A strategy for smarter shopping

I’ve bought a Samsung LCD ultra-wide monitor “34” Samsung Ultra-Wide monitor C34H890, for roughly $350. I was super happy with the choice and the screen’s look. I found a new screen still for sale for double the price so I messaged the guy, but I wasn’t lowballing too much. By then, I already saw myself having the screen in my study. The guy accepted my $15 less offer…

Skip GitLab CI jobs in forks

In this post, you will learn one approach to disabling jobs on forked projects. This approach only works on GitLab Premium or Ultimate. If you are in a rush, check the “Final Condition” section. Recently, I had to solve an issue at work: we have E2E tests running in our CI pipeline. These jobs need secrets. The secrets are stored in our CI/CD config as environmental variables. All…

Martin Gurri - The Revolt of the Public

Goodreads My rating: ★☆☆☆☆ (10%) This book disappointed me. I’ve read only about a quarter, and I stopped. Martin’s writing is what I’d call “Trying to impress my English teacher” style. The ideas conveyed in this book were as hard to understand as the language. TL;DR Once the elite (government, rich people) lost the monopoly on how the information is shared, people…

J. Storrs Hall - Where Is My Flying Car?: A Memoir of Future Past

OpenLibrary My rating: ★★★★★ (95%) Interesting review: Where Is My Flying Car? | Bayesian Investor Blog TL;DR This is one of the most eye opening books I’ve read (the other that comes to mind is Harari’s Sapiens). You need to take many parts with a heavy nugget of salt. When there is an ambiguous topic (e.g. radiation impact on cancer) Josh takes an authoritative stance to one extreme.…

Charles T. Munger, Peter D. Kaufman - Poor Charlie's Almanack

OpenLibrary My rating: ★★★★☆ (85%) Following is an assorted list of notes I made during reading the book. I wish I had something like this before I read it so that I could beforehand decide what areas of the book are most interesting to me and pay attention accordingly. Mental models: Inversion - change the question and instead of asking how to reach great outcome, ask how to reach the worst…

David Grann - The Wager A Tale of Shipwreck

OpenLibrary My rating: ★★★★☆ (80%) David Grann pieces together mid-seventeenth century story of a British warship wrecked at the coast of Patagonia. I recommend reading this book if you are interested in getting a peak into the way of living over a quarter of a millennium ago, way before Britain became the worldwide power it was a century or two later. You get an idea about how the low sailors…

M. Mitchell Waldrop - The Dream Machine

OpenLibrary My rating: ★★★☆☆ (60%) This book offers an incredibly detailed history of computing, weaving a narrative through the lens of J.C.R Licklider. Waldrop explains everything from the beginning of computers (analogue computers like Vannevar Bush’s Differential analyzer) to “modern” microchip-based computers of the 1980s. For someone who started using computers in the late…

Isaac Asimov - Second Foundation

OpenLibrary Released in 1953, this is the last book of the original Foundation trilogy. It is OK, but it is also very similar in style with the previous two books. I’m not planning on reading the rest of the Foundation books.

Isaac Asimov - Foundation and Empire

OpenLibrary Released a year after the first book (1952), this novel follows the story of an established foundation planet and it’s struggles in the galaxy.

Isaac Asimov - Foundation

OpenLibrary First released in 1951, the Foundation novel describes a story of declining galactic empire and one man’s personal mission to soften the fall.

Neovim - Make LSP Workspace Symbols show only workspace symbols

I copied Helix’s key mappings for showing LSP symbols. I map space + s to show buffer symbols and space + S to show workspace symbols. For showing the workspace symbols I use Telescope’s builtin.lsp_workspace_symbols picker . But when I press space + S , I get all the symbols from all dependencies. The default gopls behaviour is to show you all available symbols, not the symbols from…

Neovim LSP rename like a boss (with normal mode keymaps)

TL;DR : If you want to use normal keybindings when LSP-renaming symbols in Neovim, use my config snippet below. You set up your Neovim with LSP. You set up the neovim/nvim-lspconfig plugin and map space + r to the LSP rename ( vim.keymap.set("n", "<leader>r", vim.lsp.buf.rename) ). Now you are ready. But when you press space + r , instead of seeing an in-place popup like you&rsquo;d see in the VS…

New lines and terminals: CR vs. LF

I&rsquo;m building a terminal emulator in go: gritty . I noticed that /bin/sh is sending me the ASCII CR character back as a part of the response. I tend to absolutely ignore the CR because in my mind it&rsquo;s a &ldquo;Windows thing&rdquo;. But seeing the CR made me realise that I don&rsquo;t have a clear idea about how new lines work. In my mind, new line = \n but it might be more complex than…

Backup

To see how I arrived at this process, go to Designing my backup process Data classification I have to classify data to four categories: absolute backup - backed up to a device in my apartment and device outside of my apartment this is data that is personal and if I loose it, it&rsquo;s lost forever with no chance of retrieval pictures, personal documents home backup - backed up to my nas this is…

Fish shell has different PATH than neovim

TL;DR: neovim triggers shell commands in a non-interactive subshell that is initialised from scratch from your fish.confg (or other shell setup script). Ensure you set the $PATH the same way for both the interactive and the non-interactive shell. Today, I found a strange thing. I added a yaml formatter to my neovim config (I use mhartington/formatter.nvim ). The formatter runs python3 -m pyaml to…

Designing my backup process

This page describes how I designed my current Backup process. This design phase started on [[2023-08-05]] Situation at [[2023-08-05]] So far, I&rsquo;ve got my files placed in several places: Home NAS Phone Computer Server Next Cloud ( Hetzner Storage Share ) External drives Some have the files directly on NTFS Some use restic I came up with a data classification that is in the Backup process.…

James S.A. Corey - Leviathan Falls

OpenLibrary

James S.A. Corey - Tiamat&#39;s Wrath

OpenLibrary

James S.A. Corey - Persepolis Rising

{:height 508, :width 324} OpenLibrary

James S.A. Corey - Babylon&#39;s Ashes

OpenLibrary Another twenty hours of listening to the audiobook, another story of our solar system changed by the proto-molecule. This time we follow a story of recovery from a planet-wide terrorist attack that happened in Nemesis Games . The previous books I read from this series are James S.A. Corey - Leviathan Wakes James S.A. Corey - Caliban&rsquo;s War James S.A. Corey - Abaddon&rsquo;s Gate…

Simulate kubernetes pod resisting shutdown

This is a short post about kubernetes pod lifecycle, namely terminating a pod. When kubernetes shuts down a pod it will: Send SIGTERM signal to the container process wait for the grace period (default is 30s) Send SIGKILL signal to the process When a Pod is being deleted, it is shown as Terminating by some kubectl commands. This Terminating status is not one of the Pod phases. A Pod is granted a…

Trying to understand the impact of Fukushima Daiichi nuclear accident

In books/J. Storrs Hall - Where Is My Flying Car , the author ( Josh ) discusses at length the overblown risks of nuclear energy. The argument could be summed up as &ldquo; ionising radiation is much less dangerous than the mainstream opinion &rdquo;. I do believe that [[Scary ideas live longer]], and so it would be in line with my mental model if the public gets scared into making…

James S.A. Corey - Nemesis Games

OpenLibrary Nemesis Games will give you insight into the personal history of Rocinante&rsquo;s crew. And it will also manage to kill many, many, many people in the process. The previous books I read from this series are James S.A. Corey - Leviathan Wakes James S.A. Corey - Caliban&rsquo;s War James S.A. Corey - Abaddon&rsquo;s Gate James S.A. Corey - Cibola Burn

James S.A. Corey - Cibola Burn

OpenLibrary Cibola Burn is the fourth book of The Expanse series. I can&rsquo;t believe I&rsquo;ve already listened to this series for eighty hours. It&rsquo;s still good fun. I&rsquo;ve grown to like the crew of Rocinante similarly as I like the watch from Pratchett&rsquo;s Discworld. This book describes exploration of an Earth-like world in a different solar system in our galaxy. The previous…

How much energy do you need to boil a litre of water

longform: true My wife likes to boil water. It&rsquo;s a kind of a hobby of hers. She boils a litre of water to make a cup of tea. On the other hand, I see the electricity meter spin every time I turn on the induction stove. I made boiling the right amount of water into a game. Can I get the amount exactly right? But does this matter? What difference does it make if you boil more water than you…

James S.A. Corey - Abaddon&#39;s Gate

OpenLibrary Abaddon&rsquo;s Gate is the third book of the Expanse series. A mysterious portal to another part of the universe has been opened in our solar system. Listen to this twenty-hour book to find out what&rsquo;s on the other side. At the risk of repeating myself, I really enjoyed listening to this story for twenty hours. The book&rsquo;s authors again use the literary style of narrating…

Randall Munroe - What if? 2

OpenLibrary Same as How To and What if this book was an entertaining read. I wish I had physics so internalised as Randall so I could make back of a napkin, rough order of magnitude calculations as he does. I recommend reading all Randall&rsquo;s books for the entertainment value. I don&rsquo;t have hopes of remembering the physics.

Fixing goreleaser error: failed to publish artifacts .. already_exists

TL;DR: If you have the same issue as I did, then you are not restricting the goreleaser action to tags, and you trigger the same release from the main branch and the git tag. Today I tried to release a new version of godu and the release action failed 💥. ⨯ release failed after 2m18s error=scm releases: failed to publish artifacts: failed to upload godu_1.4.0_Linux_arm64.tar.gz after 1 tries: POST…

James S.A. Corey - Caliban&#39;s War

Caliban&rsquo;s War is the second book of the Expanse series. Another twenty hours of listening to an entertaining story from our solar system. If you haven&rsquo;t read James S.A. Corey - Leviathan Wakes , definitely start with that, otherwise the events in Caliban&rsquo;s war won&rsquo;t make as much sense. After you finish reading (or listening to) James S.A. Corey - Leviathan Wakes ,…

James S.A. Corey - Leviathan Wakes

Realistic sci-fi is the best genre of literature, right after comedy fantasy/sci-fi. I love when the rules of the universe (think gravity, space travel, technology) are close enough to our age that it&rsquo;s not just hand-waving &ldquo;magic&rdquo; like teleports and warp drives. Technology is more fun when I can imagine it existing if we just improved the existing X by 100%. Realism is one of…

Pratchett, Gaiman - Good Omens

OpenLibrary This is pure Britishness in a book, packed with humour and funny phrasing to the brim. The only drawback for a non-native speaker is the huge vocabulary. I was lucky to listen to this book as an audiobook, so I could guess the meaning of many words from the context. The audiobook was the &ldquo;Good Omens A Full Cast Production&rdquo; version. It took me over a month to get through…

Go: range is like a function call

When I watched Ultimate Go Programming today, I learned about an unintuitive Go programming language behaviour. I&rsquo;m going to show you. Have a look at the following code and tell me what will be printed in the console: arr := [...] string { 'Hello' , 'you' , 'handsome' , 'person' } fmt.Printf( 'before: %q\n' , arr[1]) for i, v := range arr { // at the very first iteration we change second…

I wrote a command line tool to export Logseq pages as blog posts

I&rsquo;ve got an exciting little program to share with you. It&rsquo;s a command line utility that exports your public Logseq pages into Markdown blog posts compatible with most of the static-site generators. All you have to do is write your post in Logseq, run the logseq-extractor command with a few parameters and your blog has got the latest version of your post, ready for publishing. Two weeks…

Andy Weir - Martian

OpenLibrary Andy Weir does not disappoint with his realistic sci-fi. I&rsquo;ve read Project Hail Mary and I&rsquo;ve seen the movie before listening to this book. My expectations were high, and Martian met them but not surpassed them. When you read this book, you&rsquo;ll witness a sci-fi adventure in the near future. Humanity sends its third mission to Mars, and you get to follow a birlliant and…

Go

Code Review [[Templ]] Learning resources: Concurrency in Go Ultimate Go Programming, Second Edition Learning Go Learn Go with Tests - TDD exercises 100 Go Mistakes and How to Avoid Them Setup $GOROOT - where your SDK is $GOPATH - where your go src , pkg , and bin live Modules got mod init gitlab.com/viktomas/{name} go mod init creates a new module, initializing the go.mod file that describes it.…

Blake Crouch - Dark Matter

I found this book on a random book recommendation list on the internet: Cora&rsquo;s Goodreads Sci-Fi list . This list contains several books I read and liked. I read Recursion from Crouch last year and this book has got a similar feel to it. These books reuse several ideas, and the novels&rsquo; style (false memory) is identical at the start. If you want to pick up only one of these books, I…

Go/Code Review

CodeReviewComments · golang/go Wiki Go standards and style guidelines | GitLab Security: Remember to run SAST and Dependency Scanning on your project (or at least the gosec analyzer ), and to follow our Security requirements . Run the goimports command Don&rsquo;t accept maps as input or return maps as a part of your Public API (Joe Bonder, Learning Go, Pointers) You don&rsquo;t know what the keys…