<commit_before>#!/bin/bash -x
create_counters_script()
{
  echo "Creating counters datatype"
  sudo riak-admin bucket-type create counters '{"props":{"datatype":"counter"}}'
  echo "Activating counters"
  sudo riak-admin bucket-type activate counters
}

set -e

create_counters_script || true

sudo service riak stop
sleep 10
sudo service riak start
sleep 20

curl -XPUT \
    -H "Content-Type: application/json" \
    -H 'x-riak-index-login_bin: dhadmin' \
    -d "{\"id\": 1, \"login\":\"dhadmin\", \"passwordHash\":\"<PASSWORD>=\", \"passwordSalt\":\"<PASSWORD>\", \"role\":\"ADMIN\", \"status\":\"ACTIVE\", \"loginAttempts\":0, \"lastLogin\":null,\"googleLogin\":null,\"facebookLogin\":null,\"githubLogin\":null,\"entityVersion\":0,\"data\":null}" \
    'http://127.0.0.1:8098/types/default/buckets/user/keys/1'

curl -XPUT \
    -H "Content-Type: application/json" \
    -H 'x-riak-index-login_bin: test_admin' \
    -d "{\"id\": 2, \"login\":\"test_admin\", \"passwordHash\":\"+<PASSWORD>=\", \"passwordSalt\":\"<PASSWORD>\", \"role\":\"ADMIN\", \"status\":\"ACTIVE\", \"loginAttempts\":0, \"lastLogin\":null,\"googleLogin\":null,\"facebookLogin\":null,\"githubLogin\":null,\"entityVersion\":0,\"data\":null}" \
    'http://127.0.0.1:8098/types/default/buckets/user/keys/2'

curl -XPOST \
    -H "Content-Type: application/json" \
    -d '{"increment": 100}' \
    'http://127.0.0.1:8098/types/counters/buckets/dh_counters/datatypes/userCounter'

curl -XPUT \
    -H "Content-Type: application/json" \
    -H 'x-riak-index-label_bin: Access Key for dhadmin' \
    -H 'x-riak-index-userId_int: 2' \
    -H 'x-riak-index-key_bin: <KEY> \
    -H 'x-riak-index-expirationDate_int: -1' \
    -d "{\"id\": 1, \"label\":\"Access Key for dhadmin\", \"key\": \"<KEY>\", \"expirationDate\": null, \"type\":\"DEFAULT\", \"user\":{\"id\":2,\"login\":\"test_admin\",\"passwordHash\":\"+<PASSWORD>=\",\"passwordSalt\":\"<PASSWORD>\",\"loginAttempts\":0,\"role\":\"ADMIN\",\"status\":\"ACTIVE\",\"lastLogin\":null,\"googleLogin\":null,\"facebookLogin\":null,\"githubLogin\":null,\"entityVersion\":1,\"data\":null}, \"permissions\": [{\"id\":null,\"domains\":null,\"subnets\":null,\"actions\":null,\"networkIds\":null,\"deviceGuids\":null}]}" \
    'http://127.0.0.1:8098/types/default/buckets/access_key/keys/1'

curl -XPUT \
    -H "Content-Type: application/json" \
    -H 'x-riak-index-label_bin: Access Key for dhadmin' \
    -H 'x-riak-index-userId_int: 1' \
    -H 'x-riak-index-key_bin: <KEY> \
    -H 'x-riak-index-expirationDate_int: -1' \
    -d "{\"id\": 2, \"label\":\"Access Key for dhadmin\", \"key\": \"<KEY>\", \"expirationDate\": null, \"type\":\"DEFAULT\", \"user\":{\"id\":1,\"login\":\"dhadmin\",\"passwordHash\":\"<PASSWORD>=\",\"passwordSalt\":\"<PASSWORD>\",\"loginAttempts\":0,\"role\":\"ADMIN\",\"status\":\"ACTIVE\",\"lastLogin\":null,\"googleLogin\":null,\"facebookLogin\":null,\"githubLogin\":null,\"entityVersion\":0,\"data\":null}, \"permissions\": [{\"id\":null,\"domains\":null,\"subnets\":null,\"actions\":null,\"networkIds\":null,\"deviceGuids\":null}]}" \
    'http://127.0.0.1:8098/types/default/buckets/access_key/keys/2'

