RSSAmplifier

Blog

Matteo Landi's .plan RSS

This is my log ... When I accomplish something, I write a * line that day. Whenever a bug / missing feature / idea is mentioned during the day and I don t fix it, I make a note of it and mark it with ? (some things get noted many times before they get fixed). Occasionally I go back through the old notes and mark with a + the things I have since fixed, and with a ~ the things I have since lost interest in. --- Matteo Landi

matteolandi.netRSS feed ↗602 posts

Latest posts

2026-05-13

TIL: you can use `tail` to `cat` multiple files together with a filename header for each. The enchantation: tail -n +1 file1.txt file2.txt file3.txt The output: ==> file1.txt <== <contents of file1.txt> ==> file2.txt <== <contents of file2.txt> ==> file3.txt <== <contents of file3.txt> Source: [SO - Concatenate multiple files but include filename as section…

2025-06-12

TIL: you can implement Vim-like `v:count` mappings in Tmux using `switch-client` From [GitHub](https://github.com/tmux-plugins/tmux-sessionist/pull/21#issuecomment-344241576): > Here s the example to create a t* key binding (I tested and confirmed it s working): > > tmux bind-key t switch-client -Ttable1 > tmux bind-key -Ttable1 * join-pane From my .tmux.conf: # Numeric prefixes a la vim bind 1…

2025-03-12

[Groups Never Admit Failure](https://nav.al/failure) > Groups never admit failure. A group would rather keep living in the mythology of “we were repressed” than ever admit failure. Individuals are the only ones who admit failure. Even individuals don’t like to admit failure, but eventually, they can be forced to. > > A group will never admit they were wrong. A group will never admit, “We made a…

2025-01-12

How to run Alacritty using OpenConsole.exe: 1. Get the latest Alacritty version 2. Copy the both "conpty.dll" and "OpenConsole.exe" from https://github.com/wez/wezterm/tree/main/assets/windows/conhost to Alacritty binaries dir (e.g., C:\Program Files\Alacritty) 3. Launch Alacritty That should finally give you mouse support! Source:…

2024-11-04

* [Setting to prevent matchparen from overriding the cursor highlighting](https://github.com/vim/vim/pull/15984)

2024-10-20

TIL: Google Chrome sync does not natively support setting different default fonts for different OSes! What if you want to use different default fonts on Mac OS and Windows with the same account? You have two options: 1. Inject custom JavaScript / CSS into each and every page, and override typography rules to match your taste 2. Switch from _full_ to _custom_ sync, and opt out of "Settings" sync…

2024-10-19

TIL: [Kamal](https://kamal-deploy.org/) "Assets Bridging", or "Old assets -> New container / New assets -> Old container" - When deploying a new version of the app, there will be a small window of time in which both the old and the new version of the app will be running at the same time, and the app proxy might forward requests to either one, randomly - What if the old version receives a request…

2024-07-24

* [Unyelding](https://blog.glyph.im/2014/02/unyielding.html) > ## The Problem with Threads > > ### Key Points: > - **Threads** (specifically shared-state multithreading) complicate local reasoning, which is essential for correct software development. > - **Local reasoning** allows understanding a routine s behavior by examining it in isolation, but threads require considering every possible…

2024-06-04

* quickutil: Add bunch of macros to _undefine_ stuff https://github.com/iamFIREcracker/quickutil/commit/0fb331356c5df6fae414d38b446aeab115699390

2024-06-03

* quickutil: LOOPING: generate only required labels https://github.com/iamFIREcracker/quickutil/commit/0f8c7abc18d1f1f85619dbe15ac99648981c0f27 (at one point I should give in and use ITERATE instead)

2024-04-28

* quickutil: Poor s man Clojure style threading macro https://github.com/iamFIREcracker/quickutil/commit/8205f8f04da6e218429cd08bc220b3280fe85aa6

2023-09-25

[The Musk Algorithm](https://world.hey.com/dhh/the-musk-algorithm-977bf312) > 1. **Question every requirement.** Each should come with the name of the person who made it. You should never accept that a requirement came from a department, such as from "the legal department" or "the safety department." You need to know the name of the real person who made that requirement. Then you should question…

2022-12-07

[You Should Be A Monster | Jordan Peterson Motivation](https://www.youtube.com/watch?v=-gYpCIbZjUQ) > part of Spiritual Development is to recognize the satanic tendencies that > characterize you and to fully wrestle with them and to and to integrate them > that s the thing it s it s not so much to cast them away it s to transmute them > you know and you can see the difference between people who ve…

2022-07-25

Prevent layout shifts when body becomes scrollable (The above notes were ripped from this nicely written post: [React: Preventing Layout Shifts When Body Becomes Scrollable](https://maxschmitt.me/posts/react-prevent-layout-shift-body-scrollable/)) Use [`scrollbar-gutter`](https://developer.mozilla.org/en-US/docs/Web/CSS/scrollbar-gutter). However, if Safari / iOS support is paramount for your…

2022-07-13

Sending keep-alive messages with Nest.js SSE keep-alive messages are usually implemented via _comments_, i.e. lines with a colon as first character ([MDN](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format)); unfortunately Nest does not seem to support this type of messages, and this forces us to get a hold of the current request object…

2022-07-12

Which of the `useEffect` dependencies was the one that triggered the effect? I was recently trying to understand why one of my effects was getting fired even though I _thought_ that none its dependencies had changed, but then after a little bit of debugging I realized that I was listing as dependency an object which was getting re-created every time the hook was run... The following homemade hook…

2022-06-09

More handy react-hooks `useEventSource`, a tiny wrapper around `EventSource` (for SSE): - The hook s signature matches exactly `EventSource` one - It returns the most recently received event / error import { useEffect, useState } from react ; type UseEventSourceReturn<T> = { data: T | undefined; error: Event | undefined; }; const useEventSource = <T>(url: string, init?: EventSourceInit):…

2022-06-08

Couple of useful react-hooks we have created at work, recently `useIntersectionObserver`, a tiny `IntersectionObserver` wrapper: - `node` is the `HTMLElement` to observe on - `opts` is the init params to pass to `IntersectionObserver` - `observedEntry` is the observed entry, as seen by `IntersectionObserver` import { useEffect, useState } from react ; const INTERSECTION_OBSERVER_INIT = { root:…

2022-04-29

? vim indentexpr that uses neoformat behind the scenese to figure out where the new line should go - similar to what my vim-lispindent plugin does ? vim netrw to automatically create the file **and** the parent directory, if missing

2022-04-26

[11 promises from a manager](https://twitter.com/MrEchs/status/1516024322409832450): > 1. We’ll have a weekly 1:1. I’ll never cancel this meeting, but you can cancel it whenever you like. It’s your time. > 2. Our 1:1 agenda will be in the meeting invite so we remember important topics. But you’re always free to use the time for whatever’s on your mind. > 3. When I schedule a meeting with you, I’ll…

2022-04-15

[How does React Suspense Work?](https://www.youtube.com/watch?v=onrMjAGY4qA) - You **throw a Promise** - React will catch that, wait for it to be fulfilled / rejected, and then call the render function again - The next time the render function is invoked, the promise s result is returned **syncrhonously** (i.e. no need to `await` for it) let resource = { user: wrapPromise(fetch(...)), }; function…

2022-04-13

TIL: you can pass `--not --remotes` to `git log` to get the list of local commits not present in any of the remotes - This was mentioned on [tpope/vim-fugitive] Large Unpulled section (Issue #1963), as a way to improve the information show while firing `:G`

2022-04-10

TIL: [vim-rhubarb](https://github.com/tpope/vim-rhubarb) supports GitHub issues, issue URLs, and collaborator omni-completion TIL: [Curl](http://curl.haxx.se/) supports reading secrets from .netrc --- Git s dotted Range Notations > The .. (two-dot) Range Notation > > The ^r1 r2 set operation appears so often that there is a shorthand for it. When you have two commits r1 and r2 (named according to…

2022-04-09

TIL: ECMAScript [bind operator proposal](https://github.com/tc39/proposal-bind-operator) - It introduces a new operator `::` which performs `this` binding and method extraction - In its binary form, the `::` operator creates a bound function such that the left hand side of the operator is bound as the `this` variable to the target function on the right hand side // before let hasOwnProp =…

2022-04-07

WTF: Since when am I using the ancient version of bash bundled within MacOS, and not `brew`s one? - default bash shell $ $BASH --version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin20) Copyright (C) 2007 Free Software Foundation, Inc. - brew s one $ $(brew --prefix)/bin/bash --version GNU bash, version 5.1.16(1)-release (x86_64-apple-darwin20.6.0) Copyright (C) 2020 Free Software…

2022-04-06

TIL: how to get a customizable entrypoint for a docker image - specify in the ENTRYPOINT, the base command only, e.g. `ENTRYPOINT ["node"]` - specify in the CMD, all the additional arguments to run the app, e.g. `CMD ["dist/main.js"]` - this way, a standard `docker run $image` would run: `node dist/main.js` - if you wanted to lunch a Node.js REPL instead: `docker run $image -` - if you wanted to…

2022-04-05

- is it possible to npm install a project with package-lock.json but without package.json? because that might speed up my docker builds a bit - say I add a new script to my package.json, but don t change anything else - ideally I would not want my CI/CD to re-download dependencies - re-building the it s fine, I guess, but re-downloading dependencies really seems like a waste of time, especially if…

2022-04-04

TIL: Replit.com just launched a @SearchEngine -- https://blog.replit.com/search - **We believe that you should be able to find anything on Replit in less than 30 seconds.** - First prototype created during what they internally call, the _hack week_ - It uses Elasticsearch - Plus a bunch of data-pipelines whose sole job is to take from the database (or other sources), convert it to a more…

2022-04-03

? @LiveProgramming with [LSX](https://github.com/fukamachi/lsx), and [parenscript](https://parenscript.common-lisp.dev/), and Websockets - Clients open a Websocket connection to the liveprogramming server, and everything they receive, they will `eval()` it - On the server we will have custom DEFUN, DEFVAR macros that would a) emit actual _JavaScript_ (this way you can save the output to a file,…

2022-04-02

TIL: You can stop `brew` from updating itself while `brew install`-ing something, by setting the following env variable: `HOMEBREW_NO_AUTO_UPDATE=1` TIL: In JavaScript, `>>> 0`, is an abuse of the operator to convert any numeric expression to an "integer" or non-numeric expression to zero. -- [SO](https://stackoverflow.com/a/11385688) * Always persist the @whiteboard at:…

2022-04-01

TIL: Vim landed native Language Server Protocol support! [vim/vim@9247a22](https://github.com/vim/vim/commit/9247a221ce7800c0ae1b3487112d314b8ab79f53) ? Give this new vim/lsp plugin a try: https://github.com/yegappan/lsp

2022-03-30

Interesting presentation from @DavidNolen on @live-programming a react-native application: [ClojureScript in the Age of TypeScript](https://www.youtube.com/watch?v=3HxVMGaiZbc) - Good analogy between a file-system, and a programs - You use a SHELL to interact with the file-system - You can change directory - You an see what s inside the current directory - You can create a new file in the current…

2022-03-29

TIL: CSS support the "parent selector", or as the [spec](https://drafts.csswg.org/selectors/#relational) calls it, "the relational pseudo-class" or simply `:has()` This could be used for form styling, e.g. styling labels differently, based on the validity of their inputs: form:has(input:invalid) { border: 2px solid red; } But I am sure somebody else would come up with more interesting use cases…

2022-03-28

[Programmable notes](https://maggieappleton.com/programmatic-notes) > Programmable notes are note-taking systems that allow you to write programmatic rules that facilitate particular ways of working with your notes. > > Based on triggers (specific conditions are met, input from the user, time of day), they kick off a sequence of actions. Actions might be prompts for the user to answer,…

2022-03-27

* @A Add "Welcome" dialog to @whiteboard - Quick overview of the existing functionalities, and on how to use it - "whiteboards are secret but not private" warning - "whiteboards older than 15 days will be nuked" danger

2022-03-25

* @C @whiteboard Show the user how big the eraser (and the marker) is going to be - As of now, we are simply rendering an _ellipsis_ following the mouse movements ? @B Implement touch gestures @whiteboard - Pinch to zoom / double tap and hold a-la Google Maps - Two fingers to move around * @A Fixed a bug where zooming out too much changes the aspect ratio of the @whiteboard -…

2022-03-24

* Integrated [livereload-js](https://github.com/livereload/livereload-js) with @whiteboard - `npm run serve` will use `nodemon` to start the server, excluding changes happening inside public/ - `npm run livereload` will start `livereload` on the public/ folder - `npm run start-dev` will runn `npm run serve` and `npm run livereload`, in parallel - Change something on the express app, `nodemon` will…

2022-03-23

* @A Fixed Out of memory exception while on mobile @whiteboard -- I guess saving a canvas **per shape** is a bit too much, isn t it?! Ended up reworking the drawing logic a bit - 1 rendering canvas, 1 offscreen graphic - all the _remote_ draw operations are done on the offscreen - inside p5.draw, first we copy the offscreen graphic over to the canvas, and then we directly draw any local shape not…

2022-03-22

? @B Immediately scrolling without moving the mouse first, causes the @whiteboard camera to close in (or get far from) the top left corner instead of where the mouse is currently at

2022-03-21

* Integrated fzf with z, as suggested [on the official wiki](https://github.com/junegunn/fzf/wiki/Examples#z) * Integrated fzf with bash s history search (CTRL-R) (I actually borrowed all the magic from [the official key bindings](https://github.com/junegunn/fzf/blob/master/shell/key-bindings.bash)) * Complete UI overhaul for @whiteboard - We now use Bootstrap - Different modes of working:…

2022-03-19

* Shapes are now relative to the top-left corner of the @whiteboard - Previously they were relative to the client view, and because of that draw commands had to include not just the points, but also the size of the client view - This also also addresses a couple of quirks of the current implementation - Lines looked different (i.e. more thick, or more slim) based on the zoom level of the client…

2022-03-18

* @Whiteboard changed the active cursor based on what the user is doing (i.e. pen, eraser, move) - Interestingly enough I was not able to use `p5.cursor` because it does not support .svg images; well, it actually lets you use them, it s just that if you also try to specify a x y offset to identify the _active_ portion of the cursor, p5.js will ignore this additional information + @A @2022-03-19…

2022-03-16

? @B Replace `(permalink)`s with `¶`s while generating html for my @plan file -- https://www.w3.org/WAI/EO/Drafts/tutorials/page-structure/in-page-navigation/#anchors ? @B Implement permalinks for sections (or for special markers like `~$DATE.$RANDOM`) -- @plan --- TIL about the difference between _direct_ and _indirect_ `eval` in JavaScript var x = outer ; (function() { var x = inner ; eval(…

2022-03-14

I am dropping here a few links I stumbled upon, recently, around ID schemas. Let s start with [Snowflake IDs](https://en.wikipedia.org/wiki/Snowflake_ID): - Total of 64 bits (only 63 are actually used) - First 41 bits, representing milliseconds since a chose epoch - Next 10 bits represent the machine ID (to prevent clashes) - Next 12 bits, represent per-machine sequence number (this allow creating…

2022-03-14

? @book Lila: An Inquiry Into Morals - Robert M. Pirsig ? @book Zen and the Art of Motorcycle Maintenance: An Inquiry Into Values - Robert M. Pirsig --- Feel like listening some chiptune @music, lately? [c64radio.com](https://c64radio.com/) got you covered! --- Another @music related note; this time, it s [ThePrimeagen](https://www.twitch.tv/ThePrimeagen) s…

2022-03-13

+ @B @2022-03-14 @whiteboard Add recenter button

2022-03-12

Getting zoom support for my toy @whiteboard turned out a tiny bit more complicated than I thought it would. Zooming in or out, **without** taking the mouse position into account, is quite straightforward: all you have to do is widening or shortening the field of view as the user uses the scroll wheel. However, users are used to move the mouse over the area of interest first, and when they use…

2022-03-10

* @B @whiteboard Add panning support * @B @whiteboard Add Export button to export as png ~ @B @2022-04-02 @whiteboard Slow performance due to bigger canvas **and** increasing undo history -- maybe offscreen rendering can help? - [Main Thread Canvas vs Web Worker (Offscreen) Canvas](https://codepen.io/newinweb/pen/bxazNg) - [Generating the Mandelbrot…

2022-03-09

* @A @whiteboard @mobile Set up `<meta>` element accordingly, so it does not start completely zoomed out * @A @whiteboard @mobile Added support for touch events ([Mobile Touch Draw](https://openprocessing.org/sketch/1398186)) * @A @whiteboard @mobile `crypto.randomUUID()` does not seem to be defined while on mobile (I am not sure why though), so I ended up snatching a [UUID…

2022-03-08

[Programming, Motherfucker](http://programming-motherfucker.com/), will never get old! > We are a community of motherfucking programmers who have been humiliated by software development methodologies for years. > > We are tired of XP, Scrum, Kanban, Waterfall, Software Craftsmanship (aka XP-Lite) and anything else getting in the way of...**Programming, Motherfucker**. > > We are tired of being…