<commit_before>#!/bin/bash
# backup mirrors and rank the new ones

E_XCD=86							# Can't change directory?
DIR=~/comp/arch
cd "$DIR"

# Doublecheck if in right directory
if [ `pwd` != "$DIR" ]				# Not in ~/comp/arch?
then
  echo "Can't change to $DIR."
  exit $E_XCD
fi

# check if the rankmirrors command is available
if command -v rankmirrors >/dev/null 2>&1
then
	if [[ -r "mirrorlist" ]]
	then
		echo "Ranking mirrors..."
		sed 's/#Server/Server/' <mirrorlist >uncommented
		rankmirrors -n 10 uncommented > mirrorlist
		S=$(grep -i 'generated on' mirrorlist | grep -oE '[-0-9]+')
		mv mirrorlist mirrorlist_$S
		echo "New mirrorlist created: mirrorlist_$S."<commit_msg>add some verbosity to the rankmi.sh script<commit_after>#!/bin/bash
# backup mirrors and rank the new ones

E_XCD=86							# Can't change directory?
DIR=~/comp/arch
cd "$DIR"

# Doublecheck if in right directory
if [ `pwd` != "$DIR" ]				# Not in ~/comp/arch?
then
  echo "Can't change to $DIR."
  exit $E_XCD
fi

# check if the rankmirrors command is available
if command -v rankmirrors >/dev/null 2>&1
then
	if [[ -r "mirrorlist" ]]
	then
		echo "Ranking mirrors..."
		sed 's/#Server/Server/' <mirrorlist >uncommented
		rankmirrors -n 10 uncommented > mirrorlist
		DATE=$(grep -i 'generated on' mirrorlist | grep -oE '[-0-9]+')
		mv mirrorlist mirrorlist_${DATE}
		echo "New mirrorlist created: ${DIR}/mirrorlist_${DATE}."
		echo ""
		echo "For the list to be used by the system do:"
		echo "sudo cp ${DIR}/mirrolist_${DATE} /etc/pacman.d/mirrorlist"
{'fraction_non_alphanumeric': 0.13686967910936476, 'fraction_numerical': 0.010478061558611657, 'mean_word_length': 3.658536585365854, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1591718', 'n_tokens_mistral': 603, 'n_tokens_neox': 547, 'n_words': 184}