curl -XPOST \
    -H "Content-Type: application/json" \
    -d '{"increment": 100}' \
    'http://127.0.0.1:8098/types/counters/buckets/dh_counters/datatypes/accessKeyCounter'

curl -XPUT \
    -H "Content-Type: application/json" \
    -H 'x-riak-index-name_bin: Sample VirtualLed Device' \
    -d "{\"id\":1, \"name\":\"Sample VirtualLed Device\", \"permanent\": false, \"offlineTimeout\": 600, \"data\":null,\"equipment\":[]}" \
    'http://127.0.0.1:8098/types/default/buckets/device_class/keys/1'

curl -XPOST \
    -H "Content-Type: application/json" \
    -d '{"increment": 100}' \
    'http://127.0.0.1:8098/types/counters/buckets/dh_counters/datatypes/deviceClassCounter'

curl -XPUT \
    -H "Content-Type: application/json" \
    -H 'x-riak-index-name_bin: VirtualLed Sample Network' \
    -d "{\"id\":1,\"key\":null,\"name\":\"VirtualLed Sample Network\", \"description\":\"A DeviceHive network for VirtualLed sample\",\"entityVersion\":null}" \
    'http://127.0.0.1:8098/types/default/buckets/network/keys/1'

curl -XPOST \
    -H "Content-Type: application/json" \
    -d '{"increment": 100}' \
    'http://127.0.0.1:8098/types/counters/buckets/dh_counters/datatypes/networkCounter'

curl -XPUT \
    -H "Content-Type: application/json" \
    -H 'x-riak-index-guid_bin: E50D6085-2ABA-48E9-B1C3-73C673E414BE' \
    -d "{\"id\":1, \"guid\":\"E50D6085-2ABA-48E9-B1C3-73C673E414BE\", \"name\":\"Sample VirtualLed Device\", \"status\":\"Offline\", \"network\": {\"id\":1,\"key\":null,\"name\":\"VirtualLed Sample Network\", \"description\":\"A DeviceHive network for VirtualLed sample\",\"entityVersion\":null}, \"deviceClass\":{\"id\":1, \"name\":\"Sample VirtualLed Device\", \"permanent\": false, \"offlineTimeout\": 600, \"data\":null,\"equipment\":null}, \"blocked\":null}" \
    'http://127.0.0.1:8098/types/default/buckets/device/keys/1'

curl -XPOST \
    -H "Content-Type: application/json" \
    -d '{"increment": 100}' \
    'http://127.0.0.1:8098/types/counters/buckets/dh_counters/datatypes/deviceCounter'

curl -XPUT \
    -H "Content-Type: application/json" \
    -d "{\"value\":\"true\"}" \
    'http://127.0.0.1:8098/types/default/buckets/configuration/keys/google.identity.allowed'

curl -XPUT \
    -H "Content-Type: application/json" \
    -d "{\"value\":\"google_id\}"" \
    'http://127.0.0.1:8098/types/default/buckets/configuration/keys/google.identity.client.id'

curl -XPUT \
    -H "Content-Type: application/json" \
    -d "{\"value\":\"true\"}" \
    'http://127.0.0.1:8098/types/default/buckets/configuration/keys/facebook.identity.allowed'

curl -XPUT \
    -H "Content-Type: application/json" \
    -d "{\"value\":\"facebook_id\"}" \
    'http://127.0.0.1:8098/types/default/buckets/configuration/keys/facebook.identity.client.id'
<commit_msg>Fixed typo in riak initial data script<commit_after>#!/bin/bash -x
create_counters_script()
{
  echo "Creating counters datatype"
  sudo riak-admin bucket-type create counters '{"props":{"datatype":"counter"}}'
  echo "Activating counters"
  sudo riak-admin bucket-type activate counters
}

