RSS Amplifier

Blog

Lourenci's Notes

Recent content on Lourenci's Notes

blog.lourenci.comSource feed ↗16 posts

Dormant Last read · last published · next check
Read 5 days ago and current, but nothing has been published for 15 months.

Latest posts

Importing Yubikey's SSH/GPG key into a new computer

Importing the SSH key # Mac Sequoia's `openssh` doesn't support FIDO2 resident keys. brew install openssh # Import the SSH key from Yubikey into the current path. ssh-keygen -K # Move the private key to the ssh default location for keys. mv id_ecdsa_sk_rk ~/.ssh/id_ecdsa_sk Importing the GPG key # Mac doesn't include gpg by default. brew install gnupg # Create the stub for the secret key in your…

Some SQL tips I've learned over the last few years

…even though I spent part of my career writing SQL queries in corporations. Temporary tables with with with can be used to create temporary tables that can be used in the main query. with cities as ( select name, state , population from city ) select * from cities where population > 1000000 ; filter in aggregated columns having is not the only way to filter aggregated columns. filter is…

Vim tricks

Q in normal mode to execute the last recorded macro. Use \{-} as non-greedy regex symbol. Use \_. to match any character including newline (multi-line). Use \Vpattern (very non-magic) to match the pattern literally, only ^ and $ will have special meaning. Use \vpattern (very magic) to match the pattern as a regex. Classic negative/positive lookahead/behind (example in very magic): lookbehind…

How to backup and restore Docker volumes

Recently, I had to update a major version of Debian. One of their “before starting updating” steps is to remove all non-Debian installed packages . Docker is one of them. Uninstalling Docker is as simple as $ sudo apt-get purge docker if I was not relying heavily on external volumes. But, it turns out backup-ing an external volume is very straightforward: # Backup the output command's…

Creating a partition larger than 2TB on Debian

Debian ( fdisk ) doesn’t support creating a partition larger than 2TB due to using the MBR partition table. You’ll need to use GPT instead: sudo apt-get install parted # Check the disk you want to format sudo fdisk -l # Replace /sdx for the disk you want to format sudo parted /dev/sdx mklabel gpt quit sudo parted -a optimal /dev/sdx mkpart primary '0%' '100%' Now you can format the…

How to stash only some files?

Since Git 2.13 , we’re able to stash only some specific files from your working tree. 🙏🏻 In order to do that: git stash [ --patch ] -- { files... } # or git stash push [ --patch ] { files... }

Using two-way merge/conflict tool in (n)vim

I don’t like 3-ways merge. For a long time, I’ve been using this plugin to solve my merge conflicts in a 2-way way. 🤢 In a Reddit comment today, someone posted that Git has built-in support to 2-ways in (n)vim since 2021 🤯. To activate it, first check if your Git version supports it: # (n)vimdiff1 is what you are looking for git mergetool --tool-help After checking the support,…

Amazon AWS

RDS It’s the amazon service to use a relational database. There are lots of databases available for usage: Postgres, aurora… SQS S imple Q ueue S ervice is used to implement a queue to deliver messages. You put a message in the queue, which is available for some service to poll (get) it. Note that the message is removed¹ from the queue as soon as some service polls the message. Thus you…

Your computer has two clocks

You may not realise this, but your computer has a battery inside it only to get your computer clock running. Back in the 90s, when the rechargeable (lithium-ion) battery was not cheap, we used to disassemble our computers to replace their clock battery when the computer could not keep the clock “on time” anymore. Yeah, your computer clock is a “thing”. Like your old…

Cleaning up not-used Docker images/containers/volumes

Docker has a built-in command to prune all the dangling (not-used) Docker images/containers/volumes: docker system prune --volumes

How to remove a Brew package and all its dependencies?

TIL You can use the autoremove command to remove the leftovers from a package previously installed by brew. List all the installed packages: brew leaves Remove an installed package: brew uninstall [ package ] Remove all the leftovers from an uninstalled package: brew autoremove When executing this command, pay attention to stdout . Brew does not clear some (config) files left from the autoremove…

What is the difference between a Component and a PureComponent?

In the class components land, you can define a component either by extending it from React.Component or from React.PureComponent . Whatever component you use, when it changes its state or it receives a new prop from its parent, React will call the render lifecycle method of the component and of the all children of the component, the famous VDOM (kind of DOM in memory) will be generated and React…

How to update the Jest's jsdom to the latest version

Jest comes with jsdom to mount your components. When you mount your component with render libs like @testing-library or enzyme , this component will be mounted on jsdom. jsdom is a JavaScript implementation of a “browser”. It tries to implement both DOM and HTML standards capabilities to make sure you’ll be able to mount and test your components in memory like it was running in a…

How to wrap long lines when writing markdown on Vim

If you have Vim optimized for coding, probably you’ll have some problem for writing on it. The first one that comes out for me as soon as I started to writing markdown files in Vim was the word wrap question, any sentence comes longer easily and you can’t read it anymore if you have set Vim to not wrap your code. If you want to configure your Vim to wrap long lines only in markdown…

My Favorite Vim Plugins

It had been a long time using a heavy IDE from the JetBrains family (e.g. PhpStorm, Rubymine) and I wanted to switch to something more light and as keyboard oriented as JetBrains’ IDEs. I tried VSCode, but the lack of essential shortcuts (e.g. navigate through the tree files) was the last straw for me. So, I decided to adventure in the Vim world. I started in the Vim world without any Vim…

Debian installation and first steps

Installation Debian doesn’t come with non-free firmwares, so it might be necessary to install them. There is a link for the firmwares in Debian’s downloads page (page with the .iso files). You can use the same USB with the bootable Debian for those firmwares: after restoring the Debian’s ISO into a USB, you can create a new partition with fdisk /dev/sdb and change it to FAT16…