26th February 2023
Life Management⚑
Task Management⚑
Org Mode⚑
-
New: Introduce Nvim Org Mode.
nvim-orgmode
is a Orgmode clone written in Lua for Neovim. Org-mode is a flexible note-taking system that was originally created for Emacs. It has gained wide-spread acclaim and was eventually ported to Neovim.The article includes:
Coding⚑
Languages⚑
Python⚑
-
New: Move a file.
Use one of the following
import os import shutil os.rename("path/to/current/file.foo", "path/to/new/destination/for/file.foo") os.replace("path/to/current/file.foo", "path/to/new/destination/for/file.foo") shutil.move("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
DevOps⚑
Infrastructure as Code⚑
Gitea⚑
-
New: Create an admin user through the command line.
gitea --config /etc/gitea/app.ini admin user create --admin --username user_name --password password --email email
Or you can change the admin's password:
feat(gtd): Introduce Getting things donegitea --config /etc/gitea/app.ini admin user change-password -u username -p password
First summary of David Allen's book Getting things done. It includes:
Storage⚑
OpenZFS storage planning⚑
- New: Introduce ZFS storage planning.
OpenZFS⚑
- New: How to create a pool and datasets.
-
New: Configure NFS.
With ZFS you can share a specific dataset via NFS. If for whatever reason the dataset does not mount, then the export will not be available to the application, and the NFS client will be blocked.
You still must install the necessary daemon software to make the share available. For example, if you wish to share a dataset via NFS, then you need to install the NFS server software, and it must be running. Then, all you need to do is flip the sharing NFS switch on the dataset, and it will be immediately available.
-
New: Backup.
Please remember that RAID is not a backup, it guards against one kind of hardware failure. There's lots of failure modes that it doesn't guard against though:
- File corruption
- Human error (deleting files by mistake)
- Catastrophic damage (someone dumps water onto the server)
- Viruses and other malware
- Software bugs that wipe out data
- Hardware problems that wipe out data or cause hardware damage (controller malfunctions, firmware bugs, voltage spikes, ...)
That's why you still need to make backups.
ZFS has the builtin feature to make snapshots of the pool. A snapshot is a first class read-only filesystem. It is a mirrored copy of the state of the filesystem at the time you took the snapshot. They are persistent across reboots, and they don't require any additional backing store; they use the same storage pool as the rest of your data.
If you remember ZFS's awesome nature of copy-on-write filesystems, you will remember the discussion about Merkle trees. A ZFS snapshot is a copy of the Merkle tree in that state, except we make sure that the snapshot of that Merkle tree is never modified.
Creating snapshots is near instantaneous, and they are cheap. However, once the data begins to change, the snapshot will begin storing data. If you have multiple snapshots, then multiple deltas will be tracked across all the snapshots. However, depending on your needs, snapshots can still be exceptionally cheap.
The article also includes:
-
New: Introduce Sanoid.
Sanoid is the most popular tool right now, with it you can create, automatically thin, and monitor snapshots and pool health from a single eminently human-readable TOML config file.
The article includes:
- Installation
- Configuration
- Pros and cons
- Usage
- Troubleshooting
Authentication⚑
Authentik⚑
-
New: Configure password recovery.
Password recovery is not set by default, in the article you can find the terraform resources needed for it to work.
Operating Systems⚑
Linux⚑
Linux Snippets⚑
-
New: What is
/var/log/tallylog
./var/log/tallylog
is the file where thePAM
linux module (used for authentication of the machine) keeps track of the failed ssh logins in order to temporarily block users. -
New: Manage users.
- Change main group of user
usermod -g {{ group_name }} {{ user_name }}
- Add user to group
usermod -a -G {{ group_name }} {{ user_name }}
- Remove user from group.
usermod -G {{ remaining_group_names }} {{ user_name }}
You have to execute
groups {{ user }}
get the list and pass the remaining to the above command- Change uid and gid of the user
usermod -u {{ newuid }} {{ login }} groupmod -g {{ newgid }} {{ group }} find / -user {{ olduid }} -exec chown -h {{ newuid }} {} \; find / -group {{ oldgid }} -exec chgrp -h {{ newgid }} {} \; usermod -g {{ newgid }} {{ login }}
-
New: Manage ssh keys.
- Generate ed25519 key
ssh-keygen -t ed25519 -f {{ path_to_keyfile }}
- Generate RSA key
ssh-keygen -t rsa -b 4096 -o -a 100 -f {{ path_to_keyfile }}
- Generate different comment
ssh-keygen -t ed25519 -f {{ path_to_keyfile }} -C {{ email }}
- Generate key headless, batch
ssh-keygen -t ed25519 -f {{ path_to_keyfile }} -q -N ""
- Generate public key from private key
ssh-keygen -y -f {{ path_to_keyfile }} > {{ path_to_public_key_file }}
- Get fingerprint of key
ssh-keygen -lf {{ path_to_key }}
-
New: Measure the network performance between two machines.
Install
iperf3
withapt-get install iperf3
on both server and client.On the server system run:
server#: iperf3 -i 10 -s
Where:
-i
: the interval to provide periodic bandwidth updates-s
: listen as a server
On the client system:
client#: iperf3 -i 10 -w 1M -t 60 -c [server hostname or ip address]
Where:
-i
: the interval to provide periodic bandwidth updates-w
: the socket buffer size (which affects the TCP Window). The buffer size is also set on the server by this client command.-t
: the time to run the test in seconds-c
: connect to a listening server at…
Sometimes is interesting to test both ways as they may return different outcomes
sed⚑
- New: Introduce sed snippets.
Vim⚑
-
Correction: Update the leader key section.
There are different opinions on what key to use as the
<leader>
key. The<space>
is the most comfortable as it's always close to your thumbs, and it works well with both hands. Nevertheless, you can only use it in normal mode, because in insert<space><whatever>
will be triggered as you write. An alternative is to use;
which is also comfortable (if you use the english key distribution) and you can use it in insert mode.If you want to define more than one leader key you can either:
- Change the
mapleader
many times in your file: As the value ofmapleader
is used at the moment the mapping is defined, you can indeed change that while plugins are loading. For that, you have to explicitly:runtime
the plugins in your~/.vimrc
(and count on the canonical include guard to prevent redefinition later):
* Use the keys directly instead of usinglet mapleader = ',' runtime! plugin/NERD_commenter.vim runtime! ... let mapleader = '\' runime! plugin/mark.vim ...
<leader>
" editing mappings nnoremap ,a <something> nnoremap ,k <something else> nnoremap ,d <and something else> " window management mappings nnoremap gw <something> nnoremap gb <something else>
Defining
mapleader
and/or using<leader>
may be useful if you change your mind often on what key to use a leader but it won't be of any use if your mappings are stable. - Change the