<commit_before>#!/usr/bin/env bash

# Usage:
#

OUT="$1"

echo $(dirname $1)

if [ -r $1 ]; then

echo 'Validating generated HTML…'
# Validate output HTML
curl -H "Content-Type: text/html; charset=utf-8" \
  --data-binary @"$OUT" \
  https://validator.w3.org/nu/?out=gnu

# Copyright 2011 <NAME>
# New BSD License
#
# Known bug: &, &ampt;, and &<anything>.

# Modified slightly from <https://bitbucket.org/livibetter/lnkckr/src/tip/linkckr.sh>

# Note on colors: I had to replace \e in the original script with \033
# per <http://apple.stackexchange.com/questions/74777/echo-color-coding-stopped-working-in-mountain-lion>,
# which looks to be OS X-specific.

echo 'Checking links…'
xmllint --shell --html "$OUT" <<<"cat //a[starts-with(@href,'http')]" | egrep -o 'https?:[^"]*' | sort | uniq | head -1 |
while read url; do
	# curl: -s silent, -I header only, -L follow Location, -m 10 sec timeout, -w output format
	read resp_code eff_url <<<"$(curl -s -I -L -m 10 -w '%{http_code} %{url_effective}\n' "$url" | sed '$q;d')"
	case "$resp_code" in
		2*)
			echo -ne "\033[32;1m"<commit_msg>Forgot to remove the head from testing<commit_after>#!/usr/bin/env bash

# Usage:
#

OUT="$1"

echo $(dirname $1)

if [ -r $1 ]; then

echo 'Validating generated HTML…'
# Validate output HTML
curl -H "Content-Type: text/html; charset=utf-8" \
  --data-binary @"$OUT" \
  https://validator.w3.org/nu/?out=gnu

# Copyright 2011 <NAME>
# New BSD License
#
# Known bug: &, &ampt;, and &<anything>.

# Modified slightly from <https://bitbucket.org/livibetter/lnkckr/src/tip/linkckr.sh>

# Note on colors: I had to replace \e in the original script with \033
# per <http://apple.stackexchange.com/questions/74777/echo-color-coding-stopped-working-in-mountain-lion>,
# which looks to be OS X-specific.

echo 'Checking links…'
xmllint --shell --html "$OUT" <<<"cat //a[starts-with(@href,'http')]" | egrep -o 'https?:[^"]*' | sort | uniq | # head -1 |
while read url; do
	# curl: -s silent, -I header only, -L follow Location, -m 10 sec timeout, -w output format
	read resp_code eff_url <<<"$(curl -s -I -L -m 10 -w '%{http_code} %{url_effective}\n' "$url" | sed '$q;d')"
	case "$resp_code" in
		2*)
			echo -ne "\033[32;1m"
{'fraction_non_alphanumeric': 0.18656377666817975, 'fraction_numerical': 0.026327734906945077, 'mean_word_length': 3.649789029535865, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 11, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3159895', 'n_tokens_mistral': 912, 'n_tokens_neox': 838, 'n_words': 247}