<commit_before>#!/bin/bash
# Author: <NAME> <<EMAIL>>

dev=${1:-eth0}

packages=`cat /sys/class/net/$dev/statistics/rx_packets `
bytes=`cat /sys/class/net/$dev/statistics/rx_bytes `

interval=3

trap 'break' INT
while [ 1 -eq 1 ]  ; do
    sleep $interval
    n_packages=`cat /sys/class/net/$dev/statistics/rx_packets `
    n_bytes=`cat /sys/class/net/$dev/statistics/rx_bytes `
    python -c "print '%0.2f pkt/s %0.2f byte/s' % ((float($n_packages-$packages)/int($interval), (float($n_bytes-$bytes)/int($interval))))"
    packages=$n_packages
    bytes=$n_bytes
done<commit_msg>encapulate same codes into functions<commit_after>#!/bin/bash
# Author: <NAME> <<EMAIL>>

dev=${1:-eth0}

function get_rx_packets()
{
    echo  `cat /sys/class/net/$dev/statistics/rx_packets `
}

function get_rx_bytes()
{
    echo `cat /sys/class/net/$dev/statistics/rx_bytes `
}

packages=$(get_rx_packets)
bytes=$(get_rx_bytes)

interval=3

trap 'break' INT
while [ 1 -eq 1 ]  ; do
    sleep $interval
    n_packages=$(get_rx_packets)
    n_bytes=$(get_rx_bytes)
    python -c "print '%0.2f pkt/s %0.2f byte/s' % ((float($n_packages-$packages)/int($interval), (float($n_bytes-$bytes)/int($interval))))"
    packages=$n_packages
    bytes=$n_bytes
done
{'fraction_non_alphanumeric': 0.18019480519480519, 'fraction_numerical': 0.01461038961038961, 'mean_word_length': 4.314655172413793, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5301608', 'n_tokens_mistral': 484, 'n_tokens_neox': 473, 'n_words': 81}