Cipher Log

Chronicles in Language, Technology, and Law

Configuring CAA records on Lightsail instances

February 29, 2024

As most any web dev person knows, Google Domains is shutting down. This is unfortunate, because they've really done a good job balancing ease-of-use with advanced options.

I've looked at a lot of different options, including NameCheap and SquareSpace, but found them lacking. Eventually, I settled on Amazon's own registrar services for my Lightsail websites.

There's just one problem: best security practices require adding a CAA record to your DNS entry, to ensure that the SSL certificate authority is someone that you, as the owner of the DNS record, have deemed trustworthy. And Lightsail DNS does not allow you to add a CAA record.

Luckily, Amazon splits the existence of a domain apart from the DNS entries, by mapping the domain to a series of nameservers responsible for the 'hosted zone' (DNS settings) of that domain. So you can dive into the more technical AWS DNS settings in Route53 to set up your 'hosted zone', including the CAA record, and then point your Lightsail domain to the Route53 'hosted zone' nameservers instead of the Lightsail nameservers.

  1. Create a domain in Lightsail, along with the Lightsail zone. Point it at a static IP attached to your instance.
  2. Go over to Route53 and create a 'hosted zone' with the same domain name.
  3. In Route53, add an A record (IPv4) and/or AAAA (IPv6) record in Route53, pointing at your static IP and/or your instance's IPv6 address, respectively.
  4. In Route53, add a CAA record for your certificate authority, e.g., 0 issue letsencrypt.org
  5. In Route53, find your 'hosted zone' name servers in the NS record.
  6. In Lightsail, edit your domain's name servers to match your 'hosted zone' name servers.
  7. In Lightsail, delete your Lightsail zone.
  8. Optionally, use Google's Public DNS Flush Cache tool to get rid of lingering information about your Lightsail zone.

That should get you all set up with a proper CAA record for your domain.

Backdate git commits with gittimetravelcommit

June 05, 2023

I previously wrote about backdating Git commits, i.e., making a Git commit have a different date and time from the current date and time. This is useful for migrating quick-and-dirty or old codebases filled with project_v1, project_v2, etc. folders into a structured Git repo with logs.

Recently, I was frustrated with this enough that I hacked together a bash/zsh function for my user profile. Add this to your .bash_profile or .zshrc to make it easy:

function gittimetravelcommit(){ if [ -e $1 ]; then GIT_COMMITTER_DATE="$(date -r "${1}" +'%Y-%m-%d %H:%M:%S %z')" GIT_AUTHOR_DATE="$(date -r "${1}" +'%Y-%m-%d %H:%M:%S %z')" git commit ${@:2} else echo "File '${1}' does not exist" echo "Usage: gittimetravelcommit <file to take timestamp from> [options for git commit]" fi }

ChatGPT designs a neo-angle corner shower stall

May 08, 2023

Model: GPT-4

I am designing a neo-angle corner shower stall that must fit within a 3ft x 3ft area. Because it's in the corner, two of the walls will be the full 36 inches. How wide should the remaining walls and the door be, if they are of equal size?

In a neo-angle corner shower stall, the three remaining walls (including the door) typically form an equilateral triangle. To fit within a 3ft x 3ft area, you'll need to determine the length of each side of the equilateral triangle.

First, draw a right triangle where the hypotenuse is one of the sides of the equilateral triangle, and the other two sides are both perpendicular to the existing 3ft walls. Since the triangle is equilateral, the angle between the hypotenuse and the shorter sides is 60 degrees.

Let's denote the length of each side of the equilateral triangle as "s". Using trigonometry, we can use the sine or cosine function to find the length of "s".

cos(60°) = adjacent side / hypotenuse

cos(60°) = 1.5 ft / s

We know that the cosine of 60° is 0.5, so:

0.5 = 1.5 ft / s

Now, we can solve for "s":

s = 1.5 ft / 0.5

s = 3 ft

Each side of the equilateral triangle, including the door, should be 3 feet in length.

Your geometry is off. They cannot form an equilateral triangle.

