Skip to content

Instantly share code, notes, and snippets.

View timothycarambat's full-sized avatar

Timothy Carambat timothycarambat

View GitHub Profile
@timothycarambat
timothycarambat / README.md
Created November 4, 2024 16:55
Agent API Invocation for AnythingLLM

This is a simple API-agent invocation

This plugin simply uses an external API to add two numbers via a GET request to localhost:3001/api/calculate, but is simply an example to demonstrate a custom plugin to reach out to external APIs.

Assume a GET /calculate api like so

 app.get("/calculate", async (request, response) => {
    const { n1, n2 } = request.query;
 const addition = Number(n1) + Number(n2);
@timothycarambat
timothycarambat / run.sh
Created November 22, 2023 00:31
Boot ChromaDB docker instance with persistence and an API key
docker run \
-p 8000:8000 \
-e CHROMA_SERVER_AUTH_CREDENTIALS_PROVIDER="chromadb.auth.token.TokenConfigServerAuthCredentialsProvider" \
-e CHROMA_SERVER_AUTH_PROVIDER="chromadb.auth.token.TokenAuthServerProvider" \
-e CHROMA_SERVER_AUTH_CREDENTIALS="new-token" \ # This is your API token once container boots
-e CHROMA_SERVER_AUTH_TOKEN_TRANSPORT_HEADER="X_CHROMA_TOKEN" \
-v /your/path/to/persistence/:/chroma/chroma \ # `/your/path/to/persistence` should be folder on host machine you want to write storage too for Chroma persistence between containers.
chromadb/chroma
@timothycarambat
timothycarambat / ERC20Plus.sol
Created October 18, 2022 19:20
ERC-20+ implementation
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
@timothycarambat
timothycarambat / index.js
Created May 26, 2022 01:38
How to verify contract on Etherscan, PolygonScan, Optimism Etherscan, Arbiscan, or Snowtrace programmatically with Node.js. This is mostly because the API documentation is poorly done and does not showcase a way to actually do this. I figured it out so i figure others would like to know if using the API
const EXPLORER = {
ethereum: {
api: 'https://api.etherscan.io/api',
key: '<API_KEY_HERE>', // Etherescan API key works for ethereum and rinkeby, will need to do this for each API
},
rinkeby: {
api: 'https://api-rinkeby.etherscan.io/api',
key: '',
},
<button class="rampp-minting-button" style="border: none; width: 15rem; padding: 0.5rem; font-size: 1.125rem; line-height: 1.75rem; text-align: center; cursor: pointer; border-radius: 9999px; color: rgb(255, 255, 255); background-color: rgb(115, 218, 232);" data-styles="eyJvcGVuIjp7InRleHQiOiJNSU5UIEEgTUFTQ09UIiwic3R5bGVzIjoiYm9yZGVyOm5vbmU7d2lkdGg6IDE1cmVtO3BhZGRpbmc6MC41cmVtO2ZvbnQtc2l6ZTogMS4xMjVyZW07bGluZS1oZWlnaHQ6IDEuNzVyZW07dGV4dC1hbGlnbjogY2VudGVyO2N1cnNvcjogcG9pbnRlcjtib3JkZXItcmFkaXVzOjk5OTlweDtjb2xvcjojRkZGRkZGO2JhY2tncm91bmQtY29sb3I6IzczZGFlODsifSwicGF1c2VkIjp7InRleHQiOiJNaW50IENsb3NlZCIsInN0eWxlcyI6ImJvcmRlcjpub25lO3dpZHRoOiAxNXJlbTtwYWRkaW5nOjAuNXJlbTtmb250LXNpemU6IDEuMTI1cmVtO2xpbmUtaGVpZ2h0OiAxLjc1cmVtO3RleHQtYWxpZ246IGNlbnRlcjtjdXJzb3I6IHBvaW50ZXI7Ym9yZGVyLXJhZGl1czo5OTk5cHg7Y29sb3I6IzY3NjU2NTtiYWNrZ3JvdW5kLWNvbG9yOiNDQ0RCREM7Y3Vyc29yOm5vdC1hbGxvd2VkOyJ9LCJzdXBwbHlSZWFjaGVkIjp7InRleHQiOiJBbGwgVG9rZW5zIE1pbnRlZCEiLCJzdHlsZXMiOiJib3JkZXI6bm9uZTt3aWR0aDogMTVyZW07cGFkZGluZzowLjVyZW07Zm9udC1zaXplO
@timothycarambat
timothycarambat / index.html
Created December 31, 2021 02:05
Login with ETH and show account NFTs using the OpenSea API
<head>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet" />
</head>
<body class="h-full">
<div class="
flex
w-full
mt-40
mb-10
@timothycarambat
timothycarambat / index.html
Last active January 12, 2024 17:43
Basic Web3 login, store login eth address, and read public variable from a smart contract
<head>
<link
href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"
rel="stylesheet"
/>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.6.1/web3.min.js"
integrity="sha512-5erpERW8MxcHDF7Xea9eBQPiRtxbse70pFcaHJuOhdEBQeAxGQjUwgJbuBDWve+xP/u5IoJbKjyJk50qCnMD7A=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
@timothycarambat
timothycarambat / install.sh
Created October 7, 2021 18:09
10/7/2021 NPM install.sh
#!/bin/sh
# Note(TC): This was downloaded from https://www.npmjs.com/install.sh on Oct 7, 2021
# A word about this shell script:
#
# It must work everywhere, including on systems that lack
# a /bin/bash, map 'sh' to ksh, ksh97, bash, ash, or zsh,
# and potentially have either a posix shell or bourne
# shell living at /bin/sh.
#
@timothycarambat
timothycarambat / index.html
Created September 18, 2021 01:22
Easy Web3 Meta Mask Login - static HTML and Vanilla JS
<html>
<head>
<title>Web3 Metamask Login</title>
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
</head>
<body class="flex w-screen h-screen justify-center items-center">
<div class="flex-col space-y-2 justify-center items-center">
<button id='loginButton' onclick="" class="mx-auto rounded-md p-2 bg-purple-500 text-white">
@timothycarambat
timothycarambat / collect.py
Created September 15, 2021 01:59
Senate and House Stock watcher Python3 data listing
import requests, json, datetime
# This function will grab the data from house/senate stockwatcher and return an array
# of dictonary items that represent transactions
def fetch_data():
response = requests.get("https://senate-stock-watcher-data.s3-us-west-2.amazonaws.com/aggregate/all_transactions.json")
# response = requests.get("https://house-stock-watcher-data.s3-us-west-2.amazonaws.com/data/all_transactions.json")
if response.status_code != 200:
print("request failed.")