Trending Vals

31
pomdtr avatar
astro
@pomdtr
HTTP (deprecated)
Astro served from Val Town (with SSR) ! The ultimate goal would be to serve it if from jsr, but the deno astro adapter still relies on deno.land.
32
stevekrouse avatar
umbrellaReminder
@stevekrouse
Cron
☔️ Umbrella reminder if there's rain today Setup Fork this val 👉 https://val.town/v/stevekrouse.umbrellaReminder/fork Customize the location (line 8). You can supply any free-form description of a location. ⚠️ Only works for US-based locations (where weather.gov covers). How it works Geocodes an free-form description of a location to latitude and longitude – @stevekrouse.nominatimSearch Converts a latitude and longitude to weather.gov grid – @stevekrouse.weatherGovGrid Gets the hourly forecast for that grid Filters the forecast for periods that are today and >30% chance of rain If there are any, it formats them appropriately, and sends me an email
33
browserbase avatar
browserbasePuppeteerExample
@browserbase
Script
Browserbase Browserbase offers a reliable, high performance serverless developer platform to run, manage, and monitor headless browsers at scale. Leverage our infrastructure to power your web automation and AI agents. Get started with Browserbase for free here . If you have any questions, reach out to developer@browserbase.com.
34
janpaul123 avatar
valleBlogV0
@janpaul123
HTTP (deprecated)
Fork this val to your own profile. Create a Val Town API token , open the browser preview of this val, and use the API token as the password to log in.
35
stevekrouse avatar
lucia_middleware
@stevekrouse
Script
Forked from stevekrouse/lucia_demo
36
healeycodes avatar
isMyWebsiteDown
@healeycodes
Script
Uptime Checker & Status Page Installation Fork this val Edit the list of URLs to what you want to check For the status page, fork this val: @stevekrouse/status
37
ashryanio avatar
routineTrackerApp
@ashryanio
HTTP
Routine Tracker This is a little React component to make our 7yo's after school routine self-serve so she can be a bit more independent after school. To change the items in the list, modify the routineTasks array of objects: [ {name: "item", timed: false}, {name: "item 2", timed: true, duration: 2 * 60 } {name: "item 3", timed: false, requiresParent: true} ] You can set the parent password on this line: const PARENT_PASSWORD_HASH = simpleHash("1234"); Todos Make the parent password modal touch friendly Track dates/times of list completions Show a tracker of how many completions this week
38
yawnxyz avatar
newsly
@yawnxyz
Email
Newsly inspired by https://kill-the-newsletter.com/ copy your email into a newsletter like substack read the newsletter here / store them into valtown you can set it so you can chat with it or send you alerts or whatever idk
39
stevekrouse avatar
openai
@stevekrouse
Script
OpenAI ChatGPT helper function This val uses your OpenAI token if you have one, and the @std/openai if not, so it provides limited OpenAI usage for free. import { chat } from "https://esm.town/v/stevekrouse/openai"; const { content } = await chat("Hello, GPT!"); console.log(content); import { chat } from "https://esm.town/v/stevekrouse/openai"; const { content } = await chat( [ { role: "system", content: "You are Alan Kay" }, { role: "user", content: "What is the real computer revolution?"} ], { max_tokens: 50, model: "gpt-4o" } ); console.log(content);
40
dthyresson avatar
bedtimeStoryMaker
@dthyresson
HTTP
Bedtime Story Maker Inspired from a RedwoodJS demo I mde last year, this adds generative art powered by Fal to the bedtime story maker. Start writing a story by picking a style (spooky, colofrol, adventurous an animal (penguin, mouse, unicorn, whale ...) a color for the animal and activity (befriends aliens, goes to the doctor, rides a rollercoaster, bakes a cake for friends) It uses OpenAI to write a children's bedtime story title summary story for a "fantastical story about a green whale who rides the bus" or the "spooky story about the tomato fox who explores a cave". Then using the summary, OpenAI geenrates another prompt to describe the instructions to geneate a childrens story book image. That's sent to Fal to generate an image. Stories get saved to bedtime_stories in SQLite for viewing, searching and maybe sharing. You then get a bedtime story to enjoy!
41
hrbrmstr avatar
knownExploitedVulnsEndpoint
@hrbrmstr
HTTP
CISA KEV JSON Proxy Lets us use CISA KEV in a SPA without copying KEV to our own servers
42
hrbrmstr avatar
cronJobToCheckCISAKEV
@hrbrmstr
Cron
Check KEV For New Updates Run a script M-F, 0800-2100, every 10 minutes. If you're on the free tier, dial that back to every 15.
43
yawnxyz avatar
valWall
@yawnxyz
HTTP
Forked from iamseeley/valcontributionchart
44
hrbrmstr avatar
cisaKEVToRSS
@hrbrmstr
HTTP
CISA KEV To RSS This val.town HTTP endpoint reads the JSON from CISA's Known Exploited Vulnerabilities Catalog and converts it to an RSS feed.
45
pomdtr avatar
webdavServer
@pomdtr
Script
Webdav Manage your vals from a webdav client (ex: https://cyberduck.io/) ⚠️ some webdav operations are not supported, so support can vary between clients. Installation Click "Create Val" on the code block, and change it's type to http. import { basicAuth } from "https://esm.town/v/pomdtr/basicAuth"; import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken"; import { serveVals } from "https://esm.town/v/pomdtr/webdavServer"; export default basicAuth(serveVals, { verifyUser: (user) => { return verifyToken(user); }, }); Use a val town token as the username, and keep the password blank to authenticate.
46
pomdtr avatar
lastlogin
@pomdtr
Script
Lastlogin Authentication for val.town Looking for an hono integration ? See @pomdtr/lastloginHono Support login in trough: Email Link QR Code Google Oauth Github Oauth Gitlab Oauth Facebook Oauth Demo You can try a demo at https://pomdtr-lastloginhonoexample.web.val.run (see @pomdtr/lastLoginHonoExample for code) Usage Wrap your http handlers in a lastlogin middleware (sessions will be persisted in the lastlogin_session table on your sqlite account). If you want to be the only one able to access your val, you can use @pomdtr/verifyUserEmail. import { lastlogin } from "https://esm.town/v/pomdtr/lastlogin"; import { verifyUserEmail } from "https://esm.town/v/pomdtr/verifyUserEmail"; export default lastlogin((req) => { return new Response(`You are logged in as ${req.headers.get("X-LastLogin-Email")}`); }, { // check that the user email match your val town email verifyEmail: verifyUserEmail }); If you want to customize how is allowed to signup, you can set the verifyEmail option: import { lastlogin } from "https://esm.town/v/pomdtr/lastlogin"; export default lastlogin((req) => { return new Response(`You are logged in as ${req.headers.get("X-LastLogin-Email")}`); }, { verifyEmail: (email) => { email == "steve@valtown" } }); You can allow anyone to signup by returning a boolean from the verifyEmail function: import { lastlogin } from "https://esm.town/v/pomdtr/lastlogin"; export default lastlogin((req) => { return new Response(`You are logged in as ${req.headers.get("X-LastLogin-Email")}`); }, { verifyEmail: (_email) => true }); Public Routes import { lastlogin } from "https://esm.town/v/pomdtr/lastlogin"; import { verifyUserEmail } from "https://esm.town/v/pomdtr/verifyUserEmail"; export default lastlogin(() => { return new Response("Hi!"); }, { verifyEmail: verifyUserEmail, public_routes: ["/", "/public/*"], }); See the URLPattern API for reference. Logout Just redirect the user to /auth/logout
47
andreterron avatar
isMyWebsiteDown
@andreterron
Cron
Forked from thierryc/isMyWebsiteDown
48
stevekrouse avatar
weatherGPT
@stevekrouse
Cron
49
ktodaz avatar
sendDiscordMessage
@ktodaz
Script
Send Chunked Discord Message This function is used to send a message to a Discord webhook. If the message exceeds the maximum character limit (2000 characters), it will be divided into chunks and sent as multiple messages. Parameters message (string): The message to be sent to the Discord webhook. Return Value This function does not return any value. Example Usage: const message = "This is a long message that needs to be sent to Discord. It may exceed the character limit, so it will be divided into smaller chunks."; await @ktodaz.sendDiscordMessage(message); In the above example, the sendDiscordMessage function is used to send the message to the Discord webhook. If the message exceeds 2000 characters, it will be split into smaller chunks and sent as separate messages. Required Secrets: Ensure you have added the secret for discord_webhook in your val.town secrets settings (Profile -> Secrets)
50
iamseeley avatar
valTownUser
@iamseeley
Script
👤 valTownUser The valTownUser object provides a convenient interface to interact with Val Town's API and access user-specific information and functionalities. User Information getUserInfo() Fetches and caches the user's information. Use case: Retrieving all user details at once. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getUserInfo = () => valTownUser.getUserInfo(); // Example usage: const userInfo = await getUserInfo(); console.log('User Information:', userInfo); // You can also destructure specific properties you need: const { username, id, email, tier } = await getUserInfo(); console.log(`Username: ${username}`); console.log(`User ID: ${id}`); console.log(`Email: ${email}`); console.log(`Account Tier: ${tier}`); getUsername() Retrieves the user's username. Use case: Displaying the current user's name in a val. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getUsername = () => valTownUser.getUsername(); // Example usage: const username = await getUsername(); console.log(`Current user: ${username}`); getId() Retrieves the user's ID. Use case: Using the user ID for database queries or API calls. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getId = () => valTownUser.getId(); // Example usage: const userId = await getId(); console.log(`User ID: ${userId}`); getBio() Retrieves the user's biography. Use case: Displaying the user's bio on a profile page. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getBio = () => valTownUser.getBio(); // Example usage: const bio = await getBio(); console.log(`User bio: ${bio || 'Not set'}`); getProfileImageUrl() Retrieves the URL of the user's profile image. Use case: Showing the user's avatar in a val. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getProfileImageUrl = () => valTownUser.getProfileImageUrl(); // Example usage: const profileImageUrl = await getProfileImageUrl(); console.log(`Profile image URL: ${profileImageUrl || 'Not set'}`); getEmail() Retrieves the user's email address. Use case: Sending notifications or verifications. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getEmail = () => valTownUser.getEmail(); // Example usage: const email = await getEmail(); console.log(`User email: ${email}`); getTier() Retrieves the user's account tier. Use case: Implementing tier-specific features. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getTier = () => valTownUser.getTier(); // Example usage: const tier = await getTier(); console.log(`User tier: ${tier}`); URL Generation getEndpointUrl(valName) Generates the endpoint URL for a specified val. Use case: Creating links to val endpoints in your application. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getEndpointUrl = (valName: string) => valTownUser.getEndpointUrl(valName); // Example usage: const endpointUrl = await getEndpointUrl('mySitesServer'); console.log(`Endpoint URL: ${endpointUrl}`); getValUrl(valName) Generates the Val Town URL for a specified val. Use case: Creating links to val pages in Val Town. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getValUrl = (valName: string) => valTownUser.getValUrl(valName); // Example usage: const valUrl = await getValUrl('myVal'); console.log(`Val URL: ${valUrl}`); User Activity getLikedVals(options) Retrieves the vals liked by the user. Use case: Displaying a list of the user's favorite vals. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getLikedVals = (options = {}) => valTownUser.getLikedVals(options); // Example usage: const likedVals = await getLikedVals({ limit: 5 }); console.log('Liked vals:', likedVals.data); getComments(options) Retrieves comments related to the user. Use case: Showing a user's comment history. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getComments = (options = {}) => valTownUser.getComments(options); // Example usage: const comments = await getComments({ limit: 10, relationship: 'given' }); console.log('User comments:', comments.data); getReferences(options) Retrieves references to the user's vals. Use case: Tracking how often a user's vals are used by others. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getReferences = (options = {}) => valTownUser.getReferences(options); // Example usage: const references = await getReferences({ limit: 5 }); console.log('Val references:', references.data); Blob Management listBlobs(prefix) Lists the user's blobs. Use case: Displaying a file manager for the user's stored data. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const listBlobs = (prefix?: string) => valTownUser.listBlobs(prefix); // Example usage: const blobs = await listBlobs(); console.log('User blobs:', blobs); storeBlob(key, data) Stores a new blob or updates an existing one. Use case: Uploading user files or storing large datasets. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const storeBlob = (key: string, data: any) => valTownUser.storeBlob(key, data); // Example usage: await storeBlob('myFile.txt', 'Hello, World!'); console.log('Blob stored successfully'); getBlob(key) Retrieves a specific blob. Use case: Downloading a user's stored file. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const getBlob = async (key: string) => { const blobData = await valTownUser.getBlob(key); return new TextDecoder().decode(new Uint8Array(blobData)); }; // Example usage: const blobContent = await getBlob('myFile.txt'); console.log('Blob content:', blobContent); deleteBlob(key) Deletes a specific blob. Use case: Removing old or unnecessary files. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const deleteBlob = (key: string) => valTownUser.deleteBlob(key); // Example usage: await deleteBlob('myFile.txt'); console.log('Blob deleted successfully'); Val Management listVals(options) Lists the user's vals. Use case: Displaying a dashboard of the user's created vals. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const listVals = (options = {}) => valTownUser.listVals(options); // Example usage: const userVals = await listVals({ limit: 5 }); console.log('User vals:', userVals.data); createVal(valInfo) Creates a new val. Use case: Programmatically creating vals based on user input. import { valTownUser } from "https://esm.town/v/iamseeley/valTownUser"; export const createVal = (valInfo: any) => valTownUser.createVal(valInfo); // Example usage: const newVal = await createVal({ name: 'myNewVal', code: 'console.log("Hello, World!");' }); console.log('Created val:', newVal); updateVal(valId, updates) Updates an existing val. Use case: Implementing an "edit val" feature in your application. deleteVal(valId) Deletes a specific val. Use case: Allowing users to remove their vals through your interface. SQLite Database Operations executeSqlite(statement) Executes a SQLite statement. Use case: Running custom queries on the user's database. listTables() Lists all tables in the user's SQLite database. Use case: Displaying the structure of a user's database. getTableSchema(tableName) Retrieves the schema of a specific table. Use case: Showing the structure of a particular table. getTableContent(tableName, limit) Retrieves the content of a specific table. Use case: Displaying the data stored in a user's table.
51
stevekrouse avatar
lastlogin_demo
@stevekrouse
HTTP (deprecated)
52
ayrtonlacerda avatar
getDetailsPlaystore
@ayrtonlacerda
HTTP (deprecated)
Function that fetches app data from the playstore through bundleId
53
stevekrouse avatar
lastlogin_safe
@stevekrouse
Script
Forked from stevekrouse/lucia_middleware_safe
54
isidentical avatar
fluxImageGenerator
@isidentical
HTTP
Sign in to fal.ai, generate an API key, and set it as FAL_KEY for your account.
55
stevekrouse avatar
fileToDataURL
@stevekrouse
Script
File to Data URL Was built for uploading base64 encoded images to Chat GPT Check out the references to this val to see usage.
56
nerdymomocat avatar
add_to_notion_w_ai
@nerdymomocat
Script
Uses instructor and open ai (with gpt-4-turbo) to process any content into a notion database entry. Use addToNotion with any database id and content. await addToNotion( "DB_ID_GOES_HERE", "CONTENT_GOES HERE"//"for example: $43.28 ordered malai kofta and kadhi (doordash) [me and mom] jan 3 2024" ); Prompts are created based on your database name, database description, property name, property type, property description, and if applicable, property options (and their descriptions). Supports: checkbox, date, multi_select, number, rich_text, select, status, title, url, email Uses NOTION_API_KEY , OPENAI_API_KEY stored in env variables and uses Valtown blob storage to store information about the database. Use get_notion_db_info to use the stored blob if exists or create one, use get_and_save_notion_db_info to create a new blob (and replace an existing one if exists).
57
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"]]}
58
mikker avatar
dailySlackRoundup
@mikker
Script
Sends a daily message to the team Slack channel. Similar to 37signals ' What did you work on today?
59
moe avatar
p5
@moe
Script
Forked from saolsen/p5
60
xkonti avatar
gptMemoryManager
@xkonti
Script
A simple Rest API that allows for you GPT to save and recall snippets of data (memories). You can read my blog post explaining it in detail here: xkonti.tech Demonstration First conversation: What GPT sent do the API: { "name": "Life Essence and Biological Processes", "description": "Explore the role of life essence in enabling biological processes, with a focus on how dimensional interference, particularly from the Incorporeal dimension, facilitates the existence of these processes. This exploration should delve into the complex interplay between the Physical and Incorporeal dimensions, examining how life essence acts as a crucial element in the emergence and sustenance of life in the Physical dimension.", "summary": "Expanding on the role of life essence in biological processes, emphasizing the interaction between the Physical and Incorporeal dimensions.", "reason": "To deepen the understanding of how life essence, influenced by dimensional interference, is essential for biological processes in the novel's universe." } Separate conversation somewhere in the future: Setup There are several steps to set up the API: deploy and configure the API create the API key for your GPT add an action for the API in you GPT add prompt section to your GPT so that it can use it properly Deploying the API on Val Town Deploy your own memory API. You can fork the following Val to do it: https://www.val.town/v/xkonti/memoryApiExample In the code configure the appropriate values: apiName the name of your API - used in the Privacy Policy (eg. Memory API ) contactEmail - the email to provide for contact in the Privacy Policy (eg. some@email.com ) lastPolicyUpdate - the date the Privacy Policy was last updated (eg. 2023-11-28 ) blobKeyPrefix - the prefix for the blob storage keys used by your API - more info below (eg. gpt:memories: ) apiKeyPrefix - the prefix for you API Keys secrets - more info below (eg. GPTMEMORYAPI_KEY_ ) Create API keys The Memory API is designed to serve multiple GPTs at the same time. Each GPT should have it's own unique name and API key . The name is used for identifying the specific GPT and appended to both: blobKeyPrefix - to maintain separate memory storage from other GPTs apiKeyPrefix - to maintain separate API key for each GPT Please pick a unique alphanumeric name for your GPT. For example personaltrainer . Generate some alphanumeric API key for your GPT. For example Wrangle-Chapped-Monkhood4-Domain-Suspend Add a new secret to your Val.town secrets storage. The Key should be the picked name prefixed by apiKeyPrefix . Using the default it would be GPTMEMORYAPI_KEY_personaltrainer . The value of the secret should be the API key itself. The memories of the GPT will be stored in the blob storage under the key blobKeyPrefix + name , for example: gpt:memories:personaltrainer . Adding GPT action Add a new action in your GPT. Get the OpenAPI spefication by calling the /openapi endpoint of your API Change all <APIURL> instances within the specification to the url of your deployed API. For example https://xkonti-memoryapiexample.web.val.run Set the authentication method to basic and provide a base64 encoded version of the <name>:<apiKey> . For example: personaltrainer:Wrangle-Chapped-Monkhood4-Domain-Suspend -> cGVyc29uYWx0cmFpbmVyOldyYW5nbGUtQ2hhcHBlZC1Nb25raG9vZDQtRG9tYWluLVN1c3BlbmQ= Add the link to the privacy policy, which is the /privacy endpoint of your API. For example: https://xkonti-memoryapiexample.web.val.run/privacy Adding the prompt section To make your GPT understand the usage of your new action you should include usage instruction in your prompt. Here's an example of such instructions section: # Long-term memory At some point the user might ask you to do something with "memory". Things like "remember", "save to memory", "forget", "update memory", etc. Please use corresponding actions to achieve those tasks. User might also ask you to perform some task with the context of your "memory" - in that case fetch all memories before proceeding with the task. The memories should be formed in a clear and purely informative language, void of unnecessary adjectives or decorative language forms. An exception to that rule might be a case when the language itself is the integral part of information (snippet of writing to remember for later, examples of some specific language forms, quotes, etc.). Structure of a memory: - name - a simple name of the memory to give it context at a glance - description - a detailed description of the thing that should be remembered. There is no length limit. - summary - a short summary of the memory. This should be formed in a way that will allow for ease of understanding which memories to retrieve in full detail just by reading the list of summaries. If there are some simple facts that have to be remembered and are the main point of the memory they should be included in the summary. The summary should also be written in a compressed way with all unnecessary words skipped if possible (more like a set of keywords or a Google Search input). - reason - the reason for the remembering - this should give extra information about the situation in which the memory was requested to be saved. The memory accessed through those actions is a long-term memory persistent between various conversations with the user. You can assume that there already are many memories available for retrieval. In some situations you might want to save some information to your memory for future recall. Do it in situations where you expect that some important details of the conversation might be lost and should be preserved. Analogously you can retrieve memories at any point if the task at hand suggests the need or there isn't much information about the subject in your knowledge base.