<commit_before>#!/bin/sh

LOG_FILE=$1

if [ -z "$LOG_FILE" ]; then
    exit 1
fi

cat ${LOG_FILE} | grep ' 302 ' | grep -iE 'firefox-(28|latest)' | awk '{print "lpush geoip 0," $3}' >> /tmp/redis-commands.txt

cat /tmp/redis-commands.txt | redis-cli && rm /tmp/redis-commands.txt<commit_msg>Parameterize firefox version for log filtering.<commit_after>#!/bin/sh

LOG_FILE=$1

if [ -z "$LOG_FILE" ]; then
    exit 1
fi

if [ -z "${FIREFOX_VERSION}" ]; then
    FIREFOX_VERSION=28
fi

cat ${LOG_FILE} | grep ' 302 ' | grep -iE "firefox-(${FIREFOX_VERSION}|latest)" | awk '{print "lpush geoip 0," $3}' >> /tmp/redis-commands.txt

cat /tmp/redis-commands.txt | redis-cli && rm /tmp/redis-commands.txt
{'fraction_non_alphanumeric': 0.1839080459770115, 'fraction_numerical': 0.02586206896551724, 'mean_word_length': 3.741496598639456, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2107237', 'n_tokens_mistral': 298, 'n_tokens_neox': 275, 'n_words': 66}