Avatar

maxm

🕳️
Joined January 12, 2023
Public vals
134
maxm avatar
maxm
diesel
Script
Forked from yawnxyz/diesel
0
maxm avatar
maxm
discordSignatureVerifyExample
HTTP
// Your public key can be found on your application in the Developer Portal
1
maxm avatar
maxm
sapientLavenderHerring
HTTP
Forked from maxm/wide
0
maxm avatar
maxm
wideLib
Script
// const rows = parseRows([
0
maxm avatar
maxm
wide
HTTP
WIDE Store any unstructured JSON data. Retrieve it with an expressive and efficient query system. WIDE is a library and service hosted on Val Town. Authenticate and use it with your Val Town credentials, or fork it and connect it to your own Clickhouse Instance. import { ValSession } from 'https://esm.town/v/maxm/valSession'; import { Wide } from 'https://esm.town/v/maxm/wide'; // Use your Val Town API Token to create a session const wide = new Wide(await ValSession.new(Deno.env.get("valtown"))) // Write any data. await wide.write([ { user: {id: 1, name: 'Alice', email: 'alice@example.com' }}, { user: {id: 2, name: 'Bob', email: 'bob@example.com' }}, { user: {id: 3, name: 'Charlie', email: 'charlie@example.com' }}, ]); await wide.fields("user.") // => [ // { fieldName: "user.email", fieldType: "string", count: 3 }, // { fieldName: "user.id", fieldType: "number", count: 3 }, // { fieldName: "user.name", fieldType: "string", count: 3 } // ] await wide.values("user.email") // [ // { value: "bob@example.com", count: 1 }, // { value: "charlie@example.com", count: 1 }, // { value: "alice@example.com", count: 1 } // ] await wide.search({ start: new Date(Date.now() - 1000 * 60 * 10), end: new Date(), filters: [{ fieldName: "user.name", operator: "equals", value: "Alice" }], }) // [{ user: { name: "Alice", email: "alice@example.com", id: 1 } }];
2
maxm avatar
maxm
valSession
HTTP
Val Session import { ValSession } from "https://esm.town/v/maxm/valSession"; // Generate a token from your valtown api key. const token = await ValSession.newSession(Deno.env.get("valtown")); // Other services can use it to authenticate const user = await ValSession.validate(token); Fork it, provide your own VT_SESSION_PRIVATE_KEY, and update the hardcoded public key. You can generate your own keys like so: import { crypto } from "https://deno.land/std@0.198.0/crypto/mod.ts"; // Generate a key pair for JWT signing and verification const { privateKey, publicKey } = await crypto.subtle.generateKey( { name: "RSASSA-PKCS1-v1_5", modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]), hash: "SHA-256", }, true, ["sign", "verify"], ); function formatPEM(b64: string, type: "PRIVATE KEY" | "PUBLIC KEY"): string { const lines = b64.match(/.{1,64}/g) || []; return `-----BEGIN ${type}-----\n${lines.join("\n")}\n-----END ${type}-----`; } const privateKeyPem = formatPEM( btoa(String.fromCharCode(...new Uint8Array(exportPrivateKey))), "PRIVATE KEY", ); const publicKeyPem = formatPEM( btoa(String.fromCharCode(...new Uint8Array(exportPublicKey))), "PUBLIC KEY", ); console.log(privateKeyPem, publicKeyPem);
2
maxm avatar
maxm
wideApi
HTTP
An interactive, runnable TypeScript val by maxm
0
maxm avatar
maxm
simpleWikipediaInstantSearch
HTTP
Simple Wikipedia Instant Search A quick demo of getting fuzzy matching and instant search working on Val Town
2
maxm avatar
maxm
RobotBackupCallGraph
Script
Forked from synapticrobotics/RobotBackupCallGraph
0
maxm avatar
maxm
evaltownWorker
Script
An interactive, runnable TypeScript val by maxm
0
maxm avatar
maxm
reqEvaltown
HTTP
An interactive, runnable TypeScript val by maxm
0
maxm avatar
maxm
worthyCopperPigeon
Script
Forked from maxm/php
0
maxm avatar
maxm
aws_eventbridge_toggler
Cron
Forked from gwoods22/aws_eventbridge_toggler
0
maxm avatar
maxm
ingeniousSapphireWildebeest
Script
An interactive, runnable TypeScript val by maxm
0
maxm avatar
maxm
pretendingToBeRun
HTTP
An interactive, runnable TypeScript val by maxm
0
maxm avatar
maxm
transformEvalCode
Script
See: https://www.val.town/v/maxm/eval
0