Install gems on local user folder instead of system wide

In order to test locally a Gemfile, define local path for the gems to avoid attempting to write to system-wide folders: bundle config set --local path '/home/username/.gem' bundle install

January 16, 2024 · 1 min · Pablo Iranzo Gómez

No matching key found

As you might have experienced… using a recent system to connect to a legacy one could be complicated as some insecure protocols have been disabled, with a message like: Unable to negotiate with 192.168.2.82 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss Create an entry like this in your .ssh/config file, so that insecure methods can be used to connect to a specific host: Host 192.168.2.82 HostKeyAlgorithms=+ssh-rsa KexAlgorithms=+diffie-hellman-group1-sha1 PubkeyAcceptedKeyTypes=+ssh-rsa User root or alternatively on the command line: ...

August 25, 2023 · 1 min · Pablo Iranzo Gómez

Enable rootless podman on Fedora

With podman we can setup containers for being used for non root users by performing some simple steps: Install required packages dnf -y install slirp4netns fuse-overlayfs crun podman shadow-utils Force the number of user namespaces (might be required on some environments): echo "user.max_user_namespaces=28633" > /etc/sysctl.d/userns.conf sysctl -p /etc/sysctl.d/userns.conf Delegate Allows to define which resources are available1: mkdir -p /etc/systemd/system/[email protected] cat << EOF > /etc/systemd/system/[email protected]/delegate.conf [Service] Delegate=cpu cpuset io memory pids EOF To verify it has been done correctly, logout and login with the user and execute: ...

January 27, 2023 · 1 min · Pablo Iranzo Gómez

Enable Libvirt rw socket on RHEL9

RHEL9 by default uses read-only socket which is not usable by some tools like Kcli… to enable it use: systemctl enable --now libvirtd.socket libvirtd-ro.socket systemctl stop libvirtd.service systemctl enable --now virtproxyd.socket virtproxyd-ro.socket systemctl stop virtproxyd.service

January 12, 2023 · 1 min · Pablo Iranzo Gómez

[python] Generate ranges from items

Some years ago, I added a script for updating headers for (C) in the python files I was developing for Risu. In this way, the header got the list of authors and years working on the files updated automatically. With the pass of the years, the list started to became a bit too long, so I worked on creating code for getting ranges instead. This is the code I used: def getranges(data): """ From list of strings representing numbers, get ranges and return list of strings :param data: list of strings representing numbers :return: list of strings with number ranges when > 1 """ # Convert to integers data = [int(i) for i in data] result = [] if not data: return result # Prepare iteration loop idata = iter(data) first = prev = next(idata) first = first prev = prev # Process next item for following in idata: if following - prev == 1: # Years are continuum, just update previous prev = following else: # Years are not continuum, end range and start again if first == prev: result.append(first) else: if first + 1 == prev: # Only one item in difference, append items individually result.append(first) result.append(prev) else: result.append("%s-%s" % (first, prev)) first = prev = following # Catchall for regular execution or last remaining range if first == prev: result.append(first) else: if first + 1 == prev: # Only one item in difference, append items individually result.append(first) result.append(prev) else: result.append("%s-%s" % (first, prev)) # Convert back to text result = [str(i) for i in result] return result With it, previous headers like: ...

November 25, 2022 · 2 min · Pablo Iranzo Gómez
This blog is a participant in the Amazon Associate Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.