Skip to content

Instantly share code, notes, and snippets.

@sabatale
sabatale / jsonloader_llm.py
Created January 6, 2024 19:31
Generic JSON Loader for Langchain Python
"""See https://github.com/langchain-ai/langchain/issues/4396 for original author."""
"""Loader that loads data from JSON."""
import json
from pathlib import Path
from typing import Callable, Dict, List, Optional, Union
from langchain.docstore.document import Document
from langchain.document_loaders.base import BaseLoader
[{"iata":"AAA","name":"Anaa Airport"},{"iata":"AAB","name":"Arrabury Airport"},{"iata":"AAC","name":"El Arish International Airport"},{"iata":"AAE","name":"Annaba Airport"},{"iata":"AAF","name":"Apalachicola Regional Airport"},{"iata":"AAG","name":"Arapoti Airport"},{"iata":"AAH","name":"Aachen-Merzbruck Airport"},{"iata":"AAI","name":"Arraias Airport"},{"iata":"AAJ","name":"Cayana Airstrip"},{"iata":"AAK","name":"Buariki Airport"},{"iata":"AAL","name":"Aalborg Airport"},{"iata":"AAM","name":"Malamala Airport"},{"iata":"AAN","name":"Al Ain International Airport"},{"iata":"AAO","name":"Anaco Airport"},{"iata":"AAQ","name":"Anapa Airport"},{"iata":"AAR","name":"Aarhus Airport"},{"iata":"AAT","name":"Altay Air Base"},{"iata":"AAU","name":"Asau Airport"},{"iata":"AAV","name":"Allah Valley Airport"},{"iata":"AAW","name":"Abbottabad Airport"},{"iata":"AAX","name":"Araxa Airport"},{"iata":"AAY","name":"Al Ghaidah International Airport"},{"iata":"AAZ","name":"Quezaltenango Airport"},{"iata":"ABA","name":"Abakan Airpo
@sabatale
sabatale / briefed_in_deals.json
Created December 4, 2023 13:38
briefed_in - Deals in Canada (12-2023)
This file has been truncated, but you can view the full file.
[
{
"type": "deal",
"id": 1,
"attributes": {
"id": 1,
"companyId": 677,
"companyName": "Verda",
"headquarters": "Kitchener",
"ecosystemName": "Waterloo Region",
@sabatale
sabatale / briefed_in_reports.json
Created December 4, 2023 04:38
briefed.in - Reports (12-2023)
{
"type": "summary",
"id": "summary",
"attributes": {
"ecosystems": [
{
"id": 531,
"ecosystemName": "Canada",
"year": "2023",
"amount": 5522005820,
@sabatale
sabatale / briefed_in_company_list.json
Created December 4, 2023 04:36
briefed.in - Company List for Canada (12-2023)
This file has been truncated, but you can view the full file.
[
{
"type": "company",
"id": 2476,
"attributes": {
"id": 2476,
"companyName": " mosea technologies",
"headquarters": "Toronto",
"ecosystemName": "Toronto",
"ecosystemSecondary": null,
@sabatale
sabatale / briefed_in_investor_list.json
Created December 4, 2023 04:28
briefed.in - Investor List for Canada (12-2023)
This file has been truncated, but you can view the full file.
[
{
"type": "investor",
"id": 3074,
"attributes": {
"id": 3074,
"investorName": "BKR Capital",
"investorType": [
"Venture Capital"
],
@sabatale
sabatale / findProvinceCA.js
Last active September 12, 2022 01:33
Guess the province & sales taxes from any given postal code (Canada)
// A very simple example (sales taxes from 2022)
function findProvince(input) {
// Starting postal code character - https://www150.statcan.gc.ca/n1/pub/92-195-x/2011001/other-autre/pc-cp/tbl/tbl9-eng.htm
// Provinces short codes - https://www150.statcan.gc.ca/n1/pub/92-195-x/2011001/geo/prov/tbl/tbl8-eng.htm
// Sales taxes by province - https://www.retailcouncil.org/resources/quick-facts/sales-tax-rates-by-province/
//var input = "H2V 1V8";
var postal = input.substring(0, 1).toLowerCase(); // E.g., "H2V 1V8" becomes "h"
@sabatale
sabatale / wayback_save_api.gs
Last active April 18, 2022 20:01
Wayback machine - Automatic save with Google Scripts
function wayback() {
var url = 'https://www.google.com/';
// Does it already exist?
var archive = JSON.parse(getContent_('https://archive.org/wayback/available?url=' + url, {}));
if (archive) {
var closest = archive.archived_snapshots.closest;
if (closest && closest.available) {
console.log(closest.url); // Yes? Here is the saved page URL.
} else {
@sabatale
sabatale / fear-index-vs-btc-price-vs-eth-price-api-data.markdown
Created February 15, 2022 14:52
Fear Index vs. BTC price vs. ETH price (API data)
@sabatale
sabatale / README.md
Last active June 14, 2021 21:51 — forked from lovromazgon/README.md
Schedule starting/stopping a CloudSQL instance on GCP

To use this cloud function follow these steps:

  1. Create a pub/sub topic which will be used to trigger the cloud function.
  2. Create the cloud function and copy in the code below.
    1. Set the trigger to Pub/Sub and choose the topic created in step 1.
    2. Set the Runtime to Python 3.9 and delete default files.
    3. Create each file manually and paste the code.
    4. Make sure to set the correct project ID in line 8.
  3. Create a cloud scheduler job to trigger the cloud function on a regular basis.
    1. Choose the frequency when you want the cloud function to be triggered.
  4. Set the target to Pub/Sub and define the topic created in step 1.