Avatar

mattx

Joined January 11, 2023
Public vals
17
mattx avatar
gsheet_example
@mattx
Script
// Appending to a sheet
mattx avatar
parse_cookies
@mattx
Script
parse_cookies Parses Cookie headers into objects. jar : Value of the Cookie header decoder : Function to run on all cookie names and values. This is to get around character limitations (see RFC 6265 ). There is no formal standard, but as most sites prefer URL encoding, it is the default. x => x can be used as a way to disable decoding.
mattx avatar
remind_new_open_llm
@mattx
Script
remind_new_open_llm This val sends you an email whenever a new LLM appears in the top 10 LLMs on the Open LLM Leaderboard . Use an interval of at least 12 hours as the top 10 doesn't change that frequently. You can adjust the array slice to change how many places on the leaderboard to monitor, or remove it entirely to fill up your mailbox. Bugs If a model unfairly gets to the top 10 and then gets flagged for it, you'll get a reminder for an LLM that's in most cases not new at all. Hopefully this doesn't happen too often.
mattx avatar
scrape_open_llm_leaderboard
@mattx
Script
scrape_open_llm_leaderboard This uses scrape_gradio_data to scrape the Open LLM Leaderboard and grab the names of all models that are not flagged. Array is ordered by average benchmark accuracy.
mattx avatar
scrape_gradio_data
@mattx
Script
scrape_gradio_data Scrapes the gradio_config object from Gradio sites/spaces. Most useful when pointed at a gradio site with lots of static data like the Open LLM Leaderboard
mattx avatar
example1
@mattx
Script
// set by mattx.write_example1 at 2023-06-07T19:10:23.195Z
mattx avatar
write_example1
@mattx
Script
An interactive, runnable TypeScript val by mattx
mattx avatar
airtable_deno_sample
@mattx
Script
An interactive, runnable TypeScript val by mattx
mattx avatar
airtable_get_sample
@mattx
Script
An interactive, runnable TypeScript val by mattx
mattx avatar
faunadb_test
@mattx
Script
An interactive, runnable TypeScript val by mattx
mattx avatar
gsheet_append_example
@mattx
Script
An interactive, runnable TypeScript val by mattx
mattx avatar
gsheet_call
@mattx
Script
gsheet_call Wrapper around Google Sheets API v4. Parameters service_account: JSON string containing Google Service Account key sheet_id: Google Sheet ID method: HTTP method to use action: Full URL with https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/ removed data: HTTP request body Requirements a Google Cloud service account the Google Sheets API v4 enabled in your Google Cloud project the spreadsheet ID (provide it in the sheet_id parameter) Instructions Share the spreadsheet with the service account Make a JSON key for the service account, then set it as a secret. Use the secret for the service_account parameter. Figure out the action you want to perform. You will need to provide everything that comes after {spreadsheetId}/ as the action parameter. For example: values/A1:C1:append?valueInputOption=RAW Figure out the request body. For example: {values: [["foo", "bar", "baz"]]}
mattx avatar
examplebotendpoint
@mattx
Express
An interactive, runnable TypeScript val by mattx
mattx avatar
verify_discord_signature
@mattx
Script
verify_discord_signature Verify HTTP signatures coming from Discord. public_key should be the Ed25519 public key from Discord, as a hex string body should be the request body as a string. If you have a JSON object as the request body, use JSON.stringify. signature should be the X-Signature-Ed25519 header timestamp should be the X-Signature-Timestamp header You must return a 401 error and return early if this function returns false, otherwise you will pretty quickly get a big scary warning from Discord that your endpoint has been removed. Note that you'll only be able to add one once you've integrated this correctly. As this function only deals with strings, it doesn't matter whether you use an Express or web endpoint.
mattx avatar
examplebot_commands
@mattx
Script
An interactive, runnable TypeScript val by mattx
mattx avatar
register_discord_commands
@mattx
Script
register_discord_commands Registers slash commands for your Discord bot, globally or in one guild. Note that this overwrites old commands. app_id: Your bot's application ID as a string guild_id: Provide a guild ID as a string to apply the commands only in one guild, or use null to apply globally. Note that applying commands globally takes a while on Discord's end. token: Your bot's token. commands: An array of command objects to register. For a basic command with no arguments, only name and description are needed.