<commit_before>#!/bin/bash

server="http://$API_HOST:8080"
keys=$(wget $server/keys --content-on-error -q -O -)

##### START ACTUAL IMPLEMENTATION

# TODO: This is a super dirty hack. Directly printing the output into
# stdout, however, doesn't work. I have no fucking clue and this is
# super weird.
#
# Even with the solution below (the hack) we get random login failures
# here and there. Someone with better bash and debugging skills than me
# needs to take a look.
#
# The following code does not work:

# while read -r key; do
#   printf "$key\n"
# done <<< "$keys"

##### END ACTUAL IMPLEMENTATION
##### START HACKY TEMPORARY SOLUTION

# Empty the keys file or create it.
:> /home/api/keys

while read -r key; do
  printf '%s\n' "command=\"/bin/bash ~/retrieve-token.sh '${key}'\" ${key}" >> /home/api/keys
done <<< "$keys"

cat /home/api/keys

##### END HACKY TEMPORARY SOLUTION
<commit_msg>Add additional authorized keys options.<commit_after>#!/bin/bash

server="http://$API_HOST:8080"
keys=$(wget $server/keys --content-on-error -q -O -)
options="no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty"
command="/bin/bash ~/retrieve-token.sh"

##### START ACTUAL IMPLEMENTATION

# TODO: This is a super dirty hack. Directly printing the output into
# stdout, however, doesn't work. I have no fucking clue and this is
# super weird.
#
# Even with the solution below (the hack) we get random login failures
# here and there. Someone with better bash and debugging skills than me
# needs to take a look.
#
# The following code does not work:

# while read -r key; do
#   printf "$key\n"
# done <<< "$keys"

##### END ACTUAL IMPLEMENTATION
##### START HACKY TEMPORARY SOLUTION

# Empty the keys file or create it.
:> /home/api/keys

while read -r key; do
  printf '%s\n' "$options,command=\"$command '$key'\" $key" >> /home/api/keys
done <<< "$keys"

cat /home/api/keys

##### END HACKY TEMPORARY SOLUTION

{'fraction_non_alphanumeric': 0.14568158168574402, 'fraction_numerical': 0.005202913631633715, 'mean_word_length': 3.918158567774936, 'pattern_counts': {'":': 0, '<': 15, '<?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': '4143160', 'n_tokens_mistral': 671, 'n_tokens_neox': 630, 'n_words': 236}