add truck post

This commit is contained in:
Nathan Anderson 2026-03-08 00:08:39 -07:00
parent 809bb3c081
commit d3efb33db8
28 changed files with 238 additions and 25 deletions

26
.image-manifest Normal file
View File

@ -0,0 +1,26 @@
# fosscat.com image optimization manifest — do not edit manually
2aeea48d6df9070f9c500ffa0af9dd58ff3fbb4a8200098a6a224d4bdc1be692 static/images/arch-logo.webp
49588883b06b4ec5a8e0bc09ca608816c83a0b0d4df158893d00e51fd93d60be static/images/eagle-wizard.webp
1db221e53cdab01ddf9847f9c2b56e39e95d8792eaeac775af7426704758ac6f static/images/elephant-and-blind-men.webp
a0628903bb9cb0ede12850d31692258db086d5a4ac0850ab91bea92235041345 static/images/ford-f150.webp
fa1a695caee36958d0ef33187b2c051ac3d7e3daf1bf3f87fe0410f87ccd4d94 static/images/fosscat_icon.webp
b8e279fc1296c255785b8c6938abc167576e68ad16f76c9e482ec07e36f76ac6 static/images/framework-banner.webp
3026c3136af7cff1f63f8148af6ad5fc082f41e4622c9cdbe03748ceaabf7fdc static/images/hammock.webp
6b778f29cfb98a79bc195ad9313ff90c06b06c3b2c658ab094a8cdb2a46a4e2c static/images/japan-arrival.webp
790b7e2f9a2b34333ada91ca37feb1ad219e51ecfd9103d30e50ae402beb19c1 static/images/japan-fuji-town.webp
25299e08100976e4b64e0b1e1e62aa68fd65515e24206f241ed16e63e4f40306 static/images/japan-fuji.webp
277eb4cea7f007987f437664ded582edd355e650aa3c083b526006a0dee82805 static/images/japan-mcdonalds.webp
918ecc79f2ac4a926ee39fe58ab286acbf94a715fab0695eaf2b66cfbee1abc4 static/images/japan-nekomachi.webp
a5b3a9a08fbccc48e41af6e77cbd9d5d50ff82482bf70e28fadcbcedf4446ee7 static/images/japan-nippori-graveyard.webp
a7f2129eea90da48a53be5115139786b4bb70429b089478f75a21d3a49f9d7c2 static/images/japan-nippori-walk.webp
83c301aca3822e953e6c0193a0ac0beb7fc9b3e1dfc48eef2f8fc5bc06b45440 static/images/japan-noodle-cup.webp
84754eefc88b71ec92abc008f9dddd21b8891e8a1864335ff94d1cc4a03af161 static/images/japan-shinjuku.webp
396851979b183b195ecdfd30e01d67dab6de3891eaaba043607f6eec5954b43e static/images/japan-shinjuzu-garden.webp
66b3456d8d6f670efb1609143dd987ee2540fae4d161ec57882ae0524dc6df33 static/images/japan-spirit-tree.webp
0b1179ecbc906abc418baa0ae2cb24b7f23128f4c3e748fba3a02d6e3ef55c2a static/images/monochrome-path.webp
13196fdb9ae802e1998e1ceeeaff6e774d9962b8a918107d016f63a60b99416f static/images/nginx-mumble.webp
bf721881652c94518b2b46dab9c13c9ca05c2211dade76f8cc68ce0c1fb7e481 static/images/ocean-aerial.webp
c59b6bfe6695c3d82b13375098d4c4f8ac62859e53e7a028d2dee3680f18d6c9 static/images/otto-1.webp
5814fb056057f022d67e144ad9c66fb2c7bfd2bfb7460eb50f8c33597cde33af static/images/otto-on-nature-path-algorithm.webp
29604251ddc2c916e470d77d37a88539888adb3dba45b8ce7c238fdd1aa88e95 static/images/rpi-bookshelf.webp
160b041274ea70f90484af2bc376f969888d2418dabc51eef55ce05ea306c9b9 static/images/salt-lake-basin-view.webp