set -e

create_counters_script || true

sudo service riak stop
sleep 10
sudo service riak start
sleep 20

curl -XPUT \
    -H "Content-Type: application/json" \
    -H 'x-riak-index-login_bin: dhadmin' \
    -d "{\"id\": 1, \"login\":\"dhadmin\", \"passwordHash\":\"<PASSWORD>=\", \"passwordSalt\":\"<PASSWORD>\", \"role\":\"ADMIN\", \"status\":\"ACTIVE\", \"loginAttempts\":0, \"lastLogin\":null,\"googleLogin\":null,\"facebookLogin\":null,\"githubLogin\":null,\"entityVersion\":0,\"data\":null}" \
    'http://127.0.0.1:8098/types/default/buckets/user/keys/1'

curl -XPUT \
    -H "Content-Type: application/json" \
    -H 'x-riak-index-login_bin: test_admin' \
    -d "{\"id\": 2, \"login\":\"test_admin\", \"password<PASSWORD>\":\"+<PASSWORD>=\", \"passwordSalt\":\"<PASSWORD>\", \"role\":\"ADMIN\", \"status\":\"ACTIVE\", \"loginAttempts\":0, \"lastLogin\":null,\"googleLogin\":null,\"facebookLogin\":null,\"githubLogin\":null,\"entityVersion\":0,\"data\":null}" \
    'http://127.0.0.1:8098/types/default/buckets/user/keys/2'

curl -XPOST \
    -H "Content-Type: application/json" \
    -d '{"increment": 100}' \
    'http://127.0.0.1:8098/types/counters/buckets/dh_counters/datatypes/userCounter'

curl -XPUT \
    -H "Content-Type: application/json" \
    -H 'x-riak-index-label_bin: Access Key for dhadmin' \
    -H 'x-riak-index-userId_int: 2' \
    -H 'x-riak-index-key_bin: <KEY> \
    -H 'x-riak-index-expirationDate_int: -1' \
    -d "{\"id\": 1, \"label\":\"Access Key for dhadmin\", \"key\": \"<KEY> \"expirationDate\": null, \"type\":\"DEFAULT\", \"user\":{\"id\":2,\"login\":\"test_admin\",\"passwordHash\":\"+<PASSWORD>7j3xaireg=\",\"passwordSalt\":\"<PASSWORD>\",\"loginAttempts\":0,\"role\":\"ADMIN\",\"status\":\"ACTIVE\",\"lastLogin\":null,\"googleLogin\":null,\"facebookLogin\":null,\"githubLogin\":null,\"entityVersion\":1,\"data\":null}, \"permissions\": [{\"id\":null,\"domains\":null,\"subnets\":null,\"actions\":null,\"networkIds\":null,\"deviceGuids\":null}]}" \
    'http://127.0.0.1:8098/types/default/buckets/access_key/keys/1'

curl -XPUT \
    -H "Content-Type: application/json" \
    -H 'x-riak-index-label_bin: Access Key for dhadmin' \
    -H 'x-riak-index-userId_int: 1' \
    -H 'x-riak-index-key_bin: <KEY> \
    -H 'x-riak-index-expirationDate_int: -1' \
    -d "{\"id\": 2, \"label\":\"Access Key for dhadmin\", \"key\": \"<KEY> \"expirationDate\": null, \"type\":\"DEFAULT\", \"user\":{\"id\":1,\"login\":\"dhadmin\",\"passwordHash\":\"<PASSWORD>=\",\"passwordSalt\":\"<PASSWORD>\",\"loginAttempts\":0,\"role\":\"ADMIN\",\"status\":\"ACTIVE\",\"lastLogin\":null,\"googleLogin\":null,\"facebookLogin\":null,\"githubLogin\":null,\"entityVersion\":0,\"data\":null}, \"permissions\": [{\"id\":null,\"domains\":null,\"subnets\":null,\"actions\":null,\"networkIds\":null,\"deviceGuids\":null}]}" \
    'http://127.0.0.1:8098/types/default/buckets/access_key/keys/2'

