10```
1112* Export any "global" p5 functions. These are functions like `setup` and `draw` that p5 will call.
1314* Set the val type to http and default export the result of `sketch`, passing in `import.meta.url`.
19import type * as p5 from "npm:@types/p5";
2021export function setup() {
22createCanvas(400, 400);
23}
2425export function draw() {
26if (mouseIsPressed) {
27fill(0);
3738## How it works
39The sketch function returns an http handler that sets up a basic page with p5.js added. It then imports your module from the browser and wires up all the exports so p5.js can see them. All the code in your val will run in the browser (except for the default `sketch` export) so you can't call any Deno functions, environment variables, or other server side apis.
40
1export function sketch(module: string): (req: Request) => Response {
2return function(req: Request): Response {
3return new Response(
4`
40}
4142export default async function(req: Request): Promise<Response> {
43return new Response(
44`
add_to_notion_w_aimain.tsx9 matches
35});
3637function createPrompt(title, description, properties) {
38let prompt =
39"You are processing content into a database. Based on the title of the database, its properties, their types and options, and any existing descriptions, infer appropriate values for the fields:\n";
80}
8182function processProperties(jsonObject) {
83const properties = jsonObject.properties;
84const filteredProps = {};
111}
112113async function get_and_save_notion_db_processed_properties(databaseId)
114{
115const response = await notion.databases.retrieve({ database_id: databaseId });
122}
123124async function get_notion_db_info(databaseId) {
125databaseId = databaseId.replaceAll("-", "");
126let db_info = null;
137}
138139async function get_and_save_notion_db_info(databaseId) {
140databaseId = databaseId.replaceAll("-", "");
141let db_info = await get_and_save_notion_db_processed_properties(databaseId);
144}
145146function createZodSchema(filteredProps) {
147const schemaObject = {};
148193}
194195function convertToNotionProperties(responseValues, filteredProps) {
196const notionProperties = {};
197268}
269270async function process_text(dbid, text) {
271const db_info = await get_notion_db_info(dbid);
272const processed_message = await client.chat.completions.create({
283}
284285async function addToNotion(databaseId, text) {
286databaseId = databaseId.replaceAll("-", "");
287const properties = await process_text(databaseId, text);
cronJobToCheckCISAKEVmain.tsx2 matches
5const BLOB_KEY = "seen_cves";
67async function checkNewVulnerabilities() {
8const response = await fetch(KEV_URL);
9const data = await response.json();
30}
3132export default async function kevCron() {
33return await checkNewVulnerabilities();
34}
3import { createRoot } from "https://esm.sh/react-dom/client";
45function App() {
6const [SplineComponent, setSplineComponent] = useState(null);
7const [error, setError] = useState(null);
50}
5152function client() {
53createRoot(document.getElementById("root")).render(<App />);
54}
56if (typeof document !== "undefined") { client(); }
5758async function server(request: Request): Promise<Response> {
59return new Response(
60`
1export default async function server(request: Request): Promise<Response> {
2try {
3const response = await fetch("https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json");
cisaKEVToRSSmain.tsx4 matches
3const RSS_FEED_URL = "https://hrbrmstr-cisakevtorss.web.val.run"; // Update this to your actual RSS feed URL
45function escapeXML(str: string): string {
6return str.replace(/&/g, "&")
7.replace(/</g, "<")
11}
1213function removeInvalidXMLChars(str: string): string {
14return str
15.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g, "") // Control characters
19}
2021function generateRSS(data: any): string {
22const { title, catalogVersion, dateReleased, vulnerabilities } = data;
2368}
6970export async function handler(req: Request): Promise<Response> {
71try {
72const response = await fetch(CISA_JSON_URL);
eagerIndigoPigmain.tsx10 matches
15}
1617export default async function(interval: Interval): Promise<void> {
18try {
19await createTable();
3839// Create an SQLite table
40async function createTable(): Promise<void> {
41await sqlite.execute(`
42CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
5051// Fetch Hacker news, Twitter, and Reddit results
52async function fetchHackerNewsResults(topic: string): Promise<Website[]> {
53return hackerNewsSearch({
54query: topic,
58}
5960async function fetchTwitterResults(topic: string): Promise<Website[]> {
61return twitterSearch({
62query: topic,
67}
6869async function fetchRedditResults(topic: string): Promise<Website[]> {
70return redditSearch({ query: topic });
71}
7273function formatSlackMessage(website: Website): string {
74const displayTitle = website.title || website.url;
75return `*<${website.url}|${displayTitle}>*
78}
7980async function sendSlackMessage(message: string): Promise<Response> {
81const slackWebhookUrl = Deno.env.get("SLACK_WEBHOOK_URL");
82if (!slackWebhookUrl) {
104}
105106async function isURLInTable(url: string): Promise<boolean> {
107const result = await sqlite.execute({
108sql: `SELECT 1 FROM ${TABLE_NAME} WHERE url = :url LIMIT 1`,
112}
113114async function addWebsiteToTable(website: Website): Promise<void> {
115await sqlite.execute({
116sql: `INSERT INTO ${TABLE_NAME} (source, url, title, date_published)
120}
121122async function processResults(results: Website[]): Promise<void> {
123for (const website of results) {
124if (!(await isURLInTable(website.url))) {
slackScoutmain.tsx10 matches
15}
1617export default async function(interval: Interval): Promise<void> {
18try {
19await createTable();
3839// Create an SQLite table
40async function createTable(): Promise<void> {
41await sqlite.execute(`
42CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
5051// Fetch Hacker news, Twitter, and Reddit results
52async function fetchHackerNewsResults(topic: string): Promise<Website[]> {
53return hackerNewsSearch({
54query: topic,
58}
5960async function fetchTwitterResults(topic: string): Promise<Website[]> {
61return twitterSearch({
62query: topic,
67}
6869async function fetchRedditResults(topic: string): Promise<Website[]> {
70return redditSearch({ query: topic });
71}
7273function formatSlackMessage(website: Website): string {
74const displayTitle = website.title || website.url;
75return `*<${website.url}|${displayTitle}>*
78}
7980async function sendSlackMessage(message: string): Promise<Response> {
81const slackWebhookUrl = Deno.env.get("SLACK_WEBHOOK_URL");
82if (!slackWebhookUrl) {
104}
105106async function isURLInTable(url: string): Promise<boolean> {
107const result = await sqlite.execute({
108sql: `SELECT 1 FROM ${TABLE_NAME} WHERE url = :url LIMIT 1`,
112}
113114async function addWebsiteToTable(website: Website): Promise<void> {
115await sqlite.execute({
116sql: `INSERT INTO ${TABLE_NAME} (source, url, title, date_published)
120}
121122async function processResults(results: Website[]): Promise<void> {
123for (const website of results) {
124if (!(await isURLInTable(website.url))) {
ForexDataHubmain.tsx3 matches
1import { addMonths, format, subMonths } from "https://esm.sh/date-fns";
23function generateFutureEvents(months = 6) {
4const events = [];
5const startDate = new Date();
41}
4243async function server(request: Request): Promise<Response> {
44const url = new URL(request.url);
45177}
178179function getStyles() {
180return `
181<style>