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
import boto3 | |
def get_s3_client(): | |
# Adapted from: | |
# https://gist.github.com/heitorlessa/5b709df96ea6ac5ddc600545c0683d3b?permalink_comment_id=4314586#gistcomment-431458 | |
return boto3.client( | |
service_name="s3", | |
endpoint_url="localhost:9000", | |
aws_access_key_id="root", | |
aws_secret_access_key="password", |
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
import datetime as dt | |
from typing import Any, List, Optional | |
import sqlalchemy as sa | |
import sqlalchemy.orm as orm | |
from llama_index.core.llms import ChatMessage | |
from llama_index.core.storage.chat_store import BaseChatStore | |
from llama_index.core.memory import ChatMemoryBuffer | |
from llama_index.agent.openai import OpenAIAgent |
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
from langchain.schema import StrOutputParser | |
from langchain.prompts import ChatPromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplate | |
from langchain_core.runnables import RunnablePassthrough | |
from langchain_community.chat_models import ChatOpenAI | |
llm = ChatOpenAI(api_key='MY_COOL_API_KEY') | |
PROMPT_SYSTEM = ''' | |
You are an experienced SQL developer and database specialist. |
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
import json | |
import fiona | |
import shapely | |
import shapely.geometry | |
with fiona.open('data/test.geojson', 'r') as f: | |
geom = next(iter(f)) | |
geom = shapely.geometry.shape(geom.geometry) |
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
CONFIG_SENSOR = { | |
'job': jobs.daily, | |
'monitored_assets': [AssetKey(['b3', 'history', 'daily'])], | |
} | |
@multi_asset_sensor(**CONFIG_SENSOR) | |
def daily(context): | |
""" |
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
import io | |
import itertools | |
class IteratorIO(io.RawIOBase): | |
def __init__(self, iterator: [bytes]): | |
super(IteratorIO, self).__init__() | |
self.iterator = iterator | |
def read(self, n: int = -1) -> bytes: |
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
import sys | |
import logging | |
from argparse import ArgumentParser | |
import pandas as pd | |
from pandasql import sqldf | |
fmt = '[%(asctime)s] %(levelname)s [%(name)s:%(lineno)03d] %(message)s' | |
logger = logging.getLogger(__name__) |
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
# Adapted from: | |
# https://mmcloughlin.com/posts/geohash-assembly | |
import math | |
def encode(lat: float, lon: float) -> str: | |
lat = math.floor(2**64 * (lat + 90) / 180) | |
lon = math.floor(2**64 * (lon + 180) / 360) | |
lat = bin(lat)[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
const fs = require('fs') | |
const makeWASocket = require('@adiwajshing/baileys').makeWALegacySocket | |
// Chat id | |
const chadtId = 'numbers-morenumbers@g.us' | |
const sock = makeWASocket({ | |
printQRInTerminal: true | |
}) |
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
version: '3' | |
services: | |
appwrite: | |
image: appwrite/appwrite:0.12.0 | |
environment: | |
- _APP_DB_HOST=mysql | |
- _APP_DB_PORT=3306 | |
- _APP_DB_SCHEMA=appwrite | |
- _APP_DB_USER=user |
NewerOlder