curl -XPOST \
    -H "Content-Type: application/json" \
    -d '{"increment": 100}' \
    'http://127.0.0.1:8098/types/counters/buckets/dh_counters/datatypes/accessKeyCounter'

curl -XPUT \
    -H "Content-Type: application/json" \
    -H 'x-riak-index-name_bin: Sample VirtualLed Device' \
    -d "{\"id\":1, \"name\":\"Sample VirtualLed Device\", \"permanent\": false, \"offlineTimeout\": 600, \"data\":null,\"equipment\":[]}" \
    'http://127.0.0.1:8098/types/default/buckets/device_class/keys/1'

curl -XPOST \
    -H "Content-Type: application/json" \
    -d '{"increment": 100}' \
    'http://127.0.0.1:8098/types/counters/buckets/dh_counters/datatypes/deviceClassCounter'

curl -XPUT \
    -H "Content-Type: application/json" \
    -H 'x-riak-index-name_bin: VirtualLed Sample Network' \
    -d "{\"id\":1,\"key\":null,\"name\":\"VirtualLed Sample Network\", \"description\":\"A DeviceHive network for VirtualLed sample\",\"entityVersion\":null}" \
    'http://127.0.0.1:8098/types/default/buckets/network/keys/1'

curl -XPOST \
    -H "Content-Type: application/json" \
    -d '{"increment": 100}' \
    'http://127.0.0.1:8098/types/counters/buckets/dh_counters/datatypes/networkCounter'

curl -XPUT \
    -H "Content-Type: application/json" \
    -H 'x-riak-index-guid_bin: E50D6085-2ABA-48E9-B1C3-73C673E414BE' \
    -d "{\"id\":1, \"guid\":\"E50D6085-2ABA-48E9-B1C3-73C673E414BE\", \"name\":\"Sample VirtualLed Device\", \"status\":\"Offline\", \"network\": {\"id\":1,\"key\":null,\"name\":\"VirtualLed Sample Network\", \"description\":\"A DeviceHive network for VirtualLed sample\",\"entityVersion\":null}, \"deviceClass\":{\"id\":1, \"name\":\"Sample VirtualLed Device\", \"permanent\": false, \"offlineTimeout\": 600, \"data\":null,\"equipment\":null}, \"blocked\":null}" \
    'http://127.0.0.1:8098/types/default/buckets/device/keys/1'

curl -XPOST \
    -H "Content-Type: application/json" \
    -d '{"increment": 100}' \
    'http://127.0.0.1:8098/types/counters/buckets/dh_counters/datatypes/deviceCounter'

curl -XPUT \
    -H "Content-Type: application/json" \
    -d "{\"value\":\"true\"}" \
    'http://127.0.0.1:8098/types/default/buckets/configuration/keys/google.identity.allowed'

curl -XPUT \
    -H "Content-Type: application/json" \
    -d "{\"value\":\"google_id\"}" \
    'http://127.0.0.1:8098/types/default/buckets/configuration/keys/google.identity.client.id'

curl -XPUT \
    -H "Content-Type: application/json" \
    -d "{\"value\":\"true\"}" \
    'http://127.0.0.1:8098/types/default/buckets/configuration/keys/facebook.identity.allowed'

curl -XPUT \
    -H "Content-Type: application/json" \
    -d "{\"value\":\"facebook_id\"}" \
    'http://127.0.0.1:8098/types/default/buckets/configuration/keys/facebook.identity.client.id'

{'fraction_non_alphanumeric': 0.25285618279569894, 'fraction_numerical': 0.043010752688172046, 'mean_word_length': 3.453797231575009, 'pattern_counts': {'":': 236, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 32, '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': '254785', 'n_tokens_mistral': 4750, 'n_tokens_neox': 4434, 'n_words': 610}