<commit_before>#!/bin/bash
#
# Author: <NAME> <<EMAIL>>
# License: Apache License
# Added smart mode by pcchou http://about.me/pcchou

function rand(){
    echo $(awk 'BEGIN{srand();print int(rand()*(('$2')-('$1')))+('$1') }')
}

if [ $1 == "normal" ]; then
    pingms=$4
    dlkbps=$2
    ulkbps=$3
elif [ $1 == "smart" ]; then
    dlkbps=$(( $2 * ( 950000 + $(rand -50000 20000) ) / 1000000 ))
    ulkbps=$(( ( $dlkbps * $(rand 9250 9750) ) / 10000 ))
    if [ $4 -ge 4 ]; then
        pingms=$(( $4 + $(rand -3 10)))
    else
        pingms=$4
    fi
else
    echo "This is madness!"
    exit
fi
srv=${5:-2181}

echo $dlkbps
echo $ulkbps
hash=$(echo -n $pingms-$ulkbps-$dlkbps-297aae72 | md5sum | awk '{print $1}')
resultid=$(curl -s -d "download=$dlkbps&ping=$pingms&upload=$ulkbps&promo=&startmode=pingselect&recommendedserverid=2181&accuracy=1&serverid=$srv&hash=$hash" -e http://c.speedtest.net/flash/speedtest.swf http://www.speedtest.net/api/api.php | awk -F=\|\& '{print $2}')

echo "Image: http://www.speedtest.net/result/$resultid.png"
echo "In a webpage: http://www.speedtest.net/my-result/$resultid"<commit_msg>Forgot to remove testing stuff<commit_after>#!/bin/bash
#
# Author: <NAME> <<EMAIL>>
# License: Apache License
# Added smart mode by pcchou http://about.me/pcchou

function rand(){
    echo $(awk 'BEGIN{srand();print int(rand()*(('$2')-('$1')))+('$1') }')
}

if [ $1 == "normal" ]; then
    pingms=$4
    dlkbps=$2
    ulkbps=$3
elif [ $1 == "smart" ]; then
    dlkbps=$(( $2 * ( 950000 + $(rand -50000 20000) ) / 1000000 ))
    ulkbps=$(( ( $dlkbps * $(rand 9250 9750) ) / 10000 ))
    if [ $4 -ge 4 ]; then
        pingms=$(( $4 + $(rand -3 10)))
    else
        pingms=$4
    fi
else
    echo "This is madness!"
    exit
fi
srv=${5:-2181}

hash=$(echo -n $pingms-$ulkbps-$dlkbps-297aae72 | md5sum | awk '{print $1}')
resultid=$(curl -s -d "download=$dlkbps&ping=$pingms&upload=$ulkbps&promo=&startmode=pingselect&recommendedserverid=2181&accuracy=1&serverid=$srv&hash=$hash" -e http://c.speedtest.net/flash/speedtest.swf http://www.speedtest.net/api/api.php | awk -F=\|\& '{print $2}')

echo "Image: http://www.speedtest.net/result/$resultid.png"
echo "In a webpage: http://www.speedtest.net/my-result/$resultid"
{'fraction_non_alphanumeric': 0.2177599286033021, 'fraction_numerical': 0.06247211066488175, 'mean_word_length': 3.72, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3158923', 'n_tokens_mistral': 983, 'n_tokens_neox': 875, 'n_words': 187}