Software RAID has come a long way. Unless you have some very high-rate, high-volume, I/O workloads with SLAs that will otherwise cost you money, for the most part a software RAID will perform just fine. One of the primary benefits of using software RAID is the portability of your disks/data. If a box on which you have a software RAID dies somehow and at least some (depending on your RAID configuration) of drives survive, you can easily resurrect the RAID → Continue reading “Setting up software RAID on Debian with mdadm”
Author: rchapin
Enable and disable delivery to additional email addresses for sent and received messages with a Google Workspace account
I have a Google Workspace account for my domain and sometimes it is useful to have messages sent from or sent too other addresses in my domain also delivered to my address.
To set it up, login to your Google Admin console, then in the left-hand navigation click on Google Workspace, and then Gmail.
Look for Routing and click on it to enter the routing configurations.
You can then add, modify, delete, enable, or disable routing rules for → Continue reading “Enable and disable delivery to additional email addresses for sent and received messages with a Google Workspace account”
[SOLVED] debsig-verify for Failed verification error, “signatures using the SHA1 algorithm are rejected” and “Can’t check signature: Invalid digest algorithm”
If you are using debsig-verify for the verification of a downloaded .deb file and are unable to verify it, run it with the -d option to get more information. If you see the following two lines
gpg: Note: signatures using the SHA1 algorithm are rejected
gpg: Can't check signature: Invalid digest algorithm
It is likely that the PGP signature used to sign the package uses the SHA1 algorithm which has been deprecated in most of the recent Linux distros. If → Continue reading “[SOLVED] debsig-verify for Failed verification error, “signatures using the SHA1 algorithm are rejected” and “Can’t check signature: Invalid digest algorithm””
Query for Finding the nth Element in a PostgreSQL JSONB Array that Matches a Specified Value
The following is a sample query that you can use to search for rows that have the nth element in a JSONB array that match a specific value.
Given
CREATE TABLE sample_jsonb (
id serial PRIMARY KEY,
name varchar(64),
json_data jsonb
);
INSERT INTO sample_jsonb(name, json_data)
VALUES
('foo',
'{
"key": "val1",
"arr": ["homer", "bart", "barney"]
}'),
('bar',
'{
"key": "val2",
"arr": ["marge", "lisa", "maggie"]
}'),
('baz',
'{
"key": "val2",
"arr": ["bart", "milhouse", "nelson"]
}')
;
We now have two records → Continue reading “Query for Finding the nth Element in a PostgreSQL JSONB Array that Matches a Specified Value”
LVM Resize – reduce the size of one logical volume to enable expanding another
I’m running an Ubuntu workstation and when setting it up simply went the “next-next-next” route when setting up the encrypted disk via LVM. The default is to create a 1G swap partition which is just not enough when you attempt to run too many things and locks up and/or crashes the machine.
My goal was to reduce my /root partition and then use that space to extend my swap partition.
Ensure that you back up your data first! There is → Continue reading “LVM Resize – reduce the size of one logical volume to enable expanding another”
Query for Finding an Element in a PostgreSQL JSONB Array
The following is a sample query that you can use to search for rows that have an element in a JSONB array.
Given
CREATE TABLE sample_jsonb (
id serial PRIMARY KEY,
name varchar(64),
json_data jsonb
);
INSERT INTO sample_jsonb(name, json_data)
VALUES
('foo',
'{
"key": "val1",
"arr": ["homer", "bart", "barney"]
}'),
('bar',
'{
"key": "val2",
"arr": ["marge", "lisa", "maggie"]
}')
;
select count(*) from sample_jsonb where json_data-'arr' ? 'marge';→ Continue reading “Query for Finding an Element in a PostgreSQL JSONB Array” Convert a Slice of Any Type to a CSV in Go
There are times, mostly for logging and debugging, when you have a slice of a given type that you would like to print to a log file or just convert to a CSV of values.
A quick and easy way to convert a slice to a CSV in Golang is to use the json module to Marshal it a JSON encoded array.
package main
import (
"encoding/json"
"fmt"
)
func main() {
ints := []int64{1, 2, 3, → Continue reading “Convert a Slice of Any Type to a CSV in Go” PostgreSQL Query to Find Tables With Name LIKE
Sometimes you are working with a PostgreSQL database with A LOT of tables and looking for tables that contain a sub-string in their name. Following is a query that you can run that will return all of the tables that have the string in their name:
SELECT
table_schema,
table_name
FROM
information_schema.tables
WHERE
table_name LIKE '%<string%'
AND table_schema not in ('information_schema', 'pg_catalog')
AND table_type = 'BASE TABLE'
ORDER BY
table_name, table_schema
;→ Continue reading “PostgreSQL Query to Find Tables With Name LIKE” Earthly Cheat Sheet
I have just recently started using Earthly and the following is a list of commands that I want to keep track of
Caching
Completely clearing the cache: Earthly stores artifacts in docker volumes. If you want to completely flush that data and start fresh run the following
docker stop earthly-buildkitd && \
docker rm earthly-buildkitd && \
docker volume rm earthly-cache→ Continue reading “Earthly Cheat Sheet” git Cheat Sheet
A handful of handy git commands that I don’t use all that often but want to keep track of:
Stashing
Stash a single file
git stash push -m 'message here' -- path/to/file
Drop a specific stash
First figure out the id of the stash you want to drop with git stash list, then issue the following command
git stash drop stash@{n}
Add all untracked files across the entire repository
git add -A