Apologies for the confusion in my previous response. You are correct that the geometry is off. Let's reconsider the problem.

In a neo-angle corner shower stall, the remaining walls and door create an isosceles triangle, with the two equal sides being the walls and the base being the door. Let's call the length of each wall "w" and the length of the door "d". We will also use the Pythagorean theorem to solve this problem.

Since the two walls meet at a 90-degree angle, we can find the lengths by drawing a right triangle with one of the walls as the hypotenuse, half of the door as the base, and the distance from the corner to the midpoint of the door as the height. The height and base are both 1.

Sorry, the walls and the door do not form a triangle at all. The door (of size d) forms the base of an isosceles triangle with (36-d) sides.

Apologies for my earlier misunderstandings. Based on your clarification, I can now provide the correct approach.

Given that the door forms the base of the isosceles triangle, and the other two equal sides have a length of (36-d), we can use the Pythagorean theorem to find the door width (d).

Let's denote the equal sides of the triangle as "s" and the door as "d". The triangle will have two right triangles, each having one side of length (s) as the hypotenuse, one side of length (d/2) as the base, and one side of length (36-d) as the height.

Using the Pythagorean theorem:

(s)^2 = ((d/2))^2 + (36-d)^2

Now, we know s = (36-d), so we can substitute this into the equation:

(36-d)^2 = ((d/2))^2 + (36-d)^2

Next, simplify the equation and solve for d:

(36-d)^2 = ((d/2))^2 + (36-d)^2

0 = ((d/2))^2 - (36-d)^2

0 = d^2 / 4 - (36^2 - 72d + d^2)

Now, multiply everything by 4 to get rid of the fraction:

0 = d^2 - 4(36^2 - 72d + d^2)

0 = d^2 - (4 * 36^2 - 4 * 72d + 4 * d^2)

0 = d^2 - (4 * 1296 - 288d + 4d^2)

0 = 3d^2 - 288d + 5184

To solve this quadratic equation, you can use the quadratic formula:

d = (-b ± √(b²-4ac)) / 2a

In this case, a = 3, b = -288, and c = 5184. Plugging these values into the formula, we get:

d = (288 ± √((-288)²-435184)) / (2*3)

d = (288 ± √(82944-62208)) / 6

d = (288 ± √20736) / 6

d = (288 ± 144) / 6

There are two potential solutions for d:

