Skip to content

Instantly share code, notes, and snippets.

View zhibor's full-sized avatar
:octocat:

Zhibo zhibor

:octocat:
View GitHub Profile
@zhibor
zhibor / README.md
Created December 14, 2024 14:59
neo4j in docker
docker run -d \
    -p 7474:7474 -p 7687:7687 \
    --env NEO4J_PLUGINS='["apoc", "apoc-extended", "graph-data-science", "n10s"]' \
    --name=neo4j \
    --restart=unless-stopped \
    neo4j:5.20
@zhibor
zhibor / neo4j_python_connection_class.py
Created September 20, 2024 17:52
a helper class to connect to neo4j
class Neo4jConnection:
def __init__(self, uri, user, pwd):
self.__uri = uri
self.__user = user
self.__pwd = pwd
self.__driver = None
try:
self.__driver = GraphDatabase.driver(self.__uri, auth=(self.__user, self.__pwd))
except Exception as e:
@zhibor
zhibor / neo4j_python_connection_class.py
Created September 20, 2024 17:51
a helper class to connect to neo4j
class Neo4jConnection:
def __init__(self, uri, user, pwd):
self.__uri = uri
self.__user = user
self.__pwd = pwd
self.__driver = None
try:
self.__driver = GraphDatabase.driver(self.__uri, auth=(self.__user, self.__pwd))
except Exception as e:
@zhibor
zhibor / ell-client_example.py
Last active September 19, 2024 01:00
ell The Language Model Programming Library client example
import ell
import openai
import ell.lmp.simple
ell.config.verbose = True
client = openai.Client(base_url='http://localhost:11434/v1/', api_key='ollama')
@zhibor
zhibor / chunk_iterable.py
Created September 3, 2024 22:27
Break a large iterable into an iterable of smaller iterables
import srsly
def chunk_iterable(item_list: list[JsonBlob], chunksize: int) -> Iterator[list[JsonBlob]]:
"""
Break a large iterable into an iterable of smaller iterables
"""
for i in range(0, len(item_list), chunksize):
yield item_list[i : i + chunksize]
@zhibor
zhibor / mobile-pay-graph-schema.dot
Created August 31, 2024 20:13
mobile-pay-graph-schema
graph LR
User[User]
Device[Device]
Transaction[Transaction]
Account[Account]
MerchantAccount[Merchant Account]
IPAddress[IP Address]
PhoneNumber[Phone Number]
DigitalWallet[Digital Wallet]
Token[Token]
@zhibor
zhibor / config.json
Created August 31, 2024 19:42
Continue.dev in VS Code
{
"models": [
{
"model": "llama3.1:8b-instruct-q6_K",
"title": "Llama3.1-8b-instruct (ollama)",
"contextLength": 8192,
"completionOptions": {
"stop": ["<|eot_id|>"],
"maxTokens": 7000
@zhibor
zhibor / quadrant_chart.py
Created August 30, 2024 23:33
quadrant chart
def quadrant_chart(x, y, xtick_labels=None, ytick_labels=None, data_labels=None,
highlight_quadrants=None, ax=None):
"""
Create the classic four-quadrant chart.
Args:
x -- array-like, the x-coordinates to plot
y -- array-like, the y-coordinates to plot
xtick_labels -- list, default: None, a two-value list xtick labels
ytick_labels -- list, default: None, a two-value list of ytick labels
data_labels -- array-like, default: None, data point annotations