<commit_before>#!/bin/sh
#Bandwidth Usage - TomatoUSB Version

[ -z "${1}" ] && display && exit 1
[ -z "${2}" ] && display && exit 1

LAN0_IFACE=$(nvram get lan_ifname)
LAN1_IFACE=$(nvram get lan1_ifname)
MACNAMES=$(nvram find macnames)
USERSFILE="/etc/hosts.dnsmasq"
[ -f "${USERSFILE}" ] || USERSFILE="/etc/dnsmasq/hosts/hosts"
[ -f "${USERSFILE}" ] || USERSFILE="/dev/null"
MACNAMESFILE=macnames
USAGE_DB="bwmonUsage.db"
USAGE_JS="bwmonUsage.js"
USAGEDB=${2}/${USAGE_DB}
USAGEJS=${2}/${USAGE_JS}

display() {
	echo "Usage : $0 {setup|update} path"
	echo "Parameters: "
	echo "	$0 setup path"
	echo "	$0 update path"
	echo "	$0 publish path"
	echo "Examples: "
	echo "	$0 setup /tmp"
	echo "	$0 update /tmp"
	echo "	$0 publish /tmp"
}

log () {
	logger -p user.info -t $0 "$1"
	echo -p user.info -t $0 "$1"
}

lock() {
	while [ -f /tmp/bwmon.lock ]; do
		if [ ! -d /proc/$(cat /tmp/bwmon.lock) ]; then
			log "WARNING : Lockfile detected but process $(cat /tmp/bwmon.lock) does not exist !"
			rm -f /tmp/bwmon.lock
		fi<commit_msg>store mac to names file in the same folder as usage file<commit_after>#!/bin/sh
#Bandwidth Usage - TomatoUSB Version

[ -z "${1}" ] && display && exit 1
[ -z "${2}" ] && display && exit 1

LAN0_IFACE=$(nvram get lan_ifname)
LAN1_IFACE=$(nvram get lan1_ifname)
MACNAMES=$(nvram find macnames)
USERSFILE="/etc/hosts.dnsmasq"
[ -f "${USERSFILE}" ] || USERSFILE="/etc/dnsmasq/hosts/hosts"
[ -f "${USERSFILE}" ] || USERSFILE="/dev/null"
MACNAMESFILE=${2}/macnames
USAGE_DB="bwmonUsage.db"
USAGE_JS="bwmonUsage.js"
USAGEDB=${2}/${USAGE_DB}
USAGEJS=${2}/${USAGE_JS}

display() {
	echo "Usage : $0 {setup|update} path"
	echo "Parameters: "
	echo "	$0 setup path"
	echo "	$0 update path"
	echo "	$0 publish path"
	echo "Examples: "
	echo "	$0 setup /tmp"
	echo "	$0 update /tmp"
	echo "	$0 publish /tmp"
}

log () {
	logger -p user.info -t $0 "$1"
	echo -p user.info -t $0 "$1"
}

lock() {
	while [ -f /tmp/bwmon.lock ]; do
		if [ ! -d /proc/$(cat /tmp/bwmon.lock) ]; then
			log "WARNING : Lockfile detected but process $(cat /tmp/bwmon.lock) does not exist !"
			rm -f /tmp/bwmon.lock
		fi
{'fraction_non_alphanumeric': 0.19187145557655955, 'fraction_numerical': 0.019376181474480152, 'mean_word_length': 3.7360178970917226, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1626190', 'n_tokens_mistral': 902, 'n_tokens_neox': 875, 'n_words': 226}