Skip to content

Instantly share code, notes, and snippets.

@peterwwillis
Last active March 5, 2024 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterwwillis/d17f8868c3333750ee5a95e9e05941c0 to your computer and use it in GitHub Desktop.
Save peterwwillis/d17f8868c3333750ee5a95e9e05941c0 to your computer and use it in GitHub Desktop.
GitHub reviews of changes in new versions of Git
#!/usr/bin/env bash
set -eu
[ "${DEBUG:-0}" = "1" ] && set -x
declare -a links
while read -r LINE ; do
links+=("$LINE")
done <<<"$(cat links.txt)"
c=0
for link in "${links[@]}" ; do
file="$(printf "output-%.4d.html" "$c")"
if [ ! -e "$file" ] ; then
echo "$0: Downloading '$link' ..."
curl --silent "$link" --no-clobber --output "$file"
fi
c=$((c+1))
done

GitHub's highlights of new Git releases

  • git fsck flexibility
  • git status more informative during interactive rebase
  • log --date can use custom formats
  • git log --cc now shows diffs by default
  • The rest of the iceberg
process: download
chmod +x process-html.sh
for i in output-*.html ; do \
./process-html.sh "$$i" 2>/dev/null ; \
echo "" ; \
done | tee processed.md
download:
chmod +x ./download.sh
./download.sh
#!/usr/bin/env bash
set -eu
[ "${DEBUG:-0}" = "1" ] && set -x
file="$1"; shift 1
_debug () { printf "%s\n" "$*" 1>&2 ; }
canonical="$( grep -o -E '<link rel="canonical" href="[^"]+"' "$file" )"
canonical="${canonical##*href=\"}"
canonical="${canonical%%\"*}"
_debug "canonical: $canonical"
h1="$( grep -o -E '<h1 [^>]+>([^<]+)</h1>' "$file" )"
h1="${h1#*>}"
h1="${h1%%<*}"
_debug "h1: '$h1'"
echo "## [$h1]($canonical)"
while read -r line ; do
#echo "line $line"
_debug "line '$line'"
id="${line#*id=\"}"
id="${id%%\"*}"
_debug "id: $id"
h2text="${line#<h2*>}"
_debug "h2text: $h2text"
h2text="${h2text#</a>}"
_debug "h2text: $h2text"
h2text="${h2text%%<a*}"
_debug "h2text: $h2text"
echo " - **[$h2text]($canonical#$id)**"
done <<<"$( \grep -E '^<h2[^>]' "$file" | sed -E 's/<h2 ><a/<h2 /g' )"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment