component
LTC2945CMS#PBF - Wide Range I2C Power Monitor
Public Made by Adomby adom
Analog Devices (Linear Technology) LTC2945CMS#PBF: wide range I2C power monitor, 0 V to 80 V current and voltage sensing, 12-bit ADC, 24-bit power, min/max and alerts, split SDA for opto-isolation, 0 C to 70 C, MSOP-12. KiCad, Fusion and Altium libraries, 3D model and datasheet.
main
#!/usr/bin/env bash
# usage: push.sh <slug> [page dir] (pushes the page tree to adom/<slug>; batches under 3.3 MB, page.json last)
set -u
slug="$1"; dir="${2:-/home/adom/project/uta-dynos/work/pages/$slug}"
cd "$dir" || exit 1
mapfile -t files < <(find . -type f ! -name page.json -printf '%s %P\n' | sort -k2)
batch=(); size=0; n=0
push() {
local tries=0
while :; do
out=$(adom-wiki repo push "adom/$slug" --files "$@" -m "$MSG" 2>&1); rc=$?
if echo "$out" | grep -q -E '429|RATE_LIMITED'; then
w=$(echo "$out" | grep -oE '"retry_after":[0-9]+' | grep -oE '[0-9]+' | head -1); w=${w:-20}
echo "rate limited, waiting $w s"; sleep "$w"; tries=$((tries+1)); [ $tries -gt 5 ] && return 1; continue
fi
echo "$out" | tail -4; return $rc
done
}
flush() {
[ ${#batch[@]} -eq 0 ] && return 0
n=$((n+1)); MSG="Component record for $slug: files batch $n"
echo "== batch $n: ${#batch[@]} files, $size bytes"
push "${batch[@]}" || { echo "PUSH FAILED"; exit 1; }
batch=(); size=0; sleep 3
}
for line in "${files[@]}"; do
s=${line%% *}; f=${line#* }
if [ $((size + s)) -gt 3300000 ]; then flush; fi
batch+=("$f"); size=$((size + s))
done
flush
MSG="Component record for $slug: page.json (last, keeps hero and title)"
echo "== page.json"
push page.json || { echo "PUSH FAILED"; exit 1; }