This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copy of reply by Lee Robinson | |
// https://github.com/vercel/next.js/issues/9965#issuecomment-1489481795 | |
// app/api/route.ts | |
import { Configuration, OpenAIApi } from 'openai'; | |
export const runtime = 'nodejs'; | |
// This is required to enable streaming | |
export const dynamic = 'force-dynamic'; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//select source langauge using ISO 2 letter code | |
let source = "en"; | |
// Translate API key | |
let key="YourAPIcodeHere"; // <= change your API here | |
// Select table | |
let table = await input.tableAsync('Select table'); | |
// Get language list from columns |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Copyright © 2020 by Business Automated | |
//Update dates of tasks in Gantt chart in Airtable. To be used together with the Airtable Gantt and Scripting block. | |
// Select the To Do table and records | |
let table = base.getTable("Table 1"); // <== change here the Table name | |
let toDoRecords = await table.selectRecordsAsync(); | |
let nameOfStartDate = "Start Date"; // <== change here the to the column name with start date | |
let nameOfEndDate = "End Date"; // <== change here the to the column name with end date | |
let nameOfDuration = "Duration" ; // <== change here the to the column name with duration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Substitute "Orders" for table name which contains values | |
//on which you want to run the vlookup | |
let mainTable = base.getTable("Orders"); | |
let mainTableRecords = await mainTable.selectRecordsAsync({fields:["Item.barcode"]}); | |
//Substitute "Product" for table which contains range to search in | |
let lookupTable = base.getTable("Products"); | |
let lookupRangeRecords = await lookupTable.selectRecordsAsync({fields:["Barcode"]}); | |
//Replace "Item.barcode" with column name which has the values you want to look up |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Substitute "Orders" for table name which contains values | |
//on which you want to run the vlookup | |
let mainTable = base.getTable("Orders"); | |
let mainTableRecords = await mainTable.selectRecordsAsync({fields:["Item.barcode"]}); | |
//Substitute "Product" for table which contains range to search in | |
let lookupTable = base.getTable("Products"); | |
let lookupRangeRecords = await lookupTable.selectRecordsAsync({fields:["Barcode","Name"]}); | |
//Replace "Item.barcode" with column name which has the values you want to look up |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import psutil | |
import requests | |
data_to_send = {} | |
data_to_send["date"] = str(datetime.datetime.now()) | |
data_to_send["disk_usage"] = psutil.disk_usage("/").percent | |
data_to_send["cpu_data"] = {} | |
data_to_send["cpu_data"]["cpu_usage"] = psutil.cpu_percent(1) |