<commit_before>#!/bin/sh

# DEBUG VERSION
UPDATE_URL=http://localhost:7996/api/spaceDevices
# UPDATE_URL=https://status.kreativitaet-trifft-technik.de/api/spaceDevices
PASSWORD=<PASSWORD>

# DEBUG VERSION
# MAC_LIST=$(cat sample.data | grep -v 'IP' | awk '{printf "\"%s\",", $4}')
MAC_LIST=$(arp | grep -v 'IP' | awk '{printf "\"%s\",", $4}')

JSON_START="{\"devices\":[X"
JSON_END="]}"

DATA="${JSON_START} ${MAC_LIST%?} ${JSON_END}"
echo $DATA > dataToSend
STATUS=$(curl -s -k -H "Authorization: $PASSWORD" -H "Accept: application/json" -H "Content-type: application/json" -X PUT -d @dataToSend "$UPDATE_URL" \
| grep status | grep -c ok)
echo $STATUS<commit_msg>script updated for our spacegate<commit_after>#!/bin/sh

# DEBUG VERSION
#UPDATE_URL=http://localhost:7996/api/spaceDevices
UPDATE_URL=https://status.kreativitaet-trifft-technik.de/api/spaceDevices
PASSWORD=<PASSWORD>

# DEBUG VERSION
# MAC_LIST=$(cat sample.data | grep -v 'IP' | awk '{printf "\"%s\",", $4}')
MAC_LIST=$(cat /proc/net/arp | grep -v 'IP' | awk '{printf "\"%s\",", $4}')

JSON_START="{\"devices\":["
JSON_END="]}"

DATA="${JSON_START} ${MAC_LIST%?} ${JSON_END}"
echo $DATA > dataToSend
RESULT=$(curl -s -k -H "Authorization: $PASSWORD" -H "Accept: application/json" -H "Content-type: application/json" -X PUT -d @dataToSend "$UPDATE_URL")
STATUS=$(echo $RESULT | grep -c ok)
echo $STATUS
{'fraction_non_alphanumeric': 0.21198830409356725, 'fraction_numerical': 0.008771929824561403, 'mean_word_length': 5.251141552511416, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '3813312', 'n_tokens_mistral': 534, 'n_tokens_neox': 526, 'n_words': 118}