Skip to content

Instantly share code, notes, and snippets.

View bobvanluijt's full-sized avatar

Bob van Luijt bobvanluijt

View GitHub Profile
@bobvanluijt
bobvanluijt / install.sh
Last active December 26, 2023 18:03
Install CUDA on Ubuntu 22.04 + transformers
# Assumes Ubuntu 22.04
$ sudo apt-get update && \
sudo apt-get -y install gcc && \
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin && \
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600 && \
wget https://developer.download.nvidia.com/compute/cuda/12.3.1/local_installers/cuda-repo-ubuntu2204-12-3-local_12.3.1-545.23.08-1_amd64.deb && \
sudo dpkg -i cuda-repo-ubuntu2204-12-3-local_12.3.1-545.23.08-1_amd64.deb && \
sudo cp /var/cuda-repo-ubuntu2204-12-3-local/cuda-*-keyring.gpg /usr/share/keyrings/ && \
sudo apt-get update && \
sudo apt-get -y install cuda-toolkit-12-3 nvidia-cuda-toolkit python3-pip nvtop && \
@bobvanluijt
bobvanluijt / connect-to-weaviate-using-API-key.js
Created March 26, 2023 17:28
Connect to Weaviate using an API-key using JavaScript
const weaviate = require("weaviate-ts-client");
// Create a secret based on the API key
const apiKey = new weaviate.ApiKey("4jne...9me1");
// Create client objects
const client = weaviate.client({
scheme: 'https',
host: 'your-cluster.weaviate.network',
apiKey: apiKey,
@bobvanluijt
bobvanluijt / connect-to-weaviate-using-API-key.py
Created March 26, 2023 17:28
Connect to Weaviate using an API-key using Python
import weaviate
# Set the Weaviate URL
url = "https://your-cluster.weaviate.network"
# Create a secret based on the API key
my_secret_key = weaviate.AuthApiKey(api_key="4jne...9me1")
# Create client objects
client = weaviate.Client(url, auth_client_secret=my_secret_key)
@bobvanluijt
bobvanluijt / connect-to-weaviate-using-API-key.sh
Created March 26, 2023 17:28
Connect to Weaviate using an API-key using cURL
$ curl \
-H "Authorization: Bearer 4jne...9me1" \
https://your-cluster.weaviate.network/v1/meta
@bobvanluijt
bobvanluijt / sphere-single-jsonl-example.json
Last active September 20, 2022 11:36
This example is a single entry from the 960M Sphere Weaviate dataset
{
"id": "9f683bbb-a826-11eb-8c6c-e778e9b30943",
"url": "https://hcicolombo.gov.in/pages?id=eyJpdiI6IkgzT1ZLY2ZPOWNKMXNOZWZydlwvNkRBPT0iLCJ2YWx1ZSI6IkJzMUpBYlhURjVaMENkZ2thY09ncVE9PSIsIm1hYyI6ImJjZTM4NjM5NTFkNGU3MjEzM2IwMDYyZjdmY2QwNTUwN2IyYWFkMjQ1Y2ViYWFmNjdjOWIxNGVjYjY4ZmVmYWYifQ==&subid=eyJpdiI6InB1NysxYXFCK0hxWlNTQXBoMm9mcWc9PSIsInZhbHVlIjoieDl2V1BhWktSNGU4aUxPZWN4akhmQT09IiwibWFjIjoiYzFlODU1NTRmZDI2MmFjZTE4NzZiMzdjODcyODMzNTA0MjU1ZmY1OGIyYjBhMTg5MzM5NjVkM2NhMjFkY2U5NCJ9",
"title": "Welcome to High Commission of India, Colombo, Sri Lanka",
"sha": "sha1:LFWBZ4WVRD5AGSI42HZJ57BLQYIG6CQF",
"raw": "Welcome to High Commission of India, Colombo, Sri Lanka Affairs Minister Smt. Sushma Swaraj led an inter-ministerial delegation to Colombo from 5-6 February 2016 for the 9th Session of the India-Sri Lanka Joint Commission. Earlier, External Affairs Minister Smt. Sushma Swaraj was in Colombo on 6-7 March 2015 to prepare for Prime Minister’s visit. EAM visited from 31 August-01 September 2017 to attend the s
@bobvanluijt
bobvanluijt / gist:d438585ed80e487ba0bba29da3a46044
Created June 29, 2022 15:41
Nginx config file to make Weaviate read only
##
# Read only Weaviate config.
# Update the comments in the config file below
#
# The setup assumes that Nginx can find the Weaviate instance
# or cluster on http://weaviate-server:4001 (this can be updated)
#
##
server {
listen 4000 default_server; # port 4000 is where the nginx config listens to
{
Get {
Paragraph(
nearText: {
concepts: ["jazz saxophone players"]
}
limit: 25
) {
content
order
{
Get {
Paragraph(
ask: {
question: "What was Michael Brecker's first saxophone?"
properties: ["content"]
}
where: {
operator: Equal
path: ["inArticle", "Article", "title"]
{
Get {
Paragraph(
nearText: {
concepts: ["Italian food"]
}
limit: 50
) {
content
order
{
Get {
Paragraph(
ask: {
question: "Where is the States General of The Netherlands located?"
properties: ["content"]
}
limit: 1
) {
_additional {