Use Deno to download files from the internet.
deno run --allow-net --allow-write download.ts [url] [filename]
/** | |
* # `<Image>` | |
* | |
* This component is a merge between `next/image` and `Chakra-ui`. | |
* - last updated on 2023-08-08 with `next/image` 13.4.13 and `chakra-ui/react` 2.8.0 | |
* - https://github.com/vercel/next.js/blob/v13.4.13/packages/next/src/client/image-component.tsx | |
* - https://github.com/vercel/next.js/blob/canary/packages/next/src/client/image-component.tsx | |
* - https://github.com/vercel/next.js/commits/canary/packages/next/src/client/image-component.tsx | |
* - https://github.com/vercel/next.js/compare/v13.4.4...canary | |
* |
const toBase64 = (file) => new Promise((resolve, reject) => { | |
const reader = new FileReader(); | |
reader.readAsDataURL(file); | |
reader.onload = (e) => resolve(e.target.result); | |
reader.onerror = (err) => reject(err); | |
}); | |
const compressBase64 = (src, quality = 0.5) => new Promise((resolve) => { | |
const img = new Image(); | |
img.src = src; |
from flask import Flask | |
from threading import Thread | |
app = Flask('') | |
@app.route('/') | |
def home(): | |
return "Hello. I am alive!" | |
def run(): |
<? | |
# MIT license, do whatever you want with it | |
# | |
# This is my invoice.php page which I use to make invoices that customers want, | |
# with their address on it and which are easily printable. I love Stripe but | |
# their invoices and receipts were too wild for my customers on Remote OK | |
# | |
require_once(__DIR__.'/../vendor/autoload.php'); |
// Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e | |
// by @levelsio | |
// HOW TO | |
// 1) Make a Google Sheet, we'll pull the first cell e.g. A1 | |
// 2) Publish your Google Sheet, File -> Publish To Web | |
// 3) Copy the SHEET_ID in the URL, put it in here below: | |
const endpoint = "https://spreadsheets.google.com/feeds/cells/SHEET_ID/1/public/full?alt=json" | |
// 4) Install Scriptable @ https://apps.apple.com/us/app/scriptable/id1405459188 | |
// 5) Copy this entire script in to Scriptable (tip: you can send it to your iPhone via Whatsapp/Messenger/Telegram etc) |
// followed from next-auth repo: https://github.com/nextauthjs/next-auth | |
// create faunadb server key | |
// create collections: users, accounts, sessions, verificationRequests | |
// create required indexes | |
import faunadb, { query as q } from 'faunadb'; | |
import { v4 as uuidv4 } from 'uuid'; | |
import { createHash, randomBytes } from 'crypto'; |
const got = require('got'); | |
exports.handler = function(context, event, callback) { | |
let message = ""; | |
let twiml = new Twilio.twiml.MessagingResponse(); | |
const prompt = event.Body !== undefined ? event.Body.trim() : event["prompt"] | |
got.post('https://api.openai.com/v1/engines/davinci/completions', { | |
json: { | |
"prompt": prompt, |
// ---------------------------------------------------------------------- | |
// Smart wrapper around Next.js <Link> | |
// | |
// This is to improve the default handling of Next.js dynamic links which | |
// requires both `href` and `as` props. | |
// This improvement enables the following usage: | |
// | |
// <Link page="/users/[id]" params={{ id: user.id }}>{user.name}</Link> | |
// | |
// <Link page="/blog/[...slug]" params={{ slug: ['coffee', 'frenchpress'] }}>View Here</Link> |
import { useMutation } from 'react-query'; | |
import fetch from 'isomorphic-unfetch'; | |
export default function useSearch({ endpoint } = {}) { | |
if (!endpoint) { | |
throw new Error("Must provide an endpoint to search"); | |
} | |
let expressionConfig = ""; |