Skip to content

Instantly share code, notes, and snippets.

// 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';
@gregonarash
gregonarash / au4percent.json
Created February 2, 2023 04:47
Australia Fire Districts based on BOM data, details simplified using http://mapshaper.com/ to 4% of original.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
//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
//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
//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
//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
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)