This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index.delete(delete_all=True, namespace='example-namespace') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index.upsert( | |
vectors=[ | |
{ | |
"id": "order1#chunk1", | |
"values": [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1], | |
"metadata": {"user_id": 3046, "url": "https://example.com"} | |
}, | |
{ | |
"id": "order2#chunk2", | |
"values": [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for ids in index.list(prefix='order1#', namespace='orders'): | |
print(ids) # ['order1#chunk1', 'order1#chunk2', 'order1#chunk3'] | |
index.delete(ids=ids, namespace=namespace) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Iterate over all chunks from order #1 | |
for ids in index.list(prefix='order1#', namespace='orders'): | |
print(ids) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index = pc.Index("serverless-index") | |
index.upsert( | |
vectors=[ | |
{"id": "order1#chunk1", "values": [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]}, | |
{"id": "order1#chunk2", "values": [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2]}, | |
{"id": "order1#chunk3", "values": [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3]}, | |
{"id": "order1#chunk4", "values": [0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4]} | |
], | |
namespace="orders" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
TARGET_RELEASE="1.5.3" | |
cd "$(mktemp -d)" || exit | |
wget https://releases.hashicorp.com/nomad/${TARGET_RELEASE}/nomad_${TARGET_RELEASE}_linux_amd64.zip | |
unzip nomad_${TARGET_RELEASE}_linux_amd64.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
workflows: | |
# We need to upgrade this version to 2 across all our repos to be able to use the context nodes! | |
version: 1 | |
build-and-test: | |
jobs: | |
- test: | |
context: | |
- Gruntwork Admin | |
filters: | |
tags: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
YEAR=$(date +"%Y") | |
FULLNAME="Gruntwork, LLC" | |
function create_license { | |
cat << EOF > LICENSE.txt | |
MIT License | |
Copyright (c) 2016 to $YEAR, $FULLNAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "Upgrading CircleCI workflows syntax to 2..." | |
yq w -i .circleci/config.yml 'workflows.version' 2 | |
# remove stray merge tags from the final output | |
sed -i '/!!merge /d' .circleci/config.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# We renamed a ton of our repos to the Terraform Registry naming format. This script uses grep and sed to search for | |
# references to the old names and replace them with the new names. | |
# Bash doesn't have a good way to escape quotes in strings. The official solution is to list multiple strings next | |
# to each other (https://stackoverflow.com/a/28786747/483528), but that becomes unreadable, especially with regex. | |
# Therefore, to make our regex more readable, we are declaring clearly-named variables for the special characters we | |
# want to match, and including those in a string with no need for escaping or crazy concatenation | |
readonly DOUBLE_QUOTE='"' | |
readonly SINGLE_QUOTE="'" |
NewerOlder