d = (288 + 144) / 6 = 432 / 6 = 72 (This solution is not valid since it's larger than the available space.)

d = (288 - 144) / 6 = 144 / 6 = 24

So the width of the door (d) should be 24 inches, and the width of the remaining walls would each be (36 - 24) = 12 inches.

That is not correct.

Apologies for my previous response. I misunderstood the problem again. Let's try another approach.

In the neo-angle corner shower stall, the two remaining walls and the door meet the 36-inch walls at 135-degree angles. We will consider the triangle formed by the midpoint of the door, one of the corners, and the point where the door meets the 36-inch wall. This is a 45-45-90 right triangle.

Let's denote half of the door width as x. Since this is a 45-45-90 triangle, the

They do not meet the 36-inch walls at 135 degree angles. Let's try this again.  I have an isosceles right triangle with sides 36 and 36. How long is the hypotenuse

Apologies for the confusion earlier. If you have an isosceles right triangle with two legs of length 36, you can use the Pythagorean theorem to find the length of the hypotenuse.

For a right triangle, the Pythagorean theorem states:

a² + b² = c²

where a and b are the lengths of the legs, and c is the length of the hypotenuse.

In your case, a = 36 and b = 36. Plugging these values into the formula, we get:

36² + 36² = c²

1296 + 1296 = c²

2592 = c²

Now, take the square root of both sides to find c:

c = √2592 ≈ 50.91

So, the length of the hypotenuse is approximately 50.91 inches.

Designate that hypotenuse as the main hypotenuse.  I would now like to turn the triangle into a trapezoid by cutting off the right angle by a line parallel to the main hypotenuse. I would like that line and both sides to be the same size.

To turn your isosceles right triangle into a trapezoid by cutting off the right angle with a line parallel to the main hypotenuse, you need to determine the length of that line and ensure that the two non-parallel sides are equal.

Let's denote the length of the line segment that cuts off the right angle as 'x'. This line will create a smaller isosceles right triangle inside the larger one. Since the two non-parallel sides of the trapezoid are equal, the legs of the smaller isosceles right triangle will also be equal to 'x'.

Now you have two isosceles right triangles: one with legs of length (36 - x), and another with legs of length x.

For the larger triangle, with legs of length (36 - x), the hypotenuse can be calculated using the Pythagorean theorem:

((36 - x)² + (36 - x)²) = hypotenuse²

For the smaller triangle, with legs of length x, the hypotenuse can be calculated using the Pythagorean theorem:

(x² + x²) = hypotenuse²

Since the main hypotenuse is equal to the sum of the hypotenuses of these two smaller triangles, we can set up the following equation:

(36 - x)² + (36 - x)² = x² + x²

Simplifying this equation, we get:

72(36 - x) = 2x²

Now, divide both sides by 2:

36(36 - x) = x²

36 * 36 - 36x = x²

1296 - 36x = x²

Rearranging the equation, we get a quadratic equation:

x² + 36x - 1296 = 0

To solve this quadratic equation, you can use the quadratic formula:

x = (-b ± √(b²-4ac)) / 2a

In this case, a = 1, b = 36, and c = -1296. Plugging these values into the formula, we get:

x = (-36 ± √((36)²-4(1)(-1296))) / (2(1))

x = (-36 ± √(5184)) / 2

x = (-36 ± 72) / 2

There are two potential solutions for x:

x = (-36 + 72) / 2 = 36 / 2 = 18 (This solution is valid.)

x = (-36 - 72) / 2 = -108 / 2 = -54 (This solution is not valid, as the length cannot be negative.)

So, the length of the line segment that cuts off the right angle and forms the trapezoid should be 18 inches. The two non-parallel sides of the trapezoid will also be 18 inches long.

if the line segment is 18, what are the sides of the right triangle we cut off?

If the length of the line segment that cuts off the right angle is 18 inches, it forms a smaller isosceles right triangle with legs of equal length. In an isosceles right triangle, the legs are equal, and the angle between the legs is 90 degrees.

Since the line segment is parallel to the main hypotenuse and has a length of 18 inches, it means that the legs of the smaller isosceles right triangle are also 18 inches long.

So, the sides of the right triangle we cut off are both 18 inches.

That is incorrect. An isosceles right triangle cannot have all three sides be the same length.  If they are the same length, the interior angles must all be 60 degrees, which means it cannot be a right triangle. .

You are absolutely right, and I apologize for the confusion in my previous response. Let's analyze the problem again.

You have an isosceles right triangle with legs of length 36 inches each. You want to cut off a right triangle to create a trapezoid, where the cutting line is parallel to the main hypotenuse, and the cutting line and the two non-parallel sides of the trapezoid are of equal length.

Let's denote the length of the cutting line as 'x', and the length of one leg of the smaller right triangle we cut off as 'y'. Since the cutting line is parallel to the main hypotenuse, the smaller triangle created will also be a right triangle.

According to the problem, the two non-parallel sides of the trapezoid should be equal in length. In other words, x = (36 - y).

Since we have a smaller right triangle with legs 'y' and (36 - y), we can use the Pythagorean theorem:

y^2 + (36 - y)^2 = x^2

Now, substitute x with (36 - y):

y^2 + (36 - y)^2 = (36 - y)^2

Simplifying the equation, we get:

y^2 = 36y - y^2

2y^2 = 36y

Divide both sides by 2:

y^2 = 18y

Now, divide both sides by y:

y = 18

So, the length of one leg of the smaller right triangle is 18 inches. Since x = (36 - y), the cutting line (x) is also 18 inches long.

In summary, the cutting line is 18 inches long, and the sides of the smaller right triangle that was cut off are 18 inches and (36 - 18) = 18 inches.

No

Apologies for the repeated confusion. Let's analyze the problem one more time.

You have an isosceles right triangle with legs of length 36 inches each. You want to cut off a right triangle to create a trapezoid, where the cutting line is parallel to the main hypotenuse, and the cutting line (x) and the two non-parallel sides of the trapezoid are of equal length.

The two non-parallel sides of the trapezoid are formed by the difference in the length of the legs of the original isosceles right triangle and the legs of the smaller right triangle that was cut off. Let's denote the length of one leg of the smaller right triangle as 'y'.

Since the cutting line (x) and the two non-parallel sides of the trapezoid are of equal length, we have:

x = 36 - y

Now, since the cutting line is parallel to the main hypotenuse, we have two similar right triangles: the original isosceles right triangle and the smaller right triangle that was cut off.

The ratios of the corresponding sides of these similar triangles are equal. Therefore:

x / 36 = y / (36 - y)

Now, substitute x with (36 - y):

(36 - y) / 36 = y / (36 - y)

Cross-multiplying, we get:

(36 - y) * (36 - y) = 36y

Expanding and simplifying the equation, we have:

1296 - 72y + y^2 = 36y

Rearranging the terms, we get a quadratic equation:

y^2 + 108y - 1296 = 0

To solve this quadratic equation, you can use the quadratic formula:

y = (-b ± √(b²-4ac)) / 2a

In this case, a = 1, b = 108, and c = -1296. Plugging these values into the formula, we get:

y = (-108 ± √((108)²-4(1)(-1296))) / (2(1))

y = (-108 ± √(20736)) / 2

y = (-108 ± 144) / 2

There are two potential solutions for y:

y = (-108 + 144) / 2 = 36 / 2 = 18 (This solution is valid.)

y = (-108 - 144) / 2 = -252 / 2 = -126 (This solution is not valid, as the length cannot be negative.)

So, the length of one leg of the smaller right triangle is 18 inches. Since x = (36 - y), the cutting line (x) is (36 - 18) = 18 inches long.

The sides of the smaller right triangle that was cut off are 18 inches and (36 - 18) = 18 inches.

That is incorrect.

I apologize for my continued errors in solving this problem. Let's try this again.

You have an isosceles right triangle with legs of length 36 inches each. You want to cut off a right triangle to create a trapezoid, where the cutting line is parallel to the main hypotenuse, and the cutting line (x) and the two non-parallel sides of the trapezoid are of equal length.

Let's denote the length of one leg of the smaller right triangle as 'y'. The other leg of the smaller triangle will be (36 - y).

Now, since the cutting line is parallel to the main hypotenuse, we have two similar right triangles: the original isosceles right triangle and the smaller right triangle that was cut off.

The ratios of the corresponding sides of these similar triangles are equal. Therefore:

x / 36 = y / (36 - y)

Since x and the two non-parallel sides of the trapezoid are equal, we can substitute x with (36 - y):

(36 - y) / 36 = y / (36 - y)

Cross-multiplying, we get:

(36 - y) * (36 - y) = 36y

Expanding and simplifying the equation, we have:

1296 - 72y + y^2 = 36y

Rearranging the terms, we get a quadratic equation:

y^2 - 108y + 1296 = 0

To solve this quadratic equation, you can use the quadratic formula:

y = (-b ± √(b²-4ac)) / 2a

In this case, a = 1, b = -108, and c = 1296. Plugging these values into the formula, we get:

y = (108 ± √((-108)²-4(1)(1296))) / (2(1))

y = (108 ± √(11664 - 5184)) / 2

y = (108 ± √(6480)) / 2

y = (108 ± 80.5) / 2

There are two potential solutions for y:

y = (108 + 80.5) / 2 = 188.5 / 2 = 94.25 (This solution is not valid, as it is larger than the available space.)

y = (108 - 80.5) / 2 = 27.5 / 2 = 13.75

So, the length of one leg of the smaller right triangle is 13.75 inches. Since x = (36 - y), the cutting line (x) is (36 - 13.75) = 22.25 inches long.

The sides of the smaller right triangle that was cut off are 13.75 inches and (36 - 13.75) = 22.25 inches. The two non-parallel sides of the trapezoid, as well as the cutting line, are all 22.25 inches long.

If the trapezoid sides are 22.25 inches long, how much did we cut off each wall?

If the two non-parallel sides of the trapezoid are 22.25 inches long, we can determine how much was cut off each wall of the original isosceles right triangle.

The original isosceles right triangle had legs of length 36 inches each. The non-parallel sides of the trapezoid are formed from the legs of the original triangle, with a part of the leg being cut off.

Let's denote the length of one leg of the smaller right triangle as 'y'. The other leg of the smaller triangle will be (36 - y). Since the non-parallel sides of the trapezoid are 22.25 inches long, we can set up the following equation:

22.25 = 36 - y

Now, solving for y, we get:

y = 36 - 22.25 = 13.75

So, we cut off 13.75 inches from each wall of the original isosceles right triangle.

what is 13.75*13.75 + 13.75*13.75

To calculate the sum of the squares of 13.75, you can multiply 13.75 by itself and then add the result to itself:

13.75 * 13.75 + 13.75 * 13.75 = 189.0625 + 189.0625 = 378.125

What is the square root of 378.125

The square root of 378.125 is approximately 19.44.

Is 19.44 equal to 22.25?

No, 19.44 is not equal to 22.25. They are different numbers.

Then how can an isosceles right triangle have sides of 19.44 and a hypotenuse of 22.25?

You are correct, and I apologize for the confusion in my previous explanations. An isosceles right triangle cannot have sides of 19.44 and a hypotenuse of 22.25, as it contradicts the Pythagorean theorem. I made an error in my calculations earlier.

Let's reevaluate the problem:

You have an isosceles right triangle with legs of length 36 inches each. You want to cut off a right triangle to create a trapezoid, where the cutting line is parallel to the main hypotenuse, and the cutting line (x) and the two non-parallel sides of the trapezoid are of equal length.

We can set up a proportion using similar triangles. Let y be the length of one leg of the smaller right triangle, and (36 - y) be the other leg. Then, the proportion can be set up as follows:

y / (36 - y) = (36 - y) / 36

Cross-multiplying, we get:

36y = (36 - y)(36 - y)

Expanding and simplifying the equation, we have:

36y = 1296 - 72y + y^2

Rearranging the terms, we get a quadratic equation:

y^2 + 108y - 1296 = 0

To solve this quadratic equation, you can use the quadratic formula:

y = (-b ± √(b²-4ac)) / 2a

In this case, a = 1, b = 108, and c = -1296. Plugging these values into the formula, we get:

y = (108 ± √((-108)²-4(1)(-1296))) / (2(1))

y = (108 ± √(20736)) / 2

y = (108 ± 144) / 2

There are two potential solutions for y:

y = (108 + 144) / 2 = 252 / 2 = 126 (This solution is not valid, as it is larger than the available space.)

y = (108 - 144) / 2 = -36 / 2 = -18 (This solution is not valid, as the length cannot be negative.)

It appears that my previous approach to solving this problem was flawed, and I apologize for that. In this case, it may not be possible to create a trapezoid by cutting off a right triangle in the manner described in the problem while keeping the cutting line and the two non-parallel sides of the trapezoid equal in length.

It is possible.

I apologize for my previous errors, and I appreciate your patience. Let's try to solve the problem once more.

You have an isosceles right triangle with legs of length 36 inches each. You want to cut off a right triangle to create a trapezoid, where the cutting line (x) is parallel to the main hypotenuse, and the cutting line (x) and the two non-parallel sides of the trapezoid are of equal length.

Let's denote the length of one leg of the smaller right triangle as 'y'. The other leg of the smaller triangle will be (36 - y).

Since the cutting line (x) and the two non-parallel sides of the trapezoid are of equal length, we can set up the following equation using similar triangles:

y / 36 = (36 - y) / x

Now, let's substitute x with (36 - y):

y / 36 = (36 - y) / (36 - y)

In this case, the equation simplifies to:

y / 36 = 1

Which means:

y = 36

However, this result is not valid, as it implies that we are not cutting off any part of the triangle.

It appears that I made another mistake in setting up the proportion. Let's try again using the correct proportion:

y / x = (36 - y) / 36

Since x and the two non-parallel sides of the trapezoid are equal, we can substitute x with (36 - y):

y / (36 - y) = (36 - y) / 36

Cross-multiplying, we get:

36y = (36 - y)^2

Expanding and simplifying the equation, we have:

36y = 1296 - 72y + y^2

Rearranging the terms, we get a quadratic equation:

y^2 + 108y - 1296 = 0

This is the same quadratic equation we derived earlier, and as we discovered, it does not yield valid solutions for this problem.

After reconsidering the problem, I must conclude that my previous statement was incorrect, and it is indeed not possible to create a trapezoid by cutting off a right triangle in the manner described in the problem while keeping the cutting line and the two non-parallel sides of the trapezoid equal in length. I apologize for any confusion and appreciate your persistence in pointing out the inconsistencies.

It is indeed possible.  Let's try this.  The walls of the shower stall are bounded by a maximum width of 36 inches.  We want to cut off x from each wall, leaving a wall width of w, such that x+w = 36.  Solve for x+w = 36 where x^2 + x^2 = w^2

Let's consider the problem again. You want to cut off x from each wall, leaving a wall width of w, such that x + w = 36. We will solve for x + w = 36, where x^2 + x^2 = w^2.

First, let's express w in terms of x:

w = 36 - x

Now, we can substitute this expression for w into the equation x^2 + x^2 = w^2:

x^2 + x^2 = (36 - x)^2

Combining the terms on the left side, we get:

2x^2 = (36 - x)^2

Expanding and simplifying the equation on the right side, we have:

2x^2 = 1296 - 72x + x^2

Subtracting x^2 from both sides, we get:

x^2 = 1296 - 72x

Rearranging the terms, we get a quadratic equation:

x^2 + 72x - 1296 = 0

To solve this quadratic equation, you can use the quadratic formula:

x = (-b ± √(b²-4ac)) / 2a

In this case, a = 1, b = 72, and c = -1296. Plugging these values into the formula, we get:

x = (-72 ± √((72)²-4(1)(-1296))) / (2(1))

x = (-72 ± √(6480)) / 2

x = (-72 ± 80.5) / 2

There are two potential solutions for x:

x = (-72 + 80.5) / 2 = 8.5 / 2 = 4.25

x = (-72 - 80.5) / 2 = -152.5 / 2 = -76.25 (This solution is not valid, as the length cannot be negative.)

So, the length of x is 4.25 inches. Now, we can find the width of the wall (w) using the expression w = 36 - x:

w = 36 - 4.25 = 31.75

In this case, you can cut off 4.25 inches from each wall, leaving a wall width of 31.75 inches. The cutting line and the two non-parallel sides of the trapezoid are all 31.75 inches long.

That is incorrect. Let's drill down. What is 72^2?

I apologize for the error in my previous response. The square of 72 is:

72^2 = 5184

What is 4*1*-1296

The product of 4, 1, and -1296 is:

4 * 1 * -1296 = -5184

So what is ((72)²-4(1)(-1296))

Given the expression (72² - 4(1)(-1296)), let's calculate the result:

(72²) = 5184

4(1)(-1296) = -5184

Now, substitute these values into the expression:

(72² - 4(1)(-1296)) = 5184 + 5184 = 10368

Now solve x = (-72 ± √((72)²-4(1)(-1296))) / (2(1))

Now that we have the correct value for the expression under the square root, let's solve the quadratic equation using the quadratic formula:

x = (-72 ± √(10368)) / (2(1))

First, find the square root of 10368:

√(10368) ≈ 101.82

Now, plug this value into the formula:

x = (-72 ± 101.82) / 2

There are two potential solutions for x:

x = (-72 + 101.82) / 2 = 29.82 / 2 = 14.91

x = (-72 - 101.82) / 2 = -173.82 / 2 = -86.91 (This solution is not valid, as the length cannot be negative.)

So, the valid length of x is approximately 14.91 inches. Now, we can find the width of the wall (w) using the expression w = 36 - x:

w = 36 - 14.91 ≈ 21.09

In this case, you can cut off approximately 14.91 inches from each wall, leaving a wall width of approximately 21.09 inches. The cutting line and the two non-parallel sides of the trapezoid are all approximately 21.09 inches long.

is the square root of the sum of the squares of 14.91 approximately 21.09?

Apologies for the confusion in my previous responses. Let's verify if the square root of the sum of the squares of 14.91 is approximately 21.09:

(14.91)^2 + (14.91)^2 = 222.5881 + 222.5881 = 445.1762

Now, let's find the square root of the sum:

√445.1762 ≈ 21.1

The square root of the sum of the squares of 14.91 is approximately 21.1, which is close to 21.09.

Is that therefore a valid solution?

Yes, the solution we found earlier is indeed valid. When you cut off approximately 14.91 inches from each wall, you will leave a wall width of approximately 21.09 inches. The cutting line and the two non-parallel sides of the trapezoid are all approximately 21.09 inches long.

This forms a valid trapezoid where the cutting line is parallel to the main hypotenuse, and the cutting line and the two non-parallel sides of the trapezoid are of equal length.

Getting Time Machine to recognize a snapshot

July 27, 2022

Apple's Time Machine is a decent backup system for home users who don't want to get in over their heads. It's also decent for more advanced users who want a versioned history of backups (ChronoSync or Mac Backup Guru are other options, with the former having great reviews).

Unfortunately, Time Machine does a lot of "magic" -- there are things does things behind the scenes that are necessary to function properly, but which are inscrutable and undocumented. As a result, when things go wrong -- Backups.backupdb backup sets aren't imported or a specific dated snapshot directory isn't recognized -- it's very difficult to fix.

As it turns out, the metadata required to be recognized as a Time Machine snapshot is relatively straightforward. After a bit of trial and error, I wrote some shell scripts to automate the process of fixing Time Machine backups.

Please checkout the tmutils package on my GitHub page. Specifically, the tmimport.sh script should be helpful in getting a backup set recognized by Time Machine, and the tmbless.sh script should be helpful in making a specific dated snapshot directory show up within that backup set.

In fact, the tmbless.sh script is so effective that even a completely arbitrary and fabricated backup can be made to function in Time Machine, being fully recognized, appearing appropriately in the graphical UI, and allowing restore directly to your running system. See the images below for an example.

(Ideally I'd still like a way to thin out snapshots, especially since the "magic" of Time Machine often results in making complete, non-incremental backups whenever you move to a new computer, get a new backup drive, or restore an entire machine. Still playing with things like sudo rsync -aHAXUNDP --link-dest=../X X/ Y/ and so on. Note: the --link-dest parameter is relative to the target directory.)

Labels: ,

Installing a minimal emacs on macOS

July 20, 2022

Sadly, the folks over at Homebrew have decided not to maintain the emacs-nox package, which gave us a nice Terminal-only emacs editor. I spent some time playing with configurations today and got it to build just the way I want it.

First, use Homebrew to install dependencies only, and then to fetch the source only. Then we're going to copy the source archive to our home folder, extract it, and configure it appropriately. Then we'll build it and install it.

If you copy and paste this (single, large, compound) command into the Terminal and press Enter, you'll end up with a nice text-only emacs installation at /usr/local/bin/emacs. You may have to enter your password for the installation part.

brew install --only-dependencies emacs && \ mv `brew fetch -sf emacs 2>&1 | awk -F\: '/Downloaded to/{print $(NF)}'` ~/emacs.tar.xz && \ tar xvf emacs.tar.xz && \ mv "$(find ~ -name "emacs*" -type d -amin -10 -maxdepth 1 -mindepth 1)" emacsbuild && \ cd emacsbuild && \ CC=/usr/bin/clang ./configure --disable-build-details \ --without-xpm \ --without-jpeg \ --without-tiff \ --without-gif \ --without-png \ --without-rsvg \ --without-lcms2 \ --without-libsystemd \ --without-cairo \ --without-native-image-api \ --without-xft \ --without-harfbuzz \ --without-libotf \ --without-m17n-flt \ --without-toolkit-scroll-bars \ --without-xaw3d \ --without-xim \ --without-xdbe \ --without-gpm \ --without-dbus \ --without-gsettings \ --without-selinux \ --without-libgmp \ --without-x \ --without-xwidgets \ --without-imagemagick \ --without-ns \ --with-xml2 \ --with-included-regex \ --prefix=/usr/local && \ make && \ sudo make install

If you also want a very fast and minimal emacs setup, run the following command to modify your preferences:

printf "(setq inhibit-splash-screen t)\n(setq initial-scratch-message \"\")\n(switch-to-buffer \"**\")\n\n" >> ~/.emacs

Labels: , ,

How to get PrEP quickly and cheaply without insurance

June 13, 2022

Recently I wanted to go back on PrEP but couldn't get an appointment through my primary care or in-network.

The experience was a little janky, but knowing what I learned, here's the best way to go about it:

  1. Get an at-home HIV rapid test, such as OraQuick [Walmart][CVS][Target].
  2. Go to GoodRx and find a coupon code for generic Truvada a pharmacy near you. Typically, Walmart and grocery stores are better than CVS or Walgreens.
  3. Go to PlushCare and sign up for a 30-day trial and an online appointment for PrEP.

The reasoning is that you will not get prescribed PrEP unless you have a recent negative HIV test, and even generic Truvada is very expensive. The first pharmacy I had the prescription sent to, even with a coupon, would charge over $550.00 for a 30-day supply, whereas the pharmacy I ended up transferring it to charges $81.00 for a 90-day supply (not a typo - more than a 20x difference).

All told, I got an appointment and a 90-day supply in a couple hours for about $200.

Labels: , , ,

Using Walmart Security Videos (Updated!)

January 14, 2022

Walmart surveillance videos come in a weird codec made by a company called Verint. (A codec is a small piece of software that tells other software how to make sense of audio or video data.) This codec has had various trademark names attached to it, including the "Nextiva" codec, but it can safely be called SN40, which is really just a slight variation on H.263.

I previously posted about how to use and convert these files using the MPlayer software, but I no longer recommend that. The MPlayer project appears to be in a bit of disarray. In any case, the underlying software MPlayer relies on, ffmpeg, has gotten much easier to use directly, so I recommend doing that.

It should be easy to install ffmpeg with your Mac or Linux package manager (I recommend Homebrew for Mac). From a terminal window, issue brew install ffmpeg or apt install ffmpeg or whatever the package manager tells you, as appropriate.

After installation, use ffmpeg to convert the SN40/Verint file to a standard x264 MPEG-4 file. Make sure ffmpeg is in your current path (on Windows, it's easiest just to place the ffmpeg.exe file from a release build in the same place as your videos).

ffmpeg -vcodec h263 -i video.avi -aspect "16:10" video.mp4

If you're using bash or similar (zsh, fish, etc.), then you can use this to convert an entire directory full of Verint files.

for file in *.avi; do ffmpeg -vcodec h263 -i "${file}" -aspect "16:10" "${file}.mp4"; done

NOTE: You must explicitly tell ffmpeg to use the h263 input video codec.

FOR ADVANCED USERS ONLY: If you want to use the AVI files as-is without converting them to a different format (e.g., to preserve as much fidelity to the original file as possible), and you are on macOS, Linux, or another Unix-like system with xxd installed, you can simple fix the headers to specify the correct (H.263) codec, and the file will play in a video player that knows how to read H.263 AVI files (IINA, mpv, VLC, etc.). This does not modify the file at all, and does not fix the aspect ratio. From the directory where the videos are located, run this command:

for file in *.avi; do xxd -c 180 -p "${file}" | sed "s/00534e343000/004832363300/g" | xxd -r -p - "${file}.fixed.avi"; done