Skip to content

Instantly share code, notes, and snippets.

from qdrant_client import QdrantClient
from qdrant_client.models import PointStruct, PointsBatch, Batch, Filter, FieldCondition, MatchValue, VectorParams, Distance
from openai import OpenAI
from langchain_core.documents import Document
from langchain_community.document_loaders import TextLoader
from langchain_openai.embeddings import OpenAIEmbeddings
from dotenv import load_dotenv
import os
import uuid
@konradzdunczyk
konradzdunczyk / gist:3c07012b68cf4cf2185945242e544a21
Last active May 24, 2024 17:54
How to install cocapods like a champ (or other ruby-based tools)

How to install cocapods like a champ (or other ruby-based tools)

I want to share with you how I manage my toolset as iOS developer. iOS development is based on 3rd party tools (like cocapods, fastlane) and those tools are, mostly, writen in ruby. So we need to take care of ruby environment if we want to our work be no problematic and efficiant.

First of all - default macOS ruby is shit. Just accept that. We need to replace it and the best way to do it is a tool like rbenv. Rbenv is not only tool for this job, but it's good to start.

Second - brew is an excellent tool but not everything need to be installed via it. I know, it's tempting to use only one package manager for everything but life is life and it's not perfect.

So if you have issues like this:

extension DispatchQueue {
func safeSync(execute block: () -> Void) {
if isCurrent {
block()
} else {
self.sync(execute: block)
}
}
private var isCurrent: Bool {
@konradzdunczyk
konradzdunczyk / pr.md
Created August 15, 2017 11:30 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@konradzdunczyk
konradzdunczyk / introrx.md
Created April 22, 2017 20:14 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@konradzdunczyk
konradzdunczyk / JaSON.swift
Created November 10, 2016 00:14 — forked from jarsen/JaSON.swift
JSON Value Extraction in Swift. Blog post here http://jasonlarsen.me/2015/10/16/no-magic-json-pt3.html
import Foundation
//
// MARK: - JSONError Type
//
public enum JSONError: ErrorType, CustomStringConvertible {
case KeyNotFound(key: JSONKeyType)
case NullValue(key: JSONKeyType)
case TypeMismatch(expected: Any, actual: Any)