View File

@ -0,0 +1,39 @@
---
date: 2026-03-07T23:30:48-07:00
description: "From a legal loophole in the 70's, we now deal with tanks on American roads."
image: "/images/ford-f150.webp"
lastmod: 2026-03-08T00:07:54-07:00
showTableOfContents: false
tags: ["cars", "politics"]
title: "How Cars Became Trucks"
type: "post"
---
# An American Saga
As every great story in the U.S. of A. goes, what started small and mighty is now big and ugly.
The American car manufacturers played a big role in American life and in American government. They represented the heart of this country's manufacturing as well as the force that got everyone where they needed to go.
No other country adopted the car quite so integrally as the United States did.
But, as the [government cracked down on polluting cars](https://en.wikipedia.org/wiki/Clean_Air_Act_(United_States)#Regulatory_programs) coupled with the [1973 oil embargo](https://en.wikipedia.org/wiki/1973_oil_crisis), consumer sentiments toward these gas guzzlers started to shift. Car manufacturers were obligated to reach a target MPG of 27.5 of the average car sold in their fleet by 1985.
{{<aside>}}
I was shocked to learn this was the _average_ MPG of an entire manufacturer's offering. 30 years ago!
{{</aside>}}
This new legislative requirements for efficiency and safety applied to cars. However, a little slice was cut out for light trucks, work trucks, non-passenger work trucks. Seems like there are multiple terms for it...
Which makes some intuitive sense. A farmer's work truck shouldn't be held to the same standard as a commuting vehicle, its very hard to achieve that sort of fuel efficiency while idling half the day outside the barn.
## The Truck-Shaped Loop-Hole
However, the American car manufacturers notice something interesting:
People will pay more for bigger cars, we can make bigger cars for cheaper. If we classify them as work trucks they aren't beholden to the same safety regulations, and sell them for a larger margin!
Long story short, massive trucks flood the streets of you average road in the U.S. It's evolved into a collective action problem due to the danger these huge vehicles pose.
With regular cars, there are tighter regulations on the bumper, namely how high off the ground they sit. But for work trucks? No, we gotta get over some rocks, raise that bumper up!
A [great video on the topic (YouTube)](https://www.YouTube.com/watch?v=JPm4de6-eTg) was recently published by Climate Town on YouTube, I enjoy their stuff so I recommend giving it a watch!

View File

@ -116,6 +116,52 @@ human_size() {
fi
}
# ---------------------------------------------------------------------------
# Manifest: track which images have been optimized (skip re-processing)
# ---------------------------------------------------------------------------
MANIFEST_FILE=".image-manifest"
manifest_hash() {
sha256sum "$1" | cut -d' ' -f1
}
# Look up a file's stored hash; prints it or empty string if not found
manifest_lookup() {
local file="$1"
if [[ -f "$MANIFEST_FILE" ]]; then
grep -F " $file" "$MANIFEST_FILE" 2>/dev/null | head -1 | awk '{print $1}' || true
fi
}
# Update or add a file's hash in the manifest
manifest_update() {
local file="$1"
local hash
hash=$(manifest_hash "$file")
if [[ ! -f "$MANIFEST_FILE" ]]; then
echo "# fosscat.com image optimization manifest — do not edit manually" > "$MANIFEST_FILE"
fi
# Remove existing entry for this file (if any)
if grep -qF " $file" "$MANIFEST_FILE" 2>/dev/null; then
grep -vF " $file" "$MANIFEST_FILE" > "${MANIFEST_FILE}.tmp"
mv "${MANIFEST_FILE}.tmp" "$MANIFEST_FILE"
fi
# Append new entry
echo "$hash $file" >> "$MANIFEST_FILE"
}
# Remove a file's entry from the manifest
manifest_remove() {
local file="$1"
if [[ -f "$MANIFEST_FILE" ]] && grep -qF " $file" "$MANIFEST_FILE" 2>/dev/null; then
grep -vF " $file" "$MANIFEST_FILE" > "${MANIFEST_FILE}.tmp"
mv "${MANIFEST_FILE}.tmp" "$MANIFEST_FILE"
fi
}
# ---------------------------------------------------------------------------
# Utility: confirm prompt (respects --yes and --dry-run)
# ---------------------------------------------------------------------------
@ -394,6 +440,9 @@ phase_strip_metadata() {
exiftool -all= -overwrite_original "$img" 2>/dev/null
stripped=$((stripped + 1))
echo -e " ${GREEN}$fname${NC} — metadata stripped"
# Update manifest since file content changed
manifest_update "$img"
done
echo ""
@ -423,6 +472,7 @@ phase_convert() {
echo -e " ${DIM}(dry-run) Would delete: $(basename "$img") ($(human_size "$fsize"))${NC}"
else
rm -f "$img"
manifest_remove "$img"
echo -e " ${RED}Deleted:${NC} $(basename "$img") ($(human_size "$fsize"))"
fi
done
@ -430,12 +480,14 @@ phase_convert() {
fi
echo -e "${BOLD}Converting images to WebP (quality $WEBP_QUALITY, max ${MAX_WIDTH}x${MAX_HEIGHT})${NC}"
printf " %-40s %-12s %-12s %s\n" "FILENAME" "BEFORE" "AFTER" "SAVINGS"
printf " %-40s %-12s %-12s %s\n" "--------" "------" "-----" "-------"
printf " %-40s %-12s %-12s %s\n" "FILENAME" "BEFORE" "AFTER" "STATUS"
printf " %-40s %-12s %-12s %s\n" "--------" "------" "-----" "------"
local total_before=0
local total_after=0
local converted=0
local skipped=0
local resized_only=0
for img in "${image_files[@]}"; do
[[ -z "$img" ]] && continue
@ -446,6 +498,7 @@ phase_convert() {
fname=$(basename "$img")
local ext="${fname##*.}"
local base="${fname%.*}"
local ext_lower
ext_lower=$(echo "$ext" | tr '[:upper:]' '[:lower:]')
local webp_path="$IMAGES_DIR/${base}.webp"
@ -453,14 +506,33 @@ phase_convert() {
before_size=$(stat -c%s "$img" 2>/dev/null || stat -f%z "$img" 2>/dev/null)
total_before=$((total_before + before_size))
# --- Manifest-based skip logic ---
local current_hash stored_hash
current_hash=$(manifest_hash "$img")
stored_hash=$(manifest_lookup "$img")
if [[ "$ext_lower" == "webp" ]] && [[ "$current_hash" == "$stored_hash" ]] && [[ -n "$stored_hash" ]]; then
# Already optimized, hash unchanged — skip entirely
total_after=$((total_after + before_size))
skipped=$((skipped + 1))
printf " %-40s %-12s %-12s ${DIM}%s${NC}\n" \
"$fname" "$(human_size "$before_size")" "—" "already optimized"
continue
fi
if $DRY_RUN; then
echo -e " ${DIM}(dry-run) Would convert: $fname -> ${base}.webp${NC}"
# Estimate: assume 80% reduction for JPEGs, 70% for PNGs, 10% for existing WebP
if [[ "$ext_lower" == "webp" ]] && [[ -n "$stored_hash" ]] && [[ "$current_hash" != "$stored_hash" ]]; then
echo -e " ${DIM}(dry-run) $fname — edited, would check dimensions only${NC}"
elif [[ "$ext_lower" == "webp" ]] && [[ -z "$stored_hash" ]]; then
echo -e " ${DIM}(dry-run) $fname — new webp, would record in manifest${NC}"
else
echo -e " ${DIM}(dry-run) Would convert: $fname -> ${base}.webp${NC}"
fi
local est_after=$before_size
case "$ext_lower" in
jpg|jpeg) est_after=$((before_size / 5)) ;;
png) est_after=$((before_size / 3)) ;;
webp) est_after=$((before_size * 9 / 10)) ;;
webp) est_after=$before_size ;;
esac
total_after=$((total_after + est_after))
converted=$((converted + 1))
@ -476,7 +548,47 @@ phase_convert() {
needs_resize=true
fi
# Determine the input for cwebp
# --- Already WebP (edited or new): skip lossy re-compression ---
if [[ "$ext_lower" == "webp" ]]; then
if $needs_resize; then
# Resize oversized WebP via ImageMagick (lossless resize, no re-encoding)
local tmp_resized
tmp_resized=$(mktemp /tmp/optimg_XXXXXX.webp)
magick "$img" -resize "${MAX_WIDTH}x${MAX_HEIGHT}>" "$tmp_resized"
local new_dims
new_dims=$(magick identify -format '%wx%h' "$tmp_resized")
mv "$tmp_resized" "$img"
info " Resized $fname: ${cur_width}x${cur_height} -> $new_dims"
resized_only=$((resized_only + 1))
fi
# Record in manifest (whether resized or just newly tracked)
manifest_update "$img"
local after_size
after_size=$(stat -c%s "$img" 2>/dev/null || stat -f%z "$img" 2>/dev/null)
total_after=$((total_after + after_size))
if $needs_resize; then
local savings=0
if (( before_size > 0 )); then
savings=$(( (before_size - after_size) * 100 / before_size ))
fi
printf " %-40s %-12s %-12s ${CYAN}%s${NC}\n" \
"$fname" "$(human_size "$before_size")" "$(human_size "$after_size")" "resized (${savings}%)"
elif [[ -z "$stored_hash" ]]; then
printf " %-40s %-12s %-12s ${GREEN}%s${NC}\n" \
"$fname" "$(human_size "$before_size")" "—" "recorded"
else
printf " %-40s %-12s %-12s ${CYAN}%s${NC}\n" \
"$fname" "$(human_size "$before_size")" "—" "updated (edited)"
fi
converted=$((converted + 1))
continue
fi
# --- Non-WebP image: full convert + compress pipeline ---
local cwebp_input="$img"
local tmp_resized=""
@ -488,24 +600,17 @@ phase_convert() {
cwebp_input="$tmp_resized"
fi
# Convert to WebP via cwebp (handles JPEG/PNG/WebP input natively)
if [[ "$ext_lower" == "webp" ]] && [[ "$img" == "$webp_path" ]]; then
# Same input and output: use temp output
local tmp_webp
tmp_webp=$(mktemp /tmp/optimg_XXXXXX.webp)
cwebp -q "$WEBP_QUALITY" "$cwebp_input" -o "$tmp_webp" 2>/dev/null
mv "$tmp_webp" "$webp_path"
else
cwebp -q "$WEBP_QUALITY" "$cwebp_input" -o "$webp_path" 2>/dev/null
fi
# Convert to WebP via cwebp
cwebp -q "$WEBP_QUALITY" "$cwebp_input" -o "$webp_path" 2>/dev/null
# Cleanup temp file if we resized
[[ -n "$tmp_resized" ]] && rm -f "$tmp_resized"
# Step 3: Delete original if it's not already .webp
if [[ "$ext_lower" != "webp" ]]; then
rm -f "$img"
fi
# Delete original non-WebP source
rm -f "$img"
# Record the new WebP in the manifest
manifest_update "$webp_path"
local after_size
after_size=$(stat -c%s "$webp_path" 2>/dev/null || stat -f%z "$webp_path" 2>/dev/null)
@ -529,16 +634,27 @@ phase_convert() {
echo ""
local total_savings=0
if (( total_before > 0 )); then
if (( total_before > 0 )) && (( total_after > 0 )); then
total_savings=$(( (total_before - total_after) * 100 / total_before ))
fi
info "Converted $converted image(s)"
info "Total: $(human_size $total_before) -> $(human_size $total_after) (${total_savings}% reduction)"
if (( skipped > 0 )); then
info "Skipped $skipped already-optimized image(s)"
fi
if (( resized_only > 0 )); then
info "Resized $resized_only edited image(s) (no re-compression)"
fi
info "Processed $converted image(s)"
if (( total_before > total_after )); then
info "Total: $(human_size $total_before) -> $(human_size $total_after) (${total_savings}% reduction)"
else
info "Total size: $(human_size $total_after)"
fi
# Save totals for summary
echo "$total_before" > /tmp/optimg_total_before.txt
echo "$total_after" > /tmp/optimg_total_after.txt
echo "$converted" > /tmp/optimg_converted.txt
echo "$skipped" > /tmp/optimg_skipped.txt
}
# ---------------------------------------------------------------------------
@ -656,10 +772,11 @@ phase_summary() {
echo ""
fi
local total_before total_after converted
local total_before total_after converted skipped
total_before=$(cat /tmp/optimg_total_before.txt 2>/dev/null || cat /tmp/optimg_total_size.txt 2>/dev/null || echo 0)
total_after=$(cat /tmp/optimg_total_after.txt 2>/dev/null || echo 0)
converted=$(cat /tmp/optimg_converted.txt 2>/dev/null || echo 0)
skipped=$(cat /tmp/optimg_skipped.txt 2>/dev/null || echo 0)
local savings=0
if (( total_before > 0 )) && (( total_after > 0 )); then
@ -667,10 +784,41 @@ phase_summary() {
fi
echo -e " Images processed: ${BOLD}$converted${NC}"
if (( total_after > 0 )); then
if (( skipped > 0 )); then
echo -e " Images skipped: ${BOLD}$skipped${NC} (already optimized)"
fi
if (( total_after > 0 )) && (( total_before > total_after )); then
echo -e " Size before: ${BOLD}$(human_size "$total_before")${NC}"
echo -e " Size after: ${BOLD}$(human_size "$total_after")${NC}"
echo -e " Total reduction: ${BOLD}${GREEN}${savings}%${NC}"
elif (( total_after > 0 )); then
echo -e " Total size: ${BOLD}$(human_size "$total_after")${NC}"
fi
# Clean up stale manifest entries (files that no longer exist)
if [[ -f "$MANIFEST_FILE" ]] && ! $DRY_RUN; then
local stale=0
local manifest_tmp
manifest_tmp=$(mktemp /tmp/optimg_manifest_XXXXXX.txt)
while IFS= read -r line; do
# Keep comment lines
if [[ "$line" == \#* ]]; then
echo "$line" >> "$manifest_tmp"
continue
fi
# Extract filename (second field, after hash + two spaces)
local entry_file
entry_file=$(echo "$line" | awk '{print $2}')
if [[ -z "$entry_file" ]] || [[ -f "$entry_file" ]]; then
echo "$line" >> "$manifest_tmp"
else
stale=$((stale + 1))
fi
done < "$MANIFEST_FILE"
mv "$manifest_tmp" "$MANIFEST_FILE"
if (( stale > 0 )); then
info "Removed $stale stale manifest entry/entries"
fi
fi
echo ""

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 KiB

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 KiB

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 767 KiB

After

Width:  |  Height:  |  Size: 765 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 KiB

After

Width:  |  Height:  |  Size: 442 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 KiB

After

Width:  |  Height:  |  Size: 448 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 KiB

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 KiB

After

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 599 KiB

After

Width:  |  Height:  |  Size: 596 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 533 KiB

After

Width:  |  Height:  |  Size: 530 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 526 KiB

After

Width:  |  Height:  |  Size: 524 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 451 KiB

After

Width:  |  Height:  |  Size: 449 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 KiB

After

Width:  |  Height:  |  Size: 